From cc472a2a7c6c99eb228ef138acadc16337a48ede Mon Sep 17 00:00:00 2001 From: Duncan Hopkins Date: Wed, 25 Sep 2019 11:52:37 +0100 Subject: [PATCH] zink. Changed sampler default name. Changed the sampler variable name from 'sampler' to 'sampler_' to stop symbol classes in the Metal MSL shaders, as 'sampler' is a keyword. Improves human readability when debugging issues. Reviewed-by: Erik Faye-Lund Part-of: --- src/mesa/program/prog_to_nir.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c index 31ad0cb58c5..14dc89183a0 100644 --- a/src/mesa/program/prog_to_nir.c +++ b/src/mesa/program/prog_to_nir.c @@ -541,7 +541,9 @@ ptn_tex(struct ptn_compile *c, nir_alu_dest dest, nir_ssa_def **src, if (!var) { const struct glsl_type *type = glsl_sampler_type(instr->sampler_dim, false, false, GLSL_TYPE_FLOAT); - var = nir_variable_create(b->shader, nir_var_uniform, type, "sampler"); + char samplerName[20]; + snprintf(samplerName, sizeof(samplerName), "sampler_%d", prog_inst->TexSrcUnit); + var = nir_variable_create(b->shader, nir_var_uniform, type, samplerName); var->data.binding = prog_inst->TexSrcUnit; var->data.explicit_binding = true; c->sampler_vars[prog_inst->TexSrcUnit] = var; -- 2.30.2