OSDN Git Service

nir/validate: validate that tex deref sources are actually derefs
authorKarol Herbst <kherbst@redhat.com>
Sun, 24 Mar 2019 04:36:36 +0000 (05:36 +0100)
committerKarol Herbst <kherbst@redhat.com>
Fri, 29 Mar 2019 15:03:22 +0000 (16:03 +0100)
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_validate.c

index ef2e2b6..80f3970 100644 (file)
@@ -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)) {