summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Arceri <tarceri@itsqueeze.com>2018-03-22 14:28:22 +1100
committerTimothy Arceri <tarceri@itsqueeze.com>2018-04-10 14:43:45 +1000
commit74b3fc2ce0f854bbe4b1d5e052e59b61a49f62ba (patch)
tree26e1f80f32607f2b3583731df1ee61c0e566ef52
parentbd4cc54c8bcad0836b92cf60c4d221e5dda38e9b (diff)
nir: dont lower bindless samplers
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>
-rw-r--r--src/compiler/nir/nir_lower_samplers_as_deref.c8
1 files changed, 7 insertions, 1 deletions
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;
}