A while back I mentioned on dri-devel that Savage cards will segfault RTCW 
while loading the Checkpoint demo.  
( http://www.nixnuts.net/benchmarks/current/ )  The problem is in 
Mesa/src/mesa/tnl/t_tertex.c around lines 741 and 913.

   for (j = 0; j < count; j++) {
      GLvector4f *vptr = VB->AttribPtr[a[j].attrib];
      a[j].inputstride = vptr->stride;
      ...
   }

vptr is null in the middle of the for loop ( j=2 is null j=0, 1, and 3 is 
valid.)  I have no idea why this is the case, but I've attached a simple fix 
which eliminates the problem.


John Lightsey
--- xc/../Mesa/src/mesa/tnl/t_vertex.c.orig	2004-09-30 16:59:08.000000000 -0500
+++ xc/../Mesa/src/mesa/tnl/t_vertex.c	2004-09-30 16:59:58.000000000 -0500
@@ -741,9 +741,11 @@
 
    for (j = 0; j < count; j++) {
       GLvector4f *vptr = VB->AttribPtr[a[j].attrib];
-      a[j].inputstride = vptr->stride;
-      a[j].inputptr = ((GLubyte *)vptr->data) + start * vptr->stride;
-      a[j].emit = a[j].insert[vptr->size - 1];
+      if (vptr) {
+         a[j].inputstride = vptr->stride;
+         a[j].inputptr = ((GLubyte *)vptr->data) + start * vptr->stride;
+         a[j].emit = a[j].insert[vptr->size - 1];
+      }
    }
 
    end -= start;
@@ -913,9 +915,11 @@
 
    for (j = 0; j < count; j++) {
       GLvector4f *vptr = VB->AttribPtr[a[j].attrib];
-      a[j].inputstride = vptr->stride;
-      a[j].inputptr = ((GLubyte *)vptr->data) + start * vptr->stride;
-      a[j].emit = a[j].insert[vptr->size - 1];
+      if (vptr) {
+         a[j].inputstride = vptr->stride;
+         a[j].inputptr = ((GLubyte *)vptr->data) + start * vptr->stride;
+         a[j].emit = a[j].insert[vptr->size - 1];
+      }
    }
 
    vtx->emit = 0;

Reply via email to