diff options
author | Ian Romanick <[email protected]> | 2005-07-18 12:31:24 +0000 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2005-07-18 12:31:24 +0000 |
commit | 9bdfee3a470a535ebe31074651fbacf680bcea6a (patch) | |
tree | fba4d709fc92d1afafdf77f0e9db9a82e1d52831 /src/mesa/drivers/dri | |
parent | e0e993c5ff090058037875642dcd34727a3d8760 (diff) |
Wrap every place that accesses a dispatch table with a macro. A new script-
generated file, called src/mesa/glapi/dispatch.h, is added. This file
contains three macros for each API function. It contains a GET, a SET, and
a CALL. Each of the macros take a pointer to the context and a pointer to
the dispatch table.
In several threads on mesa3d-dev we discussed replacing _glapi_add_entrypoint
with a new function called _glapi_add_dispatch. For this discussion, the
important difference between the two is that the caller of _glapi_add_dispatch
does *not* know what the dispatch offset will be at compile time. Because of
this callers need to track the dispatch offset returned by
_glapi_add_dispatch.
http://marc.theaimsgroup.com/?t=111947074700001&r=1&w=2
The downside is that driver code then has to access the dispatch table two
different ways. It accesses it using structure tags (e.g., exec->Begin) for
functions with fixed offsets and via a remap table (e.g., exec[
remap->NewExtensionFunction ]) for functions without fixed offsets. Yuck!
Using the macros allows both types of functions to be accessed
identically. If a driver needs to set a pointer for Begin, it does
'SET_Begin(ctx, exec, my_begin_function)'. If it needs to set a pointer
for NewExtensionFunction, it does 'SET_NewExtensionFunction(ctx, exec,
my_NewExtensionFunction_function)'. Furthermore, if at some point in
the future a static offset is assigned for NewExtensionFunction, only
the macros need to change (instead of every single place that accesses a
table for that function).
This code differs slightly from the originally posted patches in that the
CALL, GET, and SET marcos no longer take a context pointer as a parameter.
Brian Paul had suggested that the remap table could be stored as a global
since it would be set at CreateScreen time and would be constant for all
contexts. This change reflects that feedback.
http://marc.theaimsgroup.com/?t=112087194700001&r=1&w=2
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/ffb/ffb_vtxfmt.c | 25 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_vtxfmt.c | 58 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_vtxfmt_c.c | 32 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_vtxfmt.c | 46 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c | 28 |
5 files changed, 99 insertions, 90 deletions
diff --git a/src/mesa/drivers/dri/ffb/ffb_vtxfmt.c b/src/mesa/drivers/dri/ffb/ffb_vtxfmt.c index 279cda7b371..d6a61d98e52 100644 --- a/src/mesa/drivers/dri/ffb/ffb_vtxfmt.c +++ b/src/mesa/drivers/dri/ffb/ffb_vtxfmt.c @@ -146,28 +146,28 @@ static void choose_normals(void) } if (ctx->Light.EnabledList.next == ctx->Light.EnabledList.prev) { - ctx->Exec->Normal3f = norm_tab[index].normal3f_single; - ctx->Exec->Normal3fv = norm_tab[index].normal3fv_single; + SET_Normal3f(ctx->Exec, norm_tab[index].normal3f_single); + SET_Normal3fv(ctx->Exec, norm_tab[index].normal3fv_single); } else { - ctx->Exec->Normal3f = norm_tab[index].normal3f_multi; - ctx->Exec->Normal3fv = norm_tab[index].normal3fv_multi; + SET_Normal3f(ctx->Exec, norm_tab[index].normal3f_multi); + SET_Normal3fv(ctx->Exec, norm_tab[index].normal3fv_multi); } } else { - ctx->Exec->Normal3f = _mesa_noop_Normal3f; - ctx->Exec->Normal3fv = _mesa_noop_Normal3fv; + SET_Normal3f(ctx->Exec, _mesa_noop_Normal3f); + SET_Normal3fv(ctx->Exec, _mesa_noop_Normal3fv); } } static void ffb_choose_Normal3f(GLfloat x, GLfloat y, GLfloat z) { choose_normals(); - GL_CALL(Normal3f)(x, y, z); + CALL_Normal3f(GET_DISPATCH(), (x, y, z)); } static void ffb_choose_Normal3fv(const GLfloat *v) { choose_normals(); - GL_CALL(Normal3fv)(v); + CALL_Normal3fv(GET_DISPATCH(), (v)); } /* Vertex functions: */ @@ -267,13 +267,14 @@ static void ffb_do_fallback(GLcontext *ctx) * correctly: */ if (fmesa->imm.prim != PRIM_OUTSIDE_BEGIN_END ) - GL_CALL(Begin)(fmesa->imm.prim); + CALL_Begin(GET_DISPATCH(), (fmesa->imm.prim)); if (ctx->Light.Enabled) { - GL_CALL(Color4fv)(ctx->Current.Color); /* Catch ColorMaterial */ - GL_CALL(Normal3fv)(current->normal); + /* Catch ColorMaterial */ + CALL_Color4fv(GET_DISPATCH(), (ctx->Current.Color)); + CALL_Normal3fv(GET_DISPATCH(), (current->normal)); } else { - GL_CALL(Color4fv)(current->color); + CALL_Color4fv(GET_DISPATCH(), (current->color)); } } diff --git a/src/mesa/drivers/dri/r200/r200_vtxfmt.c b/src/mesa/drivers/dri/r200/r200_vtxfmt.c index 32d1ac52197..c5d1f131d06 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxfmt.c +++ b/src/mesa/drivers/dri/r200/r200_vtxfmt.c @@ -58,6 +58,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tnl/t_context.h" #include "tnl/t_array_api.h" +#include "dispatch.h" + static void r200VtxFmtFlushVertices( GLcontext *, GLuint ); static void count_func( const char *name, struct dynfn *l ) @@ -411,13 +413,13 @@ static void dispatch_multitexcoord( GLuint count, GLuint unit, GLfloat * f ) { switch( count ) { case 3: - GL_CALL(MultiTexCoord3fvARB)( GL_TEXTURE0+unit, f ); + CALL_MultiTexCoord3fvARB(GET_DISPATCH(), (GL_TEXTURE0+unit, f)); break; case 2: - GL_CALL(MultiTexCoord2fvARB)( GL_TEXTURE0+unit, f ); + CALL_MultiTexCoord2fvARB(GET_DISPATCH(), (GL_TEXTURE0+unit, f)); break; case 1: - GL_CALL(MultiTexCoord1fvARB)( GL_TEXTURE0+unit, f ); + CALL_MultiTexCoord1fvARB(GET_DISPATCH(), (GL_TEXTURE0+unit, f)); break; default: assert( count == 0 ); @@ -465,7 +467,7 @@ void VFMT_FALLBACK( const char *caller ) assert(rmesa->dma.flush == 0); rmesa->vb.fell_back = GL_TRUE; rmesa->vb.installed = GL_FALSE; - GL_CALL(Begin)( prim ); + CALL_Begin(GET_DISPATCH(), (prim)); if (rmesa->vb.installed_color_3f_sz == 4) alpha = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]; @@ -476,30 +478,30 @@ void VFMT_FALLBACK( const char *caller ) GLuint offset = 3; if (ind0 & R200_VTX_N0) { - GL_CALL(Normal3fv)( &tmp[i][offset] ); + CALL_Normal3fv(GET_DISPATCH(), (&tmp[i][offset])); offset += 3; } if (ind0 & R200_VTX_DISCRETE_FOG) { - GL_CALL(FogCoordfvEXT)( &tmp[i][offset] ); + CALL_FogCoordfvEXT(GET_DISPATCH(), (&tmp[i][offset])); offset++; } if (VTX_COLOR(ind0, 0) == R200_VTX_PK_RGBA) { - GL_CALL(Color4ubv)( (GLubyte *)&tmp[i][offset] ); + CALL_Color4ubv(GET_DISPATCH(), ((GLubyte *)&tmp[i][offset])); offset++; } else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGBA) { - GL_CALL(Color4fv)( &tmp[i][offset] ); + CALL_Color4fv(GET_DISPATCH(), (&tmp[i][offset])); offset+=4; } else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGB) { - GL_CALL(Color3fv)( &tmp[i][offset] ); + CALL_Color3fv(GET_DISPATCH(), (&tmp[i][offset])); offset+=3; } if (VTX_COLOR(ind0, 1) == R200_VTX_PK_RGBA) { - GL_CALL(SecondaryColor3ubvEXT)( (GLubyte *)&tmp[i][offset] ); + CALL_SecondaryColor3ubvEXT(GET_DISPATCH(), ((GLubyte *)&tmp[i][offset])); offset++; } @@ -509,42 +511,42 @@ void VFMT_FALLBACK( const char *caller ) offset += count; } - GL_CALL(Vertex3fv)( &tmp[i][0] ); + CALL_Vertex3fv(GET_DISPATCH(), (&tmp[i][0])); } /* Replay current vertex */ if (ind0 & R200_VTX_N0) - GL_CALL(Normal3fv)( rmesa->vb.normalptr ); + CALL_Normal3fv(GET_DISPATCH(), (rmesa->vb.normalptr)); if (ind0 & R200_VTX_DISCRETE_FOG) { - GL_CALL(FogCoordfvEXT)( rmesa->vb.fogptr ); + CALL_FogCoordfvEXT(GET_DISPATCH(), (rmesa->vb.fogptr)); } if (VTX_COLOR(ind0, 0) == R200_VTX_PK_RGBA) { - GL_CALL(Color4ub)( rmesa->vb.colorptr->red, - rmesa->vb.colorptr->green, - rmesa->vb.colorptr->blue, - rmesa->vb.colorptr->alpha ); + CALL_Color4ub(GET_DISPATCH(), (rmesa->vb.colorptr->red, + rmesa->vb.colorptr->green, + rmesa->vb.colorptr->blue, + rmesa->vb.colorptr->alpha)); } else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGBA) { - GL_CALL(Color4fv)( rmesa->vb.floatcolorptr ); + CALL_Color4fv(GET_DISPATCH(), (rmesa->vb.floatcolorptr)); } else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGB) { if (rmesa->vb.installed_color_3f_sz == 4 && alpha != 1.0) { - GL_CALL(Color4f)( rmesa->vb.floatcolorptr[0], - rmesa->vb.floatcolorptr[1], - rmesa->vb.floatcolorptr[2], - alpha ); + CALL_Color4f(GET_DISPATCH(), (rmesa->vb.floatcolorptr[0], + rmesa->vb.floatcolorptr[1], + rmesa->vb.floatcolorptr[2], + alpha)); } else { - GL_CALL(Color3fv)( rmesa->vb.floatcolorptr ); + CALL_Color3fv(GET_DISPATCH(), (rmesa->vb.floatcolorptr)); } } if (VTX_COLOR(ind0, 1) == R200_VTX_PK_RGBA) - GL_CALL(SecondaryColor3ubEXT)( rmesa->vb.specptr->red, - rmesa->vb.specptr->green, - rmesa->vb.specptr->blue ); + CALL_SecondaryColor3ubEXT(GET_DISPATCH(), (rmesa->vb.specptr->red, + rmesa->vb.specptr->green, + rmesa->vb.specptr->blue)); for ( unit = 0 ; unit < ctx->Const.MaxTextureUnits ; unit++ ) { count = VTX_TEXn_COUNT( ind1, unit ); @@ -882,7 +884,7 @@ static void r200_Materialfv( GLenum face, GLenum pname, if (rmesa->vb.prim[0] != GL_POLYGON+1) { VFMT_FALLBACK( __FUNCTION__ ); - GL_CALL(Materialfv)( face, pname, params ); + CALL_Materialfv(GET_DISPATCH(), (face, pname, params)); return; } _mesa_noop_Materialfv( face, pname, params ); @@ -921,7 +923,7 @@ static void r200_Begin( GLenum mode ) r200VtxfmtValidate( ctx ); if (!rmesa->vb.installed) { - GL_CALL(Begin)( mode ); + CALL_Begin(GET_DISPATCH(), (mode)); return; } diff --git a/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c b/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c index 7a789b21e29..1db5950c8ff 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c +++ b/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c @@ -44,6 +44,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r200_vtxfmt.h" #include "r200_tcl.h" +#include "dispatch.h" + /* Fallback versions of all the entrypoints for situations where * codegen isn't available. This is still a lot faster than the * vb/pipeline implementation in Mesa. @@ -578,7 +580,7 @@ static void r200_MultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t) break; default: VFMT_FALLBACK(__FUNCTION__); - GL_CALL(MultiTexCoord2fARB)(target, s, t); + CALL_MultiTexCoord2fARB(GET_DISPATCH(), (target, s, t)); return; } } @@ -599,7 +601,7 @@ static void r200_MultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat break; default: VFMT_FALLBACK(__FUNCTION__); - GL_CALL(MultiTexCoord3fARB)(target, s, t, r); + CALL_MultiTexCoord3fARB(GET_DISPATCH(), (target, s, t, r)); return; } } @@ -683,15 +685,15 @@ static void choose_##FN ARGS1 \ fprintf(stderr, "%s -- cached codegen\n", __FUNCTION__ ); \ \ if (dfn) \ - ctx->Exec->FN = (FNTYPE)(dfn->code); \ + SET_ ## FN (ctx->Exec, (FNTYPE)(dfn->code)); \ else { \ if (R200_DEBUG & DEBUG_CODEGEN) \ fprintf(stderr, "%s -- generic version\n", __FUNCTION__ ); \ - ctx->Exec->FN = r200_##FN; \ + SET_ ## FN (ctx->Exec, r200_##FN); \ } \ \ ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \ - ctx->Exec->FN ARGS2; \ + CALL_ ## FN (ctx->Exec, ARGS2); \ } @@ -715,7 +717,7 @@ static void choose_##FN ARGS1 \ key[1] = rmesa->vb.vtxfmt_1 & MASK1; \ \ if (VTX_COLOR(rmesa->vb.vtxfmt_0,0) == R200_VTX_PK_RGBA) { \ - ctx->Exec->FN = r200_##FN##_ub; \ + SET_ ## FN (ctx->Exec, r200_##FN##_ub); \ } \ else if (VTX_COLOR(rmesa->vb.vtxfmt_0,0) == R200_VTX_FP_RGB) { \ \ @@ -725,15 +727,15 @@ static void choose_##FN ARGS1 \ if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) { \ r200_copy_to_current( ctx ); \ _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt ); \ - ctx->Exec->FN ARGS2; \ + CALL_ ## FN (ctx->Exec, ARGS2); \ return; \ } \ } \ \ - ctx->Exec->FN = r200_##FN##_3f; \ + SET_ ## FN (ctx->Exec, r200_##FN##_3f); \ } \ else { \ - ctx->Exec->FN = r200_##FN##_4f; \ + SET_ ## FN (ctx->Exec, r200_##FN##_4f); \ } \ \ \ @@ -743,13 +745,13 @@ static void choose_##FN ARGS1 \ if (dfn) { \ if (R200_DEBUG & DEBUG_CODEGEN) \ fprintf(stderr, "%s -- codegen version\n", __FUNCTION__ ); \ - ctx->Exec->FN = (FNTYPE)dfn->code; \ + SET_ ## FN (ctx->Exec, (FNTYPE)dfn->code); \ } \ else if (R200_DEBUG & DEBUG_CODEGEN) \ fprintf(stderr, "%s -- 'c' version\n", __FUNCTION__ ); \ \ ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \ - ctx->Exec->FN ARGS2; \ + CALL_ ## FN (ctx->Exec, ARGS2); \ } @@ -778,16 +780,16 @@ static void choose_##FN ARGS1 \ fprintf(stderr, "%s -- cached version\n", __FUNCTION__ ); \ \ if (dfn) \ - ctx->Exec->FN = (FNTYPE)(dfn->code); \ + SET_ ## FN (ctx->Exec, (FNTYPE)(dfn->code)); \ else { \ if (R200_DEBUG & DEBUG_CODEGEN) \ fprintf(stderr, "%s -- generic version\n", __FUNCTION__ ); \ - ctx->Exec->FN = (VTX_COLOR(rmesa->vb.vtxfmt_0,1) == R200_VTX_PK_RGBA) \ - ? r200_##FN##_ub : r200_##FN##_3f; \ + SET_ ## FN (ctx->Exec, (VTX_COLOR(rmesa->vb.vtxfmt_0,1) == R200_VTX_PK_RGBA) \ + ? r200_##FN##_ub : r200_##FN##_3f); \ } \ \ ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \ - ctx->Exec->FN ARGS2; \ + CALL_ ## FN (ctx->Exec, ARGS2); \ } diff --git a/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c b/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c index b82c158e810..c5ea51cea9d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c +++ b/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c @@ -57,6 +57,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_swtcl.h" #include "radeon_vtxfmt.h" +#include "dispatch.h" + static void radeonVtxfmtFlushVertices( GLcontext *, GLuint ); static void count_func( const char *name, struct dynfn *l ) @@ -387,7 +389,7 @@ static void VFMT_FALLBACK( const char *caller ) assert(rmesa->dma.flush == 0); rmesa->vb.fell_back = GL_TRUE; rmesa->vb.installed = GL_FALSE; - GL_CALL(Begin)( prim ); + CALL_Begin(GET_DISPATCH(), (prim)); if (rmesa->vb.installed_color_3f_sz == 4) alpha = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]; @@ -397,69 +399,69 @@ static void VFMT_FALLBACK( const char *caller ) for (i = 0 ; i < nrverts; i++) { GLuint offset = 3; if (ind & RADEON_CP_VC_FRMT_N0) { - GL_CALL(Normal3fv)( &tmp[i][offset] ); + CALL_Normal3fv(GET_DISPATCH(), (&tmp[i][offset])); offset += 3; } if (ind & RADEON_CP_VC_FRMT_PKCOLOR) { radeon_color_t *col = (radeon_color_t *)&tmp[i][offset]; - GL_CALL(Color4ub)( col->red, col->green, col->blue, col->alpha ); + CALL_Color4ub(GET_DISPATCH(), (col->red, col->green, col->blue, col->alpha)); offset++; } else if (ind & RADEON_CP_VC_FRMT_FPALPHA) { - GL_CALL(Color4fv)( &tmp[i][offset] ); + CALL_Color4fv(GET_DISPATCH(), (&tmp[i][offset])); offset+=4; } else if (ind & RADEON_CP_VC_FRMT_FPCOLOR) { - GL_CALL(Color3fv)( &tmp[i][offset] ); + CALL_Color3fv(GET_DISPATCH(), (&tmp[i][offset])); offset+=3; } if (ind & RADEON_CP_VC_FRMT_PKSPEC) { radeon_color_t *spec = (radeon_color_t *)&tmp[i][offset]; - GL_CALL(SecondaryColor3ubEXT)( spec->red, spec->green, spec->blue ); + CALL_SecondaryColor3ubEXT(GET_DISPATCH(), (spec->red, spec->green, spec->blue)); offset++; } if (ind & RADEON_CP_VC_FRMT_ST0) { - GL_CALL(TexCoord2fv)( &tmp[i][offset] ); + CALL_TexCoord2fv(GET_DISPATCH(), (&tmp[i][offset])); offset += 2; } if (ind & RADEON_CP_VC_FRMT_ST1) { - GL_CALL(MultiTexCoord2fvARB)( GL_TEXTURE1_ARB, &tmp[i][offset] ); + CALL_MultiTexCoord2fvARB(GET_DISPATCH(), (GL_TEXTURE1_ARB, &tmp[i][offset])); offset += 2; } - GL_CALL(Vertex3fv)( &tmp[i][0] ); + CALL_Vertex3fv(GET_DISPATCH(), (&tmp[i][0])); } /* Replay current vertex */ if (ind & RADEON_CP_VC_FRMT_N0) - GL_CALL(Normal3fv)( rmesa->vb.normalptr ); + CALL_Normal3fv(GET_DISPATCH(), (rmesa->vb.normalptr)); if (ind & RADEON_CP_VC_FRMT_PKCOLOR) - GL_CALL(Color4ub)( rmesa->vb.colorptr->red, rmesa->vb.colorptr->green, rmesa->vb.colorptr->blue, rmesa->vb.colorptr->alpha ); + CALL_Color4ub(GET_DISPATCH(), (rmesa->vb.colorptr->red, rmesa->vb.colorptr->green, rmesa->vb.colorptr->blue, rmesa->vb.colorptr->alpha)); else if (ind & RADEON_CP_VC_FRMT_FPALPHA) - GL_CALL(Color4fv)( rmesa->vb.floatcolorptr ); + CALL_Color4fv(GET_DISPATCH(), (rmesa->vb.floatcolorptr)); else if (ind & RADEON_CP_VC_FRMT_FPCOLOR) { if (rmesa->vb.installed_color_3f_sz == 4 && alpha != 1.0) - GL_CALL(Color4f)( rmesa->vb.floatcolorptr[0], - rmesa->vb.floatcolorptr[1], - rmesa->vb.floatcolorptr[2], - alpha ); + CALL_Color4f(GET_DISPATCH(), (rmesa->vb.floatcolorptr[0], + rmesa->vb.floatcolorptr[1], + rmesa->vb.floatcolorptr[2], + alpha)); else - GL_CALL(Color3fv)( rmesa->vb.floatcolorptr ); + CALL_Color3fv(GET_DISPATCH(), (rmesa->vb.floatcolorptr)); } if (ind & RADEON_CP_VC_FRMT_PKSPEC) - GL_CALL(SecondaryColor3ubEXT)( rmesa->vb.specptr->red, rmesa->vb.specptr->green, rmesa->vb.specptr->blue ); + CALL_SecondaryColor3ubEXT(GET_DISPATCH(), (rmesa->vb.specptr->red, rmesa->vb.specptr->green, rmesa->vb.specptr->blue)); if (ind & RADEON_CP_VC_FRMT_ST0) - GL_CALL(TexCoord2fv)( rmesa->vb.texcoordptr[0] ); + CALL_TexCoord2fv(GET_DISPATCH(), (rmesa->vb.texcoordptr[0])); if (ind & RADEON_CP_VC_FRMT_ST1) - GL_CALL(MultiTexCoord2fvARB)( GL_TEXTURE1_ARB, rmesa->vb.texcoordptr[1] ); + CALL_MultiTexCoord2fvARB(GET_DISPATCH(), (GL_TEXTURE1_ARB, rmesa->vb.texcoordptr[1])); } @@ -758,7 +760,7 @@ static void radeon_Materialfv( GLenum face, GLenum pname, if (rmesa->vb.prim[0] != GL_POLYGON+1) { VFMT_FALLBACK( __FUNCTION__ ); - GL_CALL(Materialfv)( face, pname, params ); + CALL_Materialfv(GET_DISPATCH(), (face, pname, params)); return; } _mesa_noop_Materialfv( face, pname, params ); @@ -797,7 +799,7 @@ static void radeon_Begin( GLenum mode ) radeonVtxfmtValidate( ctx ); if (!rmesa->vb.installed) { - GL_CALL(Begin)( mode ); + CALL_Begin(GET_DISPATCH(), (mode)); return; } diff --git a/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c b/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c index 3e8749a8cd6..342b0b39c1b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c +++ b/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c @@ -41,6 +41,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_vtxfmt.h" +#include "dispatch.h" + /* Fallback versions of all the entrypoints for situations where * codegen isn't available. This is still a lot faster than the * vb/pipeline implementation in Mesa. @@ -623,15 +625,15 @@ static void choose_##FN ARGS1 \ fprintf(stderr, "%s -- cached codegen\n", __FUNCTION__ ); \ \ if (dfn) \ - ctx->Exec->FN = (FNTYPE)(dfn->code); \ + SET_ ## FN (ctx->Exec, (FNTYPE)(dfn->code)); \ else { \ if (RADEON_DEBUG & DEBUG_CODEGEN) \ fprintf(stderr, "%s -- generic version\n", __FUNCTION__ ); \ - ctx->Exec->FN = radeon_##FN; \ + SET_ ## FN (ctx->Exec, radeon_##FN); \ } \ \ ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \ - ctx->Exec->FN ARGS2; \ + CALL_ ## FN (ctx->Exec, ARGS2); \ } @@ -652,7 +654,7 @@ static void choose_##FN ARGS1 \ struct dynfn *dfn; \ \ if (rmesa->vb.vertex_format & ACTIVE_PKCOLOR) { \ - ctx->Exec->FN = radeon_##FN##_ub; \ + SET_ ## FN (ctx->Exec, radeon_##FN##_ub); \ } \ else if ((rmesa->vb.vertex_format & \ (ACTIVE_FPCOLOR|ACTIVE_FPALPHA)) == ACTIVE_FPCOLOR) { \ @@ -663,15 +665,15 @@ static void choose_##FN ARGS1 \ if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) { \ radeon_copy_to_current( ctx ); \ _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt ); \ - ctx->Exec->FN ARGS2; \ + CALL_ ## FN (ctx->Exec, ARGS2); \ return; \ } \ } \ \ - ctx->Exec->FN = radeon_##FN##_3f; \ + SET_ ## FN (ctx->Exec, radeon_##FN##_3f); \ } \ else { \ - ctx->Exec->FN = radeon_##FN##_4f; \ + SET_ ## FN (ctx->Exec, radeon_##FN##_4f); \ } \ \ \ @@ -681,13 +683,13 @@ static void choose_##FN ARGS1 \ if (dfn) { \ if (RADEON_DEBUG & DEBUG_CODEGEN) \ fprintf(stderr, "%s -- codegen version\n", __FUNCTION__ ); \ - ctx->Exec->FN = (FNTYPE)dfn->code; \ + SET_ ## FN (ctx->Exec, (FNTYPE)dfn->code); \ } \ else if (RADEON_DEBUG & DEBUG_CODEGEN) \ fprintf(stderr, "%s -- 'c' version\n", __FUNCTION__ ); \ \ ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \ - ctx->Exec->FN ARGS2; \ + CALL_ ## FN (ctx->Exec, ARGS2); \ } @@ -712,16 +714,16 @@ static void choose_##FN ARGS1 \ fprintf(stderr, "%s -- cached version\n", __FUNCTION__ ); \ \ if (dfn) \ - ctx->Exec->FN = (FNTYPE)(dfn->code); \ + SET_ ## FN (ctx->Exec, (FNTYPE)(dfn->code)); \ else { \ if (RADEON_DEBUG & DEBUG_CODEGEN) \ fprintf(stderr, "%s -- generic version\n", __FUNCTION__ ); \ - ctx->Exec->FN = ((rmesa->vb.vertex_format & ACTIVE_PKSPEC) != 0) \ - ? radeon_##FN##_ub : radeon_##FN##_3f; \ + SET_ ## FN (ctx->Exec, ((rmesa->vb.vertex_format & ACTIVE_PKSPEC) != 0) \ + ? radeon_##FN##_ub : radeon_##FN##_3f); \ } \ \ ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \ - ctx->Exec->FN ARGS2; \ + CALL_ ## FN (ctx->Exec, ARGS2); \ } |