summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-02-09 10:12:11 -0700
committerBrian Paul <[email protected]>2009-02-09 10:12:11 -0700
commit3c15e02783ed5e908d7668c39786337d62e51d12 (patch)
tree082c95fda45d4602789bb63477467fdf2aefb239
parent87e44d9003d6fdd4b9be911ad1aa4de1f87068d9 (diff)
softpipe: add null ptr check in softpipe_map_constant_buffers()
Fixes segfault regression in progs/glsl/identity.c
-rw-r--r--src/gallium/drivers/softpipe/sp_draw_arrays.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gallium/drivers/softpipe/sp_draw_arrays.c b/src/gallium/drivers/softpipe/sp_draw_arrays.c
index ecc9d003192..7e3a25e34b1 100644
--- a/src/gallium/drivers/softpipe/sp_draw_arrays.c
+++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c
@@ -47,16 +47,22 @@ static void
softpipe_map_constant_buffers(struct softpipe_context *sp)
{
struct pipe_winsys *ws = sp->pipe.winsys;
- uint i;
+ uint i, size;
+
for (i = 0; i < PIPE_SHADER_TYPES; i++) {
if (sp->constants[i].buffer && sp->constants[i].buffer->size)
sp->mapped_constants[i] = ws->buffer_map(ws, sp->constants[i].buffer,
PIPE_BUFFER_USAGE_CPU_READ);
}
+ if (sp->constants[PIPE_SHADER_VERTEX].buffer)
+ size = sp->constants[PIPE_SHADER_VERTEX].buffer->size;
+ else
+ size = 0;
+
draw_set_mapped_constant_buffer(sp->draw,
sp->mapped_constants[PIPE_SHADER_VERTEX],
- sp->constants[PIPE_SHADER_VERTEX].buffer->size);
+ size);
}
static void