Mesa核心数据结构


1 概述

Mesa的核心数据结构包含以下几类:

  • Context
  • Interface

2 Context

2.1 GLXContext

include/GL/glx.h
typedef struct __GLXcontextRec *GLXContext;
src/gallium/state_trackers/glx/xlib/glx_api.c
/**
 * The GLXContext typedef is defined as a pointer to this structure.
 */
struct __GLXcontextRec
{
   
   
   Display *currentDpy;
   GLboolean isDirect;
   GLXDrawable currentDrawable;
   GLXDrawable currentReadable;
   XID xid;

   XMesaContext xmesaContext;
};

2.2 XMesaContext

src/gallium/state_trackers/glx/xlib/xm_api.h
#include "main/mtypes.h" /* for gl_config */
#include "state_tracker/st_api.h"
#include "os/os_thread.h"

#include "state_tracker/xlibsw_api.h"

# include <X11/Xlib.h>
# include <X11/Xlibint.h>
# include <X11/Xutil.h>

struct hud_context;

typedef struct xmesa_display *XMesaDisplay;
typedef struct xmesa_buffer *XMesaBuffer;
typedef struct xmesa_context *XMesaContext;
typedef struct xmesa_visual *XMesaVisual;


struct xmesa_display {
   
   
   mtx_t mutex;

   Display *display;
   struct pipe_screen *screen;
   struct st_manager *smapi;

   struct pipe_context *pipe;
};
// 省略
/**
 * Context info, derived from st_context.
 * Basically corresponds to a GLXContext.
 */
struct xmesa_context {
   
   
   struct st_context_iface *st;
   XMesaVisual xm_visual;	/** pixel format info */
   XMesaBuffer xm_buffer;	/** current drawbuffer */
   XMesaBuffer xm_read_buffer;  /** current readbuffer */
   struct hud_context *hud;
};

2.3 gl_context

src/mesa/main/mtypes.h
/**
 * Mesa rendering context.
 *
 * This is the central context data structure for Mesa.  Almost all
 * OpenGL state is contained in this structure.
 * Think of this as a base class from which device drivers will derive
 * sub classes.
 */
struct gl_context
{
   
   
   /** State possibly shared with other contexts in the address space */
   struct gl_shared_state *Shared;

   /** \name API function pointer tables */
   /*@{*/
   gl_api API;

   /**
    * The current dispatch table for non-displaylist-saving execution, either
    * BeginEnd or OutsideBeginEnd
    */
   struct _glapi_table *Exec;
   /**
    * The normal dispatch table for non-displaylist-saving, non-begin/end
    */
   struct _glapi_table *OutsideBeginEnd;
   /** The dispatch table used between glNewList() and glEndList() */
   struct _glapi_table *Save;
   /**
    * The dispatch table used between glBegin() and glEnd() (outside of a
    * display list).  Only valid functions between those two are set, which is
    * mostly just the set in a GLvertexformat struct.
    */
   struct _glapi_table *BeginEnd;
   /**
    * Dispatch table for when a graphics reset has happened.
    */
   struct _glapi_table *ContextLost;
   /**
    * Dispatch table used to marshal API calls from the client program to a
    * separate server thread.  NULL if API calls are not being marshalled to
    * another thread.
    */
   struct _glapi_table *MarshalExec;
   /**
    * Dispatch table currently in use for fielding API calls from the client
    * pr
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值