aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-07-16 12:41:28 -0700
committerEric Anholt <[email protected]>2018-07-16 14:39:59 -0700
commit26f830d9fc5fb52a1e70839813b4c6ddbcb3a876 (patch)
treebdf5004d2eebfedd0bf1b6657aea02bd96c2b97c
parentd661d78464aec0af7d6976512eca155623cbecc2 (diff)
v3d: Add an assert that we don't provide an invalid texture return words.
The docs had an update noting this restriction, so reflect it in the code.
-rw-r--r--src/broadcom/compiler/v3d40_tex.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/broadcom/compiler/v3d40_tex.c b/src/broadcom/compiler/v3d40_tex.c
index 2fd8c3b5a6e..00e52998e95 100644
--- a/src/broadcom/compiler/v3d40_tex.c
+++ b/src/broadcom/compiler/v3d40_tex.c
@@ -153,6 +153,14 @@ v3d40_vir_emit_tex(struct v3d_compile *c, nir_tex_instr *instr)
(1 << MIN2(instr_return_channels,
c->key->tex[unit].return_channels)) - 1;
+ /* Word enables can't ask for more channels than the output type could
+ * provide (2 for f16, 4 for 32-bit).
+ */
+ assert(!p1_unpacked.output_type_32_bit ||
+ p0_unpacked.return_words_of_texture_data < (1 << 4));
+ assert(p1_unpacked.output_type_32_bit ||
+ p0_unpacked.return_words_of_texture_data < (1 << 2));
+
uint32_t p0_packed;
V3D41_TMU_CONFIG_PARAMETER_0_pack(NULL,
(uint8_t *)&p0_packed,