[Mesa-dev] merging glapi-reorg branch

Brian Paul brianp at vmware.com
Wed Oct 27 07:40:30 PDT 2010


On 10/26/2010 10:06 PM, Chia-I Wu wrote:
> Hi all,
>
> I've pushed a new branch, glapi-reorg
>
>    http://cgit.freedesktop.org/mesa/mesa/log/?h=glapi-reorg
>
> to reorganize glapi headers.
>
> It turns out that glapidispatch.h and glapioffsets.h are core mesa
> headers.  The branch drops the use of both headers in glapi and glx
> (which is considered an extension to glapi when it comes to defining
> public GL entries).   The headers are then moved to core mesa and
> merged.
>
> A terse example of what are in the headers is
>
>    #if !defined(_GLAPI_USE_REMAP_TABLE)
>    #  define _gloffset_AttachShader 408
>    #  define GET_AttachShader(disp) ((disp)->AttachShader)
>    #else
>    #  define _gloffset_AttachShader \
>          driDispatchRemapTable[AttachShader_remap_index]
>    #  define GET_AttachShader(disp) \
>          GET_by_offset(disp, driDispatchRemapTable[AttachShader_remap_index])
>    #endif
>
> These defines allow core mesa to be compiled for DRI drivers or
> non-DRI drivers depending on whether _GLAPI_USE_REMAP_TABLE is
> defined.  They are not needed in glapi.  Actually, glapi will not
> compile when _GLAPI_USE_REMAP_TABLE is defined.
>
> Other than moving the headers to core mesa, the branch also turns the
> above example into
>
>    #if !defined(_GLAPI_USE_REMAP_TABLE)
>    #  define _gloffset_AttachShader 408
>    #else
>    #  define _gloffset_AttachShader \
>          driDispatchRemapTable[AttachShader_remap_index]
>    #endif
>    #define GET_AttachShader(disp) \
>          GET_by_offset(disp, _gloffset_AttachShader)
>
> and drops glapitable.h includes from core mesa.  So other than
> dropping glapidispatch.h and glapioffsets.h from glapi, the branch
> also identifies that glapitable.h is a private header of glapi.
>
> I am working on making libGL.so support multiple APIs (or profiles in
> light of GLX_EXT_create_context_es2_profile).  This reorganization is
> not a prerequisite to that, but it makes the fact that _glapi_table is
> opaque to core mesa more clear.
>
> If there is no objection, I'd like to merge it this week.

Looks good and seems to work fine here.  Anything to simplify the 
dispatch code is probably good.  It's really grown in size and 
complexity over the years.

Here's another idea: the glapitemp.h file/template is only used by two 
.c files (AFAICT):

src/mapi/glapi/glapi_dispatch.c
src/mapi/glapi/glapi_nop.c

How about getting rid of the glapitemp.h file entirely and just 
generating glapi_dispatch.c and glapi_nop.c directly with python scripts?

The glapitemp.h file goes way back to before we even used python for 
dispatch code generation.  I think I wrote the first version entirely 
by hand.

-Brian


More information about the mesa-dev mailing list