summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2017-06-23 19:10:27 +0200
committerNicolai Hähnle <nicolai.haehnle@amd.com>2017-07-13 13:27:42 +0200
commit9c87aa47f36a6f714fca52af6045e3b4d54d6690 (patch)
treec2fdc1641be03bf8c3225b326def78c9187141ff
parentf8d31a08ff08f3181bcebd85661e1f555c3a0515 (diff)
st/nir: guard against NULL variable names (TODO: not necessary?)
They can occur with SPIR-V (but should really have been replaced with empty names...)
-rw-r--r--src/mesa/state_tracker/st_glsl_to_nir.cpp2
-rw-r--r--src/mesa/state_tracker/st_nir_lower_builtin.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 7f5a9afda8..5d05dbf0cc 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -198,7 +198,7 @@ st_nir_assign_uniform_locations(struct gl_program *prog,
* shader_program->UniformStorage[location]:
*/
uniform->data.location = val;
- } else if (strncmp(uniform->name, "gl_", 3) == 0) {
+ } else if (uniform->name && strncmp(uniform->name, "gl_", 3) == 0) {
const gl_state_index *const stateTokens = (gl_state_index *)uniform->state_slots[0].tokens;
/* This state reference has already been setup by ir_to_mesa, but we'll
* get the same index back here.
diff --git a/src/mesa/state_tracker/st_nir_lower_builtin.c b/src/mesa/state_tracker/st_nir_lower_builtin.c
index 19a8ac0313..30dafbfd64 100644
--- a/src/mesa/state_tracker/st_nir_lower_builtin.c
+++ b/src/mesa/state_tracker/st_nir_lower_builtin.c
@@ -168,7 +168,7 @@ lower_builtin_block(lower_builtin_state *state, nir_block *block)
continue;
/* built-in's will always start with "gl_" */
- if (strncmp(var->name, "gl_", 3) != 0)
+ if (!var->name || strncmp(var->name, "gl_", 3) != 0)
continue;
const struct gl_builtin_uniform_desc *desc =