gallium: fix invalid call to draw_set_mapped_constant_buffer()
authorBrian Paul <brian.paul@tungstengraphics.com>
Fri, 20 Jun 2008 23:28:42 +0000 (17:28 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Fri, 20 Jun 2008 23:28:42 +0000 (17:28 -0600)
We were indexing sp_constants[i] outside the loop so i was 2.
Replace i with PIPE_SHADER_VERTEX.
Also, replace magic '2' with PIPE_SHADER_TYPES in a few places.

src/gallium/drivers/softpipe/sp_context.h
src/gallium/drivers/softpipe/sp_draw_arrays.c

index 62eabfb30e80a184d1226db8e1d12059dc04d6d0..078886f93c97d32849c72fd0c8098394aed7611c 100644 (file)
@@ -69,7 +69,7 @@ struct softpipe_context {
 
    struct pipe_blend_color blend_color;
    struct pipe_clip_state clip;
-   struct pipe_constant_buffer constants[2];
+   struct pipe_constant_buffer constants[PIPE_SHADER_TYPES];
    struct pipe_framebuffer_state framebuffer;
    struct pipe_poly_stipple poly_stipple;
    struct pipe_scissor_state scissor;
index d4d5fa744fbdadb56aae2aabb882fc75d58d240b..12b44a8211888afd4d54ae3b8b95a69b16ff8c48 100644 (file)
@@ -47,7 +47,7 @@ softpipe_map_constant_buffers(struct softpipe_context *sp)
 {
    struct pipe_winsys *ws = sp->pipe.winsys;
    uint i;
-   for (i = 0; i < 2; i++) {
+   for (i = 0; i < PIPE_SHADER_TYPES; i++) {
       if (sp->constants[i].size)
          sp->mapped_constants[i] = ws->buffer_map(ws, sp->constants[i].buffer,
                                                   PIPE_BUFFER_USAGE_CPU_READ);
@@ -55,7 +55,7 @@ softpipe_map_constant_buffers(struct softpipe_context *sp)
 
    draw_set_mapped_constant_buffer(sp->draw,
                                    sp->mapped_constants[PIPE_SHADER_VERTEX],
-                                   sp->constants[i].size);
+                                   sp->constants[PIPE_SHADER_VERTEX].size);
 }
 
 static void