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;