summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2023-02-06 12:41:49 -0800
committerMarge Bot <emma+marge@anholt.net>2023-02-10 03:18:23 +0000
commitedb89b71c50fdfe8894c0767332e46bb455ef95c (patch)
tree87f7dd773f68b048ca5b23ad399d83a02e8a581f
parent0c0fb216dd6d9d194593178eb0493d31b4b977af (diff)
downloadmesa-edb89b71c50fdfe8894c0767332e46bb455ef95c.tar.gz
nir/inline_uniforms: Allow possibility of uni_offsets and num_offsets being NULL
This is step 3 in an attempt to unify a bunch of nir_inline_uniforms.c and lvp_inline_uniforms.c code. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21179>
-rw-r--r--src/compiler/nir/nir_inline_uniforms.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_inline_uniforms.c b/src/compiler/nir/nir_inline_uniforms.c
index 4adc9f10925..4c429d2b53a 100644
--- a/src/compiler/nir/nir_inline_uniforms.c
+++ b/src/compiler/nir/nir_inline_uniforms.c
@@ -113,6 +113,15 @@ src_only_uses_uniforms(const nir_src *src, int component,
nir_src_as_uint(intr->src[1]) <= max_offset &&
/* TODO: Can't handle other bit sizes for now. */
intr->dest.ssa.bit_size == 32) {
+ /* num_offsets can be NULL if-and-only-if uni_offsets is NULL. */
+ assert((num_offsets == NULL) == (uni_offsets == NULL));
+
+ /* If we're just checking that it's a uniform load, don't check (or
+ * add to) the table.
+ */
+ if (uni_offsets == NULL)
+ return true;
+
uint32_t offset = nir_src_as_uint(intr->src[1]) + component * 4;
assert(offset < MAX_OFFSET);