Mesa (master): zink. Changed sampler default name.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu May 14 12:51:31 UTC 2020


Module: Mesa
Branch: master
Commit: cc472a2a7c6c99eb228ef138acadc16337a48ede
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cc472a2a7c6c99eb228ef138acadc16337a48ede

Author: Duncan Hopkins <duncan at thefoundry.co.uk>
Date:   Wed Sep 25 11:52:37 2019 +0100

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 at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4211>

---

 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;



More information about the mesa-commit mailing list