summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarol Herbst <[email protected]>2019-03-24 05:36:36 +0100
committerKarol Herbst <[email protected]>2019-03-29 16:03:22 +0100
commitfea0caea2b2344c6c8d8110a8b31b1de17464483 (patch)
tree647d4e09254f6a37e10a15be46d55e7f50af0598
parent6ffc72472cc15368f95b18c1362298dd651bc7f1 (diff)
nir/validate: validate that tex deref sources are actually derefs
Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r--src/compiler/nir/nir_validate.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c
index ef2e2b62783..80f397098a2 100644
--- a/src/compiler/nir/nir_validate.c
+++ b/src/compiler/nir/nir_validate.c
@@ -596,6 +596,17 @@ validate_tex_instr(nir_tex_instr *instr, validate_state *state)
src_type_seen[instr->src[i].src_type] = true;
validate_src(&instr->src[i].src, state,
0, nir_tex_instr_src_size(instr, i));
+
+ switch (instr->src[i].src_type) {
+ case nir_tex_src_texture_deref:
+ case nir_tex_src_sampler_deref:
+ validate_assert(state, instr->src[i].src.is_ssa);
+ validate_assert(state,
+ instr->src[i].src.ssa->parent_instr->type == nir_instr_type_deref);
+ break;
+ default:
+ break;
+ }
}
if (nir_tex_instr_has_explicit_tg4_offsets(instr)) {