文章目录
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

272

被折叠的 条评论
为什么被折叠?



