[Mesa-dev] [PATCH 4/6] nir: dont lower bindless samplers

Timothy Arceri tarceri at itsqueeze.com
Thu Apr 5 05:34:46 UTC 2018


We neeed to skip the var if its not a uniform here as well as checking
the bindless flag since UBOs can contain bindless samplers.
---
 src/compiler/nir/nir_lower_samplers_as_deref.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_lower_samplers_as_deref.c b/src/compiler/nir/nir_lower_samplers_as_deref.c
index b1272e25a92..2a2fb5b093f 100644
--- a/src/compiler/nir/nir_lower_samplers_as_deref.c
+++ b/src/compiler/nir/nir_lower_samplers_as_deref.c
@@ -157,7 +157,8 @@ static bool
 lower_sampler(nir_tex_instr *instr, struct lower_samplers_as_deref_state *state,
               nir_builder *b)
 {
-   if (!instr->texture)
+   if (!instr->texture || instr->texture->var->data.bindless ||
+       instr->texture->var->data.mode != nir_var_uniform)
       return false;
 
    /* In GLSL, we only fill out the texture field.  The sampler is inferred */
@@ -195,6 +196,11 @@ lower_intrinsic(nir_intrinsic_instr *instr,
        instr->intrinsic == nir_intrinsic_image_var_atomic_comp_swap ||
        instr->intrinsic == nir_intrinsic_image_var_size) {
       b->cursor = nir_before_instr(&instr->instr);
+
+      if (instr->variables[0]->var->data.bindless ||
+          instr->variables[0]->var->data.mode != nir_var_uniform)
+         return false;
+
       lower_deref(instr->variables[0], state, b);
       return true;
    }
-- 
2.14.3



More information about the mesa-dev mailing list