Mesa (main): lima: fix vector const src referenced multiple times

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 12 20:26:12 UTC 2022


Module: Mesa
Branch: main
Commit: cf1390e1b87a8029ad7efc710cceab661411413d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cf1390e1b87a8029ad7efc710cceab661411413d

Author: Erico Nunes <nunes.erico at gmail.com>
Date:   Sun Apr  3 18:28:19 2022 +0200

lima: fix vector const src referenced multiple times

It can happen that a single vector constant is referenced multiple times
by the same node, with different swizzles.
This needs to be taken into account by checking and updating the
swizzles for all the srcs of a target node when inserting the const
node to the same instruction.

Signed-off-by: Erico Nunes <nunes.erico at gmail.com>
Reviewed-by: Vasily Khoruzhick <anarsoul at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15726>

---

 src/gallium/drivers/lima/ci/lima-fails.txt |  4 ----
 src/gallium/drivers/lima/ir/pp/instr.c     | 18 ++++++++----------
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/lima/ci/lima-fails.txt b/src/gallium/drivers/lima/ci/lima-fails.txt
index 2dc2dc311df..8d9fe6483be 100644
--- a/src/gallium/drivers/lima/ci/lima-fails.txt
+++ b/src/gallium/drivers/lima/ci/lima-fails.txt
@@ -391,7 +391,6 @@ spec at glsl-1.10@execution at variable-indexing@fs-temp-array-mat2-index-col-row-wr,F
 spec at glsl-1.10@execution at variable-indexing@fs-temp-array-mat2-index-col-wr,Fail
 spec at glsl-1.10@execution at variable-indexing@fs-temp-array-mat2-index-row-wr,Fail
 spec at glsl-1.10@execution at variable-indexing@fs-temp-array-mat2-index-wr,Fail
-spec at glsl-1.10@execution at variable-indexing@fs-temp-array-mat2-row-rd,Fail
 spec at glsl-1.10@execution at variable-indexing@fs-temp-array-mat2-row-wr,Fail
 spec at glsl-1.10@execution at variable-indexing@fs-temp-array-mat2-wr,Fail
 spec at glsl-1.10@execution at variable-indexing@fs-temp-array-mat3-col-row-wr,Fail
@@ -412,7 +411,6 @@ spec at glsl-1.10@execution at variable-indexing@fs-temp-array-mat4-row-wr,Fail
 spec at glsl-1.10@execution at variable-indexing@fs-temp-array-mat4-wr,Fail
 spec at glsl-1.10@execution at variable-indexing@fs-temp-mat2-col-row-wr,Fail
 spec at glsl-1.10@execution at variable-indexing@fs-temp-mat2-col-wr,Fail
-spec at glsl-1.10@execution at variable-indexing@fs-temp-mat2-row-rd,Fail
 spec at glsl-1.10@execution at variable-indexing@fs-temp-mat2-row-wr,Fail
 spec at glsl-1.10@execution at variable-indexing@fs-temp-mat2-wr,Fail
 spec at glsl-1.10@execution at variable-indexing@fs-temp-mat3-col-row-wr,Fail
@@ -482,7 +480,6 @@ spec at glsl-1.20@execution at variable-indexing@fs-temp-array-mat2-index-col-row-wr,F
 spec at glsl-1.20@execution at variable-indexing@fs-temp-array-mat2-index-col-wr,Fail
 spec at glsl-1.20@execution at variable-indexing@fs-temp-array-mat2-index-row-wr,Fail
 spec at glsl-1.20@execution at variable-indexing@fs-temp-array-mat2-index-wr,Fail
-spec at glsl-1.20@execution at variable-indexing@fs-temp-array-mat2-row-rd,Fail
 spec at glsl-1.20@execution at variable-indexing@fs-temp-array-mat2-row-wr,Fail
 spec at glsl-1.20@execution at variable-indexing@fs-temp-array-mat2-wr,Fail
 spec at glsl-1.20@execution at variable-indexing@fs-temp-array-mat3-col-row-wr,Fail
@@ -503,7 +500,6 @@ spec at glsl-1.20@execution at variable-indexing@fs-temp-array-mat4-row-wr,Fail
 spec at glsl-1.20@execution at variable-indexing@fs-temp-array-mat4-wr,Fail
 spec at glsl-1.20@execution at variable-indexing@fs-temp-mat2-col-row-wr,Fail
 spec at glsl-1.20@execution at variable-indexing@fs-temp-mat2-col-wr,Fail
-spec at glsl-1.20@execution at variable-indexing@fs-temp-mat2-row-rd,Fail
 spec at glsl-1.20@execution at variable-indexing@fs-temp-mat2-row-wr,Fail
 spec at glsl-1.20@execution at variable-indexing@fs-temp-mat2-wr,Fail
 spec at glsl-1.20@execution at variable-indexing@fs-temp-mat3-col-row-wr,Fail
diff --git a/src/gallium/drivers/lima/ir/pp/instr.c b/src/gallium/drivers/lima/ir/pp/instr.c
index 19d53cd2ad0..707055c48ac 100644
--- a/src/gallium/drivers/lima/ir/pp/instr.c
+++ b/src/gallium/drivers/lima/ir/pp/instr.c
@@ -186,19 +186,17 @@ bool ppir_instr_insert_node(ppir_instr *instr, ppir_node *node)
          uint8_t swizzle[4] = {0};
 
          if (ppir_instr_insert_const(&ic, nc, swizzle)) {
+            instr->constant[i] = ic;
             ppir_node *succ = ppir_node_first_succ(node);
-            ppir_src *src = NULL;
             for (int s = 0; s < ppir_node_get_src_num(succ); s++) {
-               src = ppir_node_get_src(succ, s);
-               if (src->node == node)
-                  break;
-            }
-            assert(src);
-            assert(src->node == node);
+               ppir_src *src = ppir_node_get_src(succ, s);
+               assert(src);
+               if (src->node != node)
+                  continue;
 
-            instr->constant[i] = ic;
-            ppir_update_src_pipeline(ppir_pipeline_reg_const0 + i, src,
-                                     &c->dest, swizzle);
+               ppir_update_src_pipeline(ppir_pipeline_reg_const0 + i, src,
+                                        &c->dest, swizzle);
+            }
             break;
          }
       }



More information about the mesa-commit mailing list