[Mesa-dev] [PATCH] nir: disable opt_for_known_values() for non scalar constants

Timothy Arceri tarceri at itsqueeze.com
Wed Apr 3 00:27:50 UTC 2019


We don't handle swizzles and non-scalar backends don't split these
constants so we need to skip these too.

Fixes: 4218b6422cf1 ("nir: propagate known constant values into the if-then branch")

https://bugs.freedesktop.org/show_bug.cgi?id=110311
---
 src/compiler/nir/nir_opt_if.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_opt_if.c b/src/compiler/nir/nir_opt_if.c
index af63b90f249..d8fa6b04b39 100644
--- a/src/compiler/nir/nir_opt_if.c
+++ b/src/compiler/nir/nir_opt_if.c
@@ -1361,7 +1361,8 @@ opt_for_known_values(nir_builder *b, nir_if *nif)
         return false;
 
       /* TODO: remove this and support swizzles? */
-      if (unknown_val->num_components != 1)
+      if (unknown_val->num_components != 1 ||
+          load_const->def.num_components != 1)
         return false;
 
       /* Replace unknown ssa uses with the known constant */
-- 
2.20.1



More information about the mesa-dev mailing list