i965/vs: Fix NULL pointer dereference in pre-Gen6 push constant loading.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 30 Aug 2011 19:34:13 +0000 (12:34 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 2 Sep 2011 19:17:06 +0000 (12:17 -0700)
According to the comment, we need to load /some/ push constants on
pre-Gen6 hardware or the GPU will hang.  The existing code set these
bogus parameters to NULL pointers; unfortunately, the code in
brw_curbe.c that loads them dereferences those pointers.  So, change
them to be pointers to an actual floating point value of 0.0.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_vec4_emit.cpp

index 067f1c98af94e70fbb3eef9374224c5d3ed8b551..2d1c878706b29f5359feaa30c6913a1d6acd6a28 100644 (file)
@@ -117,8 +117,8 @@ vec4_visitor::setup_uniforms(int reg)
 
       for (unsigned int i = 0; i < 4; i++) {
         unsigned int slot = this->uniforms * 4 + i;
-
-        c->prog_data.param[slot] = NULL;
+        static float zero = 0.0;
+        c->prog_data.param[slot] = &zero;
       }
 
       this->uniforms++;