From: Matt Turner Date: Thu, 11 Apr 2013 16:55:42 +0000 (-0700) Subject: i965: NULL check prog on shader compilation failure. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=32a8e877666f7c3798d736bb6f05ad2f41356ebf;p=mesa.git i965: NULL check prog on shader compilation failure. Also change if (shader) to if (prog) for consistency. Reviewed-by: Eric Anholt --- diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 4338ae6db0e..c55c9106287 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2885,7 +2885,7 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c, shader = (brw_shader *) prog->_LinkedShaders[MESA_SHADER_FRAGMENT]; if (unlikely(INTEL_DEBUG & DEBUG_WM)) { - if (shader) { + if (prog) { printf("GLSL IR for native fragment shader %d:\n", prog->Name); _mesa_print_ir(shader->ir, NULL); printf("\n\n"); @@ -2900,11 +2900,13 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c, */ fs_visitor v(brw, c, prog, fp, 8); if (!v.run()) { - prog->LinkStatus = false; - ralloc_strcat(&prog->InfoLog, v.fail_msg); + if (prog) { + prog->LinkStatus = false; + ralloc_strcat(&prog->InfoLog, v.fail_msg); + } _mesa_problem(NULL, "Failed to compile fragment shader: %s\n", - v.fail_msg); + v.fail_msg); return NULL; } diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp index b6d454f4175..4f7b8c0e15a 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp @@ -1531,7 +1531,7 @@ brw_vs_emit(struct brw_context *brw, shader = (brw_shader *) prog->_LinkedShaders[MESA_SHADER_VERTEX]; if (unlikely(INTEL_DEBUG & DEBUG_VS)) { - if (shader) { + if (prog) { printf("GLSL IR for native vertex shader %d:\n", prog->Name); _mesa_print_ir(shader->ir, NULL); printf("\n\n"); @@ -1544,8 +1544,10 @@ brw_vs_emit(struct brw_context *brw, vec4_vs_visitor v(brw, c, prog_data, prog, shader, mem_ctx); if (!v.run()) { - prog->LinkStatus = false; - ralloc_strcat(&prog->InfoLog, v.fail_msg); + if (prog) { + prog->LinkStatus = false; + ralloc_strcat(&prog->InfoLog, v.fail_msg); + } return NULL; }