[Mesa-dev] [PATCH 20/22] i965: account for NIR uniforms without name

Timothy Arceri tarceri at itsqueeze.com
Thu May 3 03:02:01 UTC 2018


Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>

On 18/04/18 00:36, Alejandro PiƱeiro wrote:
> From: Eduardo Lima Mitev <elima at igalia.com>
> 
> 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 <elima at igalia.com>
> Signed-off-by: Neil Roberts <nroberts at igalia.com>
> ---
>   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, &prog->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 {
> 


More information about the mesa-dev mailing list