aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2020-04-08 15:11:57 -0500
committerMarge Bot <[email protected]>2020-04-16 17:00:13 +0000
commit9b17d7caac76e1c2dd4579c198b2e32b762bb656 (patch)
treecdde126cc46351307db5f1c76df6c2c3441b1341 /src
parent33eb43349e8c3e8216f51ec838d9b9ab23361873 (diff)
nir: Add some sanity assertions in opt_large_constants
We make some assumptions in opt_large_constants such as the size_align function returning the obvious sizes for vectors. Now that we've got the deref_size lying around, we may as well assert it's consistent with our assumptions. In particular, we now assert that it really claims booleans are 32-bit. If anyone's driver ever decides to be clever and change this, we'll now catch the breakage earlier. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4468>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir_opt_large_constants.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_large_constants.c b/src/compiler/nir/nir_opt_large_constants.c
index 7e293ba2c5e..7ed26f51127 100644
--- a/src/compiler/nir/nir_opt_large_constants.c
+++ b/src/compiler/nir/nir_opt_large_constants.c
@@ -92,9 +92,11 @@ build_constant_load(nir_builder *b, nir_deref_instr *deref,
if (load->dest.ssa.bit_size < 8) {
/* Booleans are special-cased to be 32-bit */
assert(glsl_type_is_boolean(deref->type));
+ assert(deref_size == num_components * 4);
load->dest.ssa.bit_size = 32;
return nir_b2b1(b, &load->dest.ssa);
} else {
+ assert(deref_size == num_components * bit_size / 8);
return &load->dest.ssa;
}
}