Mesa (main): gallium/ureg: Sort the output decls.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 22 21:44:37 UTC 2021


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

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Mar 12 13:53:33 2021 -0800

gallium/ureg: Sort the output decls.

glsl_to_tgsi had been emitting outputs in sorted order, and it seems virgl
has a dependency on that -- it collects outputs into an array and indexes
by the subtracting the ".First" value of the first one seen, even if
that's not the first entry in the array.

Fixes the regressions in deqp-gles2 on virgl with ST_DEBUG=force_nir, and
fixes neverball trace rendering.

Reviewed-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11934>

---

 src/gallium/auxiliary/tgsi/tgsi_ureg.c        | 14 +++++++++++++-
 src/gallium/drivers/virgl/ci/traces-virgl.yml |  3 +--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 950a448f959..0bf10fd039f 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -135,7 +135,7 @@ struct ureg_program
    } system_value[UREG_MAX_SYSTEM_VALUE];
    unsigned nr_system_values;
 
-   struct {
+   struct ureg_output_decl {
       enum tgsi_semantic semantic_name;
       unsigned semantic_index;
       unsigned streams;
@@ -1819,6 +1819,13 @@ emit_property(struct ureg_program *ureg,
    out[1].prop_data.Data = data;
 }
 
+static int
+output_sort(const void *in_a, const void *in_b)
+{
+   const struct ureg_output_decl *a = in_a, *b = in_b;
+
+   return a->first - b->first;
+}
 
 static void emit_decls( struct ureg_program *ureg )
 {
@@ -1908,6 +1915,11 @@ static void emit_decls( struct ureg_program *ureg )
                          TGSI_WRITEMASK_XYZW, 0, FALSE);
    }
 
+   /* While not required by TGSI spec, virglrenderer has a dependency on the
+    * outputs being sorted.
+    */
+   qsort(ureg->output, ureg->nr_outputs, sizeof(ureg->output[0]), output_sort);
+
    if (ureg->supports_any_inout_decl_range) {
       for (i = 0; i < ureg->nr_outputs; i++) {
          emit_decl_semantic(ureg,
diff --git a/src/gallium/drivers/virgl/ci/traces-virgl.yml b/src/gallium/drivers/virgl/ci/traces-virgl.yml
index f85f046efba..0b5029d3979 100644
--- a/src/gallium/drivers/virgl/ci/traces-virgl.yml
+++ b/src/gallium/drivers/virgl/ci/traces-virgl.yml
@@ -215,11 +215,10 @@ traces:
 #    expectations:
 #      - device: gl-virgl
 #        checksum: 9571117bf4eab6fe29b12f6c3d42d865
-# The neverball foreground is actually missing
   - path: neverball/neverball.trace
     expectations:
       - device: gl-virgl
-        checksum: aa91b3f52d233ecded7d5979351b6859
+        checksum: 6936cde5edab2b3fd02115ef36015cde
 # Crash
 #  - path: pathfinder/canvas_moire.trace
 #    expectations:



More information about the mesa-commit mailing list