summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2020-01-13 11:34:53 -0800
committerDaniel Stone <[email protected]>2020-01-13 23:19:49 +0000
commit4cda61f11e922fb5914ae73d22cc0c495abf0377 (patch)
tree7df01cb057499de011d15734c0c4d2205cfd0666
parentd72f17875334bd9c720ab21fd187328bca00e7dd (diff)
nir: assert that nir_lower_tex runs after lowering derefs
It isn't going to do the right thing, because texture_index/ sampler_index defaults to zero. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3368>
-rw-r--r--src/compiler/nir/nir_lower_tex.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
index 6c8c6aa1164..191076f8c27 100644
--- a/src/compiler/nir/nir_lower_tex.c
+++ b/src/compiler/nir/nir_lower_tex.c
@@ -934,6 +934,12 @@ nir_lower_tex_block(nir_block *block, nir_builder *b,
nir_tex_instr *tex = nir_instr_as_tex(instr);
bool lower_txp = !!(options->lower_txp & (1 << tex->sampler_dim));
+ /* we aren't really going to do the right thing if we haven't
+ * lowered tex/samp derefs yet:
+ */
+ assume(nir_tex_instr_src_index(tex, nir_tex_src_texture_deref) < 0);
+ assume(nir_tex_instr_src_index(tex, nir_tex_src_sampler_deref) < 0);
+
/* mask of src coords to saturate (clamp): */
unsigned sat_mask = 0;