Re: [Mesa-dev] [PATCH 20/22] i965: account for NIR uniforms without name
Reviewed-by: Timothy ArceriOn 18/04/18 00:36, Alejandro Piñeiro wrote: From: Eduardo Lima Mitev Right now, the BRW linker code assumes nir_variable::name is always non-NULL, but thanks to ARB_gl_spirv we will soon be linking SPIR-V programs, and those explicitly require matching uniforms by location. The name is just a debug hint. v2: simplified, most of it moved to glsl/nir/spirv (Neil Roberts) Signed-off-by: Eduardo Lima Signed-off-by: Neil Roberts --- src/mesa/drivers/dri/i965/brw_link.cpp | 2 +- src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp index 7d89ccd7d14..5bd9783aa01 100644 --- a/src/mesa/drivers/dri/i965/brw_link.cpp +++ b/src/mesa/drivers/dri/i965/brw_link.cpp @@ -320,7 +320,7 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg) * get sent to the shader. */ nir_foreach_variable(var, >nir->uniforms) { - if (strncmp(var->name, "gl_", 3) == 0) { + if (var->name && strncmp(var->name, "gl_", 3) == 0) { const nir_state_slot *const slots = var->state_slots; assert(var->state_slots != NULL); diff --git a/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp b/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp index 69da83ad364..62b2951432a 100644 --- a/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp +++ b/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp @@ -202,7 +202,7 @@ brw_nir_setup_glsl_uniforms(void *mem_ctx, nir_shader *shader, if (var->interface_type != NULL || var->type->contains_atomic()) continue; - if (strncmp(var->name, "gl_", 3) == 0) { + if (var->name && strncmp(var->name, "gl_", 3) == 0) { brw_nir_setup_glsl_builtin_uniform(var, prog, stage_prog_data, is_scalar); } else { ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 20/22] i965: account for NIR uniforms without name
From: Eduardo Lima MitevRight now, the BRW linker code assumes nir_variable::name is always non-NULL, but thanks to ARB_gl_spirv we will soon be linking SPIR-V programs, and those explicitly require matching uniforms by location. The name is just a debug hint. v2: simplified, most of it moved to glsl/nir/spirv (Neil Roberts) Signed-off-by: Eduardo Lima Signed-off-by: Neil Roberts --- src/mesa/drivers/dri/i965/brw_link.cpp | 2 +- src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp index 7d89ccd7d14..5bd9783aa01 100644 --- a/src/mesa/drivers/dri/i965/brw_link.cpp +++ b/src/mesa/drivers/dri/i965/brw_link.cpp @@ -320,7 +320,7 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg) * get sent to the shader. */ nir_foreach_variable(var, >nir->uniforms) { - if (strncmp(var->name, "gl_", 3) == 0) { + if (var->name && strncmp(var->name, "gl_", 3) == 0) { const nir_state_slot *const slots = var->state_slots; assert(var->state_slots != NULL); diff --git a/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp b/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp index 69da83ad364..62b2951432a 100644 --- a/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp +++ b/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp @@ -202,7 +202,7 @@ brw_nir_setup_glsl_uniforms(void *mem_ctx, nir_shader *shader, if (var->interface_type != NULL || var->type->contains_atomic()) continue; - if (strncmp(var->name, "gl_", 3) == 0) { + if (var->name && strncmp(var->name, "gl_", 3) == 0) { brw_nir_setup_glsl_builtin_uniform(var, prog, stage_prog_data, is_scalar); } else { -- 2.14.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev