mesa/program: fix shadow property for samplers
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 20 Jul 2020 16:06:47 +0000 (18:06 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 22 Jul 2020 12:51:51 +0000 (12:51 +0000)
When creating a sampler-type, we need to pass the correct vaclue for
the "is_shadow"-parameter to glsl_sampler_type(), otherwise the compiler
backend will have no clue about this being a shadow-sampler.

Fixes: 1c0f92d8a8c ("nir: Create sampler variables in prog_to_nir.")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5986>

src/mesa/program/prog_to_nir.c

index 14dc89183a092d72e04a05a7cac22a67699c27d0..fcdeec1047d269ac79faa5794dc0f93410c50914 100644 (file)
@@ -540,7 +540,7 @@ ptn_tex(struct ptn_compile *c, nir_alu_dest dest, nir_ssa_def **src,
    nir_variable *var = c->sampler_vars[prog_inst->TexSrcUnit];
    if (!var) {
       const struct glsl_type *type =
    nir_variable *var = c->sampler_vars[prog_inst->TexSrcUnit];
    if (!var) {
       const struct glsl_type *type =
-         glsl_sampler_type(instr->sampler_dim, false, false, GLSL_TYPE_FLOAT);
+         glsl_sampler_type(instr->sampler_dim, instr->is_shadow, false, GLSL_TYPE_FLOAT);
       char samplerName[20];
       snprintf(samplerName, sizeof(samplerName), "sampler_%d", prog_inst->TexSrcUnit);
       var = nir_variable_create(b->shader, nir_var_uniform, type, samplerName);
       char samplerName[20];
       snprintf(samplerName, sizeof(samplerName), "sampler_%d", prog_inst->TexSrcUnit);
       var = nir_variable_create(b->shader, nir_var_uniform, type, samplerName);