summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/gl_nir_lower_samplers_as_deref.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c b/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c
index 96c751a1284..719968a6671 100644
--- a/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c
+++ b/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c
@@ -196,28 +196,30 @@ lower_sampler(nir_tex_instr *instr, struct lower_samplers_as_deref_state *state,
int sampler_idx =
nir_tex_instr_src_index(instr, nir_tex_src_sampler_deref);
- if (texture_idx < 0)
- return false;
+ b->cursor = nir_before_instr(&instr->instr);
- assert(texture_idx >= 0 && sampler_idx >= 0);
- assert(instr->src[texture_idx].src.is_ssa);
- assert(instr->src[sampler_idx].src.is_ssa);
- assert(instr->src[texture_idx].src.ssa == instr->src[sampler_idx].src.ssa);
+ if (texture_idx >= 0) {
+ assert(instr->src[texture_idx].src.is_ssa);
- b->cursor = nir_before_instr(&instr->instr);
+ nir_deref_instr *texture_deref =
+ lower_deref(b, state, nir_src_as_deref(instr->src[texture_idx].src));
+ /* only lower non-bindless: */
+ if (texture_deref) {
+ nir_instr_rewrite_src(&instr->instr, &instr->src[texture_idx].src,
+ nir_src_for_ssa(&texture_deref->dest.ssa));
+ }
+ }
- nir_deref_instr *texture_deref =
- lower_deref(b, state, nir_src_as_deref(instr->src[texture_idx].src));
- /* don't lower bindless: */
- if (!texture_deref)
- return false;
- nir_instr_rewrite_src(&instr->instr, &instr->src[texture_idx].src,
- nir_src_for_ssa(&texture_deref->dest.ssa));
-
- nir_deref_instr *sampler_deref =
- lower_deref(b, state, nir_src_as_deref(instr->src[sampler_idx].src));
- nir_instr_rewrite_src(&instr->instr, &instr->src[sampler_idx].src,
- nir_src_for_ssa(&sampler_deref->dest.ssa));
+ if (sampler_idx >= 0) {
+ assert(instr->src[sampler_idx].src.is_ssa);
+ nir_deref_instr *sampler_deref =
+ lower_deref(b, state, nir_src_as_deref(instr->src[sampler_idx].src));
+ /* only lower non-bindless: */
+ if (sampler_deref) {
+ nir_instr_rewrite_src(&instr->instr, &instr->src[sampler_idx].src,
+ nir_src_for_ssa(&sampler_deref->dest.ssa));
+ }
+ }
return true;
}