From ab79d2be2e1288d4044a8b4ef356991625a176f5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 21 Feb 2012 13:17:40 -0800 Subject: i965/gen6: Fix near-NULL deref in setting up GS binding table for non-XFB. Reviewed-by: Kenneth Graunke Tested-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/gen6_sol.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/gen6_sol.c b/src/mesa/drivers/dri/i965/gen6_sol.c index 191ed5bd30f..07316c869a9 100644 --- a/src/mesa/drivers/dri/i965/gen6_sol.c +++ b/src/mesa/drivers/dri/i965/gen6_sol.c @@ -87,13 +87,16 @@ brw_gs_upload_binding_table(struct brw_context *brw) /* BRW_NEW_VERTEX_PROGRAM */ const struct gl_shader_program *shaderprog = ctx->Shader.CurrentVertexProgram; - const struct gl_transform_feedback_info *linked_xfb_info = - &shaderprog->LinkedTransformFeedback; - /* Currently we only ever upload surfaces for SOL. */ - bool has_surfaces = linked_xfb_info->NumOutputs != 0; - + bool has_surfaces = false; uint32_t *bind; + if (shaderprog) { + const struct gl_transform_feedback_info *linked_xfb_info = + &shaderprog->LinkedTransformFeedback; + /* Currently we only ever upload surfaces for SOL. */ + has_surfaces = linked_xfb_info->NumOutputs != 0; + } + /* Skip making a binding table if we don't have anything to put in it. */ if (!has_surfaces) { if (brw->gs.bind_bo_offset != 0) { -- cgit v1.2.3