summaryrefslogtreecommitdiff
path: root/src/mesa/tnl_dd
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2005-07-18 12:31:24 +0000
committerIan Romanick <idr@us.ibm.com>2005-07-18 12:31:24 +0000
commit9bdfee3a470a535ebe31074651fbacf680bcea6a (patch)
treefba4d709fc92d1afafdf77f0e9db9a82e1d52831 /src/mesa/tnl_dd
parente0e993c5ff090058037875642dcd34727a3d8760 (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/tnl_dd')
-rw-r--r--src/mesa/tnl_dd/imm/t_dd_imm_capi.h48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/mesa/tnl_dd/imm/t_dd_imm_capi.h b/src/mesa/tnl_dd/imm/t_dd_imm_capi.h
index 77f3a4ab49..eecbf0da5d 100644
--- a/src/mesa/tnl_dd/imm/t_dd_imm_capi.h
+++ b/src/mesa/tnl_dd/imm/t_dd_imm_capi.h
@@ -287,12 +287,12 @@ static void TAG(choose_Color3f)( GLfloat r, GLfloat g, GLfloat b )
if ( ctx->Light.Enabled ) {
if ( ctx->Light.ColorMaterialEnabled ) {
- ctx->Exec->Color3f = TAG(ColorMaterial3f);
+ SET_Color3f(ctx->Exec, TAG(ColorMaterial3f));
} else {
- ctx->Exec->Color3f = _mesa_noop_Color3f;
+ SET_Color3f(ctx->Exec, _mesa_noop_Color3f);
}
} else {
- ctx->Exec->Color3f = TAG(Color3f);
+ SET_Color3f(ctx->Exec, TAG(Color3f));
}
glColor3f( r, g, b );
}
@@ -303,12 +303,12 @@ static void TAG(choose_Color3fv)( const GLfloat *v )
if ( ctx->Light.Enabled ) {
if ( ctx->Light.ColorMaterialEnabled ) {
- ctx->Exec->Color3fv = TAG(ColorMaterial3fv);
+ SET_Color3fv(ctx->Exec, TAG(ColorMaterial3fv));
} else {
- ctx->Exec->Color3fv = _mesa_noop_Color3fv;
+ SET_Color3fv(ctx->Exec, _mesa_noop_Color3fv);
}
} else {
- ctx->Exec->Color3fv = TAG(Color3fv);
+ SET_Color3fv(ctx->Exec, TAG(Color3fv));
}
glColor3fv( v );
}
@@ -319,12 +319,12 @@ static void TAG(choose_Color3ub)( GLubyte r, GLubyte g, GLubyte b )
if ( ctx->Light.Enabled ) {
if ( ctx->Light.ColorMaterialEnabled ) {
- ctx->Exec->Color3ub = TAG(ColorMaterial3ub);
+ SET_Color3ub(ctx->Exec, TAG(ColorMaterial3ub));
} else {
- ctx->Exec->Color3ub = _mesa_noop_Color3ub;
+ SET_Color3ub(ctx->Exec, _mesa_noop_Color3ub);
}
} else {
- ctx->Exec->Color3ub = TAG(Color3ub);
+ SET_Color3ub(ctx->Exec, TAG(Color3ub));
}
glColor3ub( r, g, b );
}
@@ -335,12 +335,12 @@ static void TAG(choose_Color3ubv)( const GLubyte *v )
if ( ctx->Light.Enabled ) {
if ( ctx->Light.ColorMaterialEnabled ) {
- ctx->Exec->Color3ubv = TAG(ColorMaterial3ubv);
+ SET_Color3ubv(ctx->Exec, TAG(ColorMaterial3ubv));
} else {
- ctx->Exec->Color3ubv = _mesa_noop_Color3ubv;
+ SET_Color3ubv(ctx->Exec, _mesa_noop_Color3ubv);
}
} else {
- ctx->Exec->Color3ubv = TAG(Color3ubv);
+ SET_Color3ubv(ctx->Exec, TAG(Color3ubv));
}
glColor3ubv( v );
}
@@ -351,12 +351,12 @@ static void TAG(choose_Color4f)( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
if ( ctx->Light.Enabled ) {
if ( ctx->Light.ColorMaterialEnabled ) {
- ctx->Exec->Color4f = TAG(ColorMaterial4f);
+ SET_Color4f(ctx->Exec, TAG(ColorMaterial4f));
} else {
- ctx->Exec->Color4f = _mesa_noop_Color4f;
+ SET_Color4f(ctx->Exec, _mesa_noop_Color4f);
}
} else {
- ctx->Exec->Color4f = TAG(Color4f);
+ SET_Color4f(ctx->Exec, TAG(Color4f));
}
glColor4f( r, g, b, a );
}
@@ -367,12 +367,12 @@ static void TAG(choose_Color4fv)( const GLfloat *v )
if ( ctx->Light.Enabled ) {
if ( ctx->Light.ColorMaterialEnabled ) {
- ctx->Exec->Color4fv = TAG(ColorMaterial4fv);
+ SET_Color4fv(ctx->Exec, TAG(ColorMaterial4fv));
} else {
- ctx->Exec->Color4fv = _mesa_noop_Color4fv;
+ SET_Color4fv(ctx->Exec, _mesa_noop_Color4fv);
}
} else {
- ctx->Exec->Color4fv = TAG(Color4fv);
+ SET_Color4fv(ctx->Exec, TAG(Color4fv));
}
glColor4fv( v );
}
@@ -383,12 +383,12 @@ static void TAG(choose_Color4ub)( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
if ( ctx->Light.Enabled ) {
if ( ctx->Light.ColorMaterialEnabled ) {
- ctx->Exec->Color4ub = TAG(ColorMaterial4ub);
+ SET_Color4ub(ctx->Exec, TAG(ColorMaterial4ub));
} else {
- ctx->Exec->Color4ub = _mesa_noop_Color4ub;
+ SET_Color4ub(ctx->Exec, _mesa_noop_Color4ub);
}
} else {
- ctx->Exec->Color4ub = TAG(Color4ub);
+ SET_Color4ub(ctx->Exec, TAG(Color4ub));
}
glColor4ub( r, g, b, a );
}
@@ -399,12 +399,12 @@ static void TAG(choose_Color4ubv)( const GLubyte *v )
if ( ctx->Light.Enabled ) {
if ( ctx->Light.ColorMaterialEnabled ) {
- ctx->Exec->Color4ubv = TAG(ColorMaterial4ubv);
+ SET_Color4ubv(ctx->Exec, TAG(ColorMaterial4ubv));
} else {
- ctx->Exec->Color4ubv = _mesa_noop_Color4ubv;
+ SET_Color4ubv(ctx->Exec, _mesa_noop_Color4ubv);
}
} else {
- ctx->Exec->Color4ubv = TAG(Color4ubv);
+ SET_Color4ubv(ctx->Exec, TAG(Color4ubv));
}
glColor4ubv( v );
}