summaryrefslogtreecommitdiff
path: root/src/mesa/main/varray.c
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/main/varray.c
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/main/varray.c')
-rw-r--r--src/mesa/main/varray.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 404302873b..6781b69815 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -33,7 +33,7 @@
#include "texstate.h"
#include "mtypes.h"
#include "varray.h"
-
+#include "dispatch.h"
#ifndef GL_BOOLEAN
#define GL_BOOLEAN 0x9999
@@ -851,7 +851,7 @@ _mesa_MultiDrawArraysEXT( GLenum mode, GLint *first,
for (i = 0; i < primcount; i++) {
if (count[i] > 0) {
- (ctx->Exec->DrawArrays)(mode, first[i], count[i]);
+ CALL_DrawArrays(ctx->Exec, (mode, first[i], count[i]));
}
}
}
@@ -869,7 +869,7 @@ _mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type,
for (i = 0; i < primcount; i++) {
if (count[i] > 0) {
- (ctx->Exec->DrawElements)(mode, count[i], type, indices[i]);
+ CALL_DrawElements(ctx->Exec, (mode, count[i], type, indices[i]));
}
}
}
@@ -889,7 +889,7 @@ _mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first,
for ( i = 0 ; i < primcount ; i++ ) {
if ( count[i] > 0 ) {
GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride));
- (ctx->Exec->DrawArrays)( m, first[i], count[i] );
+ CALL_DrawArrays(ctx->Exec, ( m, first[i], count[i] ));
}
}
}
@@ -911,7 +911,7 @@ _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count,
for ( i = 0 ; i < primcount ; i++ ) {
if ( count[i] > 0 ) {
GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride));
- (ctx->Exec->DrawElements)( m, count[i], type, indices[i] );
+ CALL_DrawElements(ctx->Exec, ( m, count[i], type, indices[i] ));
}
}
}