summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2013-04-11 09:55:42 -0700
committerMatt Turner <[email protected]>2013-04-11 17:21:13 -0700
commit32a8e877666f7c3798d736bb6f05ad2f41356ebf (patch)
tree56c82ea977d636409570ca8c9f2ee24b58c1b86a /src
parented9687cf1bf264784b5e67b06610e0743c0e4de9 (diff)
i965: NULL check prog on shader compilation failure.
Also change if (shader) to if (prog) for consistency. Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp10
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.cpp8
2 files changed, 11 insertions, 7 deletions
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;
}