i965/gen6: Fix near-NULL deref in setting up GS binding table for non-XFB.
authorEric Anholt <eric@anholt.net>
Tue, 21 Feb 2012 21:17:40 +0000 (13:17 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 21 Feb 2012 21:30:50 +0000 (13:30 -0800)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/gen6_sol.c

index 191ed5bd30f18f43f7924c723f293ab4c04e70dd..07316c869a93ce622d9877101c687b01561b4e8f 100644 (file)
@@ -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) {