From 7fc6af99ea4ef86e96b098dcd29a52d33fdd915f Mon Sep 17 00:00:00 2001 From: Lorenzo Rossi Date: Thu, 12 Mar 2026 15:18:52 +0100 Subject: [PATCH] pan: Remove dead code for sso_abi builder and fixed_varyings Now that the SSO ABI is never used we can remove it with all of the plumbing code required to find the fixed varyings bits. Signed-off-by: Lorenzo Rossi Acked-by: Eric R. Smith Reviewed-by: Faith Ekstrand Part-of: --- src/gallium/drivers/panfrost/pan_shader.c | 9 +---- src/panfrost/compiler/pan_compiler.h | 27 -------------- .../compiler/pan_nir_collect_varyings.c | 37 ------------------- 3 files changed, 1 insertion(+), 72 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_shader.c b/src/gallium/drivers/panfrost/pan_shader.c index e834bd5dd23..f3afa3608e0 100644 --- a/src/gallium/drivers/panfrost/pan_shader.c +++ b/src/gallium/drivers/panfrost/pan_shader.c @@ -120,14 +120,9 @@ panfrost_shader_compile(struct panfrost_screen *screen, const nir_shader *ir, }; /* Lower this early so the backends don't have to worry about it */ - if (s->info.stage == MESA_SHADER_FRAGMENT) { - inputs.fixed_varying_mask = - pan_get_fixed_varying_mask(s->info.inputs_read); - } else if (s->info.stage == MESA_SHADER_VERTEX) { + if (s->info.stage == MESA_SHADER_VERTEX) { /* No IDVS for internal XFB shaders */ inputs.no_idvs = s->info.has_transform_feedback_varyings; - inputs.fixed_varying_mask = - pan_get_fixed_varying_mask(s->info.outputs_written); if (s->info.has_transform_feedback_varyings) { NIR_PASS(_, s, nir_opt_constant_folding); @@ -153,8 +148,6 @@ panfrost_shader_compile(struct panfrost_screen *screen, const nir_shader *ir, if (key->fs.clip_plane_enable) { NIR_PASS(_, s, nir_lower_clip_fs, key->fs.clip_plane_enable, false, true); - inputs.fixed_varying_mask = - pan_get_fixed_varying_mask(s->info.inputs_read); } if (key->fs.line_smooth) { diff --git a/src/panfrost/compiler/pan_compiler.h b/src/panfrost/compiler/pan_compiler.h index 65ce8a652d0..4b100f596c2 100644 --- a/src/panfrost/compiler/pan_compiler.h +++ b/src/panfrost/compiler/pan_compiler.h @@ -116,16 +116,6 @@ struct pan_compile_inputs { /* Mask of UBOs that may be moved to push constants */ uint32_t pushable_ubos; - /* Used on Valhall. - * - * Bit mask of special desktop-only varyings (e.g VARYING_SLOT_TEX0) - * written by the previous stage (fragment shader) or written by this - * stage (vertex shader). Bits are slots from gl_varying_slot. - * - * For modern APIs (GLES or VK), this should be 0. - */ - uint32_t fixed_varying_mask; - /* Varying layout in memory, if known */ const struct pan_varying_layout *varying_layout; @@ -268,13 +258,6 @@ pan_varying_layout_slot_at(const struct pan_varying_layout *layout, return slot; } -static inline uint32_t -pan_get_fixed_varying_mask(unsigned varyings_used) -{ - return (varyings_used & BITFIELD_MASK(VARYING_SLOT_VAR0)) & - ~VARYING_BIT_POS & ~PAN_ATTRIB_VARYING_BITS; -} - static inline void pan_varying_layout_require_format(const struct pan_varying_layout *layout) { @@ -294,16 +277,6 @@ pan_varying_layout_require_layout(const struct pan_varying_layout *layout) enum pipe_format pan_varying_format(nir_alu_type type, unsigned ncomps); -/** Builds a varying layout according to the SSO ABI we developed for OpenGL. - * - * This can be called on either shader stage and the two varying layouts are - * guaranteed to match if the same fixed_varyings are passed into both. - */ -void -pan_build_varying_layout_sso_abi(struct pan_varying_layout *layout, - nir_shader *nir, unsigned gpu_id, - uint32_t fixed_varyings); - void pan_build_varying_layout_compact(struct pan_varying_layout *layout, nir_shader *nir, unsigned gpu_id); diff --git a/src/panfrost/compiler/pan_nir_collect_varyings.c b/src/panfrost/compiler/pan_nir_collect_varyings.c index 60167ad8f5c..c13e14f6939 100644 --- a/src/panfrost/compiler/pan_nir_collect_varyings.c +++ b/src/panfrost/compiler/pan_nir_collect_varyings.c @@ -379,43 +379,6 @@ pan_varying_collect_formats(struct pan_varying_layout *layout, nir_shader *nir, layout->known |= PAN_VARYING_FORMAT_KNOWN; } -void -pan_build_varying_layout_sso_abi(struct pan_varying_layout *layout, - nir_shader *nir, unsigned gpu_id, - uint32_t fixed_varyings) -{ - pan_varying_layout_require_format(layout); - - const unsigned gpu_arch = pan_arch(gpu_id); - unsigned generic_size_B = 0; - for (unsigned i = 0; i < layout->count; i++) { - struct pan_varying_slot *slot = &layout->slots[i]; - if (pan_varying_slot_is_empty(slot)) - continue; - - if (slot->section != PAN_VARYING_SECTION_GENERIC) { - ASSERTED const struct pan_varying_slot hw_slot = - hw_varying_slot(gpu_arch, nir->info.stage, slot->location); - - assert(memcmp(slot, &hw_slot, sizeof(*slot)) == 0); - } else { - unsigned offset = - bi_varying_base_bytes(slot->location, fixed_varyings); - assert(offset < (1 << 11)); - - const unsigned bit_size = nir_alu_type_get_type_size(slot->alu_type); - const unsigned size = slot->ncomps * (bit_size / 8); - generic_size_B = MAX2(generic_size_B, offset + size); - - assert(slot->offset == -1); - assert(offset < 4096); - slot->offset = offset; - } - } - layout->generic_size_B = generic_size_B; - layout->known |= PAN_VARYING_LAYOUT_KNOWN; -} - void pan_build_varying_layout_compact(struct pan_varying_layout *layout, nir_shader *nir, unsigned gpu_id)