Mesa (master): nir/lower_io: don't reduce range if parent length is zero
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Sep 16 21:48:43 UTC 2020
Module: Mesa
Branch: master
Commit: 2aaa1564ad0620724eaf38d66cec85dafad4613e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2aaa1564ad0620724eaf38d66cec85dafad4613e
Author: Alejandro Piñeiro <apinheiro at igalia.com>
Date: Tue Sep 15 23:53:14 2020 +0200
nir/lower_io: don't reduce range if parent length is zero
When handling arrays, range is increased based on the array size minus
one. But if such is zero, it has the effect of reducing the
range. Handle that case by returning the unknown range value.
v2:
* Add missing braces.
* Return unknown range in this case, instead of keeping the initial
range.
v3: Simplify code, using existing "fail" label. (Jason)
Fixes the following using v3dv:
dEQP-VK.graphicsfuzz.cov-simplify-clamp-max-itself
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6737>
---
src/compiler/nir/nir_lower_io.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c
index 52c22add24e..986c4c0d62f 100644
--- a/src/compiler/nir/nir_lower_io.c
+++ b/src/compiler/nir/nir_lower_io.c
@@ -982,10 +982,13 @@ nir_get_explicit_deref_range(nir_deref_instr *deref,
goto fail;
if (deref->deref_type != nir_deref_type_array_wildcard &&
- nir_src_is_const(deref->arr.index))
+ nir_src_is_const(deref->arr.index)) {
base += stride * nir_src_as_uint(deref->arr.index);
- else
+ } else {
+ if (glsl_get_length(parent->type) == 0)
+ goto fail;
range += stride * (glsl_get_length(parent->type) - 1);
+ }
break;
}
More information about the mesa-commit
mailing list