summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Piñeiro <[email protected]>2017-12-21 16:20:18 +0100
committerAlejandro Piñeiro <[email protected]>2018-06-21 14:25:05 +0200
commit8d1ec2ed5a24ed6b29fbffd8fc316e9b5579ea49 (patch)
treeefa5ead7a9aee8c44e52621cc219c99ed0b9dfd9
parenta6dc3d22ebea709f353dda869e0ca474cda72559 (diff)
mesa/main: add NULL name check when searching for a resource name
Since ARB_gl_spirv name reflection can be missing. piglit shader_runner does several resource checking, so this commit is useful to get even the more simple piglit tests running without crashing on SPIR-V mode. Reviewed-by: Timothy Arceri <[email protected]>
-rw-r--r--src/mesa/main/shader_query.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 86064a98b97..11ecd71c575 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -533,6 +533,11 @@ _mesa_program_resource_find_name(struct gl_shader_program *shProg,
/* Resource basename. */
const char *rname = _mesa_program_resource_name(res);
+
+ /* Since ARB_gl_spirv lack of name reflections is a possibility */
+ if (rname == NULL)
+ continue;
+
unsigned baselen = strlen(rname);
unsigned baselen_without_array_index = baselen;
const char *rname_last_square_bracket = strrchr(rname, '[');