[Mesa-dev] [PATCH v2 26/28] mesa: add NULL name check for NUM_ACTIVE_VARIABLES query
Alejandro PiƱeiro
apinheiro at igalia.com
Thu Sep 27 09:52:05 UTC 2018
This can happens if we are running an SPIR-V shader (ARB_gl_spirv).
---
src/mesa/main/shader_query.cpp | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 11ecd71c575..b775b4231c2 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -1013,11 +1013,16 @@ get_buffer_property(struct gl_shader_program *shProg,
*val = 0;
for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
const char *iname = RESOURCE_UBO(res)->Uniforms[i].IndexName;
- struct gl_program_resource *uni =
- _mesa_program_resource_find_name(shProg, GL_UNIFORM, iname,
- NULL);
- if (!uni)
- continue;
+ /* IndexName can be NULL if we are using a SPIR-V shader
+ * (ARB_gl_spirv).
+ */
+ if (iname != NULL) {
+ struct gl_program_resource *uni =
+ _mesa_program_resource_find_name(shProg, GL_UNIFORM, iname,
+ NULL);
+ if (!uni)
+ continue;
+ }
(*val)++;
}
return 1;
@@ -1049,11 +1054,16 @@ get_buffer_property(struct gl_shader_program *shProg,
*val = 0;
for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
const char *iname = RESOURCE_UBO(res)->Uniforms[i].IndexName;
- struct gl_program_resource *uni =
- _mesa_program_resource_find_name(shProg, GL_BUFFER_VARIABLE,
- iname, NULL);
- if (!uni)
- continue;
+ /* IndexName can be NULL if we are using a SPIR-V shader
+ * (ARB_gl_spirv).
+ */
+ if (iname != NULL) {
+ struct gl_program_resource *uni =
+ _mesa_program_resource_find_name(shProg, GL_BUFFER_VARIABLE,
+ iname, NULL);
+ if (!uni)
+ continue;
+ }
(*val)++;
}
return 1;
--
2.14.1
More information about the mesa-dev
mailing list