Mesa (staging/20.1): gallium/tgsi_exec: Fix up NumOutputs counting

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Sep 2 21:01:57 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: 67987d68d2ae796a250082de7d3b869c623b2b8e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=67987d68d2ae796a250082de7d3b869c623b2b8e

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Aug 25 16:01:47 2020 -0700

gallium/tgsi_exec: Fix up NumOutputs counting

We can get duplicate declarations for an index (for example dvec3 + float
packed into 2 vec4s, the second one won't pack into the first's array
decl), and we'd end up stepping by the wrong amount in GS vtx/prim emit.

Fixes vs-gs-fs-double, sso-vs-gs-fs-array-interleave piglit tests.

Fixes: 49155c3264d0 ("draw/tgsi: fix geometry shader input/output swizzling")
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6567>
(cherry picked from commit 329dee14555b8c8da59e6b47a51050f2aa736596)

---

 .pick_status.json                      |  2 +-
 src/gallium/auxiliary/tgsi/tgsi_exec.c | 10 ++--------
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index bce769c2dd8..17bfdfc9068 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -247,7 +247,7 @@
         "description": "gallium/tgsi_exec: Fix up NumOutputs counting",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "49155c3264d019869fadde50ff6167a369e966b6"
     },
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index e0ff9476cb2..1586bc31fc9 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -1181,14 +1181,8 @@ tgsi_exec_machine_bind_shader(
                                    * sizeof(struct tgsi_full_declaration));
             maxDeclarations += 10;
          }
-         if (parse.FullToken.FullDeclaration.Declaration.File == TGSI_FILE_OUTPUT) {
-            unsigned reg;
-            for (reg = parse.FullToken.FullDeclaration.Range.First;
-                 reg <= parse.FullToken.FullDeclaration.Range.Last;
-                 ++reg) {
-               ++mach->NumOutputs;
-            }
-         }
+         if (parse.FullToken.FullDeclaration.Declaration.File == TGSI_FILE_OUTPUT)
+            mach->NumOutputs = MAX2(mach->NumOutputs, parse.FullToken.FullDeclaration.Range.Last + 1);
          else if (parse.FullToken.FullDeclaration.Declaration.File == TGSI_FILE_SYSTEM_VALUE) {
             const struct tgsi_full_declaration *decl = &parse.FullToken.FullDeclaration;
             mach->SysSemanticToIndex[decl->Semantic.Name] = decl->Range.First;



More information about the mesa-commit mailing list