Mesa (staging/22.1): ttn: Set nir->info.separate_shader

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 6 17:04:13 UTC 2022


Module: Mesa
Branch: staging/22.1
Commit: 122e31b5ea580f2fc87a1582d2bafae66cbb4795
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=122e31b5ea580f2fc87a1582d2bafae66cbb4795

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Tue Jun 21 13:00:42 2022 -0400

ttn: Set nir->info.separate_shader

TGSI has no legitimate[1] notion of linked shaders, which means tgsi_to_nir
should conservatively assume everything all shaders are separable. This requires
setting nir->info.separate_shader to warn drivers that shader CSOs might be
mixed and matched. Otherwise, the driver might enable optimizations that
are invalid for separate shaders, causing issues when the shaders are
later treated as separable.

This will fix varying linking with u_blitter's shaders on Panfrost (Bifrost and
older), when util_blitter_clear is used with Panfrost.

[1] There was a TGSI property added recently to forward
nir->info.separate_shader up to virglrenderer, but it's not actually used for
anything in virglrenderer and I am still struggling to understand what the use
case would be. My gut says we should revert b63403054237 ("tgsi: Add
SEPARABLE_PROGRAM property"), but I'm not interested in fighting that yak right
now. Notably, the u_blitter and hud shaders are separable but are not marked
with this property.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Reviewed-by: Emma Anholt <emma at anholt.net>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17282>
(cherry picked from commit 151aa19c21575ba498a19c48e84474107a4eb304)

---

 .pick_status.json                       | 2 +-
 src/gallium/auxiliary/nir/tgsi_to_nir.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 59e19f036a2..544d5ddcc45 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -499,7 +499,7 @@
         "description": "ttn: Set nir->info.separate_shader",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index 3823089719e..ad1839658c9 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -2326,6 +2326,9 @@ ttn_compile_init(const void *tgsi_tokens,
    s->info.num_textures = util_last_bit(scan.samplers_declared);
    s->info.internal = false;
 
+   /* Default for TGSI is separate, this is assumed throughout the tree */
+   s->info.separate_shader = true;
+
    for (unsigned i = 0; i < TGSI_PROPERTY_COUNT; i++) {
       unsigned value = scan.properties[i];
 



More information about the mesa-commit mailing list