From 151aa19c21575ba498a19c48e84474107a4eb304 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 21 Jun 2022 13:00:42 -0400 Subject: [PATCH] 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 Reviewed-by: Emma Anholt Reviewed-by: Timothy Arceri Cc: mesa-stable Part-of: --- src/gallium/auxiliary/nir/tgsi_to_nir.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c index 1525462..a55f460 100644 --- a/src/gallium/auxiliary/nir/tgsi_to_nir.c +++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c @@ -2341,6 +2341,9 @@ ttn_compile_init(const void *tgsi_tokens, BITSET_SET32(s->info.samplers_used, 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]; -- 2.7.4