Ian Romanick wrote:
I'm really, really confused as to why this bug doesn't hit X.org CVS
builds.  The only way that it would not hit is if IN_DRI_DRIVER isn't
set.  If that's the case, it's also a bug.  I'm not sure if we should
just apply this patch (should just need the changes to dispatch.h) to
X.org CVS or re-import Mesa with the patch applied.  Fortunately for me,
it's not my call to make. :)

Index: src/mesa/glapi/dispatch.h
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/glapi/dispatch.h,v
retrieving revision 1.2
diff -u -d -r1.2 dispatch.h
--- src/mesa/glapi/dispatch.h   28 Jul 2005 00:29:53 -0000      1.2
+++ src/mesa/glapi/dispatch.h   1 Aug 2005 17:39:36 -0000
@@ -40,11 +40,20 @@
  */
#define CALL_by_offset(disp, cast, offset, parameters) \
-    (*(cast (((_glapi_proc *)(disp))[offset]))) parameters
+    (*(cast (GET_by_offset(disp, offset))) parameters
 #define GET_by_offset(disp, offset) \
-    (((_glapi_proc *)(disp))[offset])
+    (offset != 0) ? (((_glapi_proc *)(disp))[offset]) : NULL
 #define SET_by_offset(disp, offset, fn) \
-    ((((_glapi_proc *)(disp))[offset]) = (_glapi_proc) fn)
+    do { \
+        if ( (offset) == 0 ) { \
+            fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\n", \
+                     __func__, __LINE__, disp, offset, # fn); \
+            abort(); \
+        } \
+        else { \
+            ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \
+        } \
+    } while(0)
#define CALL_NewList(disp, parameters) (*((disp)->NewList)) parameters
 #define GET_NewList(disp) ((disp)->NewList)
Index: src/mesa/glapi/gl_table.py
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/glapi/gl_table.py,v
retrieving revision 1.8
diff -u -d -r1.8 gl_table.py
--- src/mesa/glapi/gl_table.py  28 Jul 2005 00:29:53 -0000      1.8
+++ src/mesa/glapi/gl_table.py  1 Aug 2005 17:39:36 -0000
@@ -91,11 +91,20 @@
def printBody(self, api):
                print '#define CALL_by_offset(disp, cast, offset, parameters) 
\\'
-               print '    (*(cast (((_glapi_proc *)(disp))[offset]))) 
parameters'
+               print '    (*(cast (GET_by_offset(disp, offset))) parameters'
                print '#define GET_by_offset(disp, offset) \\'
-               print '    (((_glapi_proc *)(disp))[offset])'
+               print '    (offset != 0) ? (((_glapi_proc *)(disp))[offset]) : 
NULL'
                print '#define SET_by_offset(disp, offset, fn) \\'
-               print '    ((((_glapi_proc *)(disp))[offset]) = (_glapi_proc) 
fn)'
+               print '    do { \\'
+               print '        if ( (offset) == 0 ) { \\'
+               print '            fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, 
%s)!\\n", \\'
+               print '                     __func__, __LINE__, disp, offset, # 
fn); \\'
+               print '            abort(); \\'
+               print '        } \\'
+               print '        else { \\'
+               print '            ( (_glapi_proc *) (disp) )[offset] = 
(_glapi_proc) fn; \\'
+               print '        } \\'
+               print '    } while(0)'
                print ''
abi = [ "1.0", "1.1", "1.2", "GL_ARB_multitexture" ]

Doesn't compile, the parantheses in the CALL_by_offset definition don't seem to add up (in both the python script and dispatch.h). I tried a quick fix without really looking at the code (adding that paranthesis...) but it still didn't compile (at a different place, this time in vtxfmt_tmp.h, I didn't look through all the macro definitions where the error apparently happened).

Roland


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to