i965/fs: Fix segfault when using INTEL_DEBUG=perf with non-GLSL.
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 15 Oct 2012 19:00:38 +0000 (12:00 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 16 Oct 2012 19:02:01 +0000 (12:02 -0700)
Now that ARB programs and fixed function are routed through the new
backend, shader might be NULL.  Don't do INTEL_DEBUG=perf support in
that case, since it relies on shader->compiled_once.

Since INTEL_DEBUG=perf wasn't previously supported, this maintains the
status quo.  It might be nice to support it someday, however.

This could be moved to brw_shader_program instead of brw_shader, but
it appears even prog can be NULL in that case.

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

index 0545a74ec3d2ae7dc743bd883149b7eda58216d3..fa8cf89c2ec4a447f03a7b9628e380d004fac790 100644 (file)
@@ -1974,7 +1974,7 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c,
 
    c->prog_data.dispatch_width = 8;
 
-   if (unlikely(INTEL_DEBUG & DEBUG_PERF)) {
+   if (unlikely(INTEL_DEBUG & DEBUG_PERF) && shader) {
       if (shader->compiled_once)
          brw_wm_debug_recompile(brw, prog, &c->key);
       shader->compiled_once = true;