zink. Changed sampler default name.

Changed the sampler variable name from 'sampler' to 'sampler_<num>' 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 <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4211>
This commit is contained in:
Duncan Hopkins
2019-09-25 11:52:37 +01:00
committed by Marge Bot
parent b1f0233077
commit cc472a2a7c

View File

@@ -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;