nir: dont lower bindless samplers
authorTimothy Arceri <tarceri@itsqueeze.com>
Thu, 22 Mar 2018 03:28:22 +0000 (14:28 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Tue, 10 Apr 2018 04:43:45 +0000 (14:43 +1000)
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.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/compiler/nir/nir_lower_samplers_as_deref.c

index b1272e25a929b6f5b8dcca360206c24ea1c45fa4..2a2fb5b093ffa35b9dced8dfba9891077f324ddb 100644 (file)
@@ -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;
    }