From a8ed369c71ec9e51a1694287c0eae54df55096f6 Mon Sep 17 00:00:00 2001 From: catbot Date: Tue, 16 Jun 2026 15:29:29 +0000 Subject: [PATCH] perf(shaders): drop nonuniformEXT on text font slots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fontTextureSlot/fontSamplerSlot are push constants, hence provably dynamically uniform. Wrapping them in nonuniformEXT forced the per-invocation divergent-descriptor path and blocked hoisting the uniform descriptor load out of the per-pixel glyph loop. Removing the decoration is zero correctness risk — it is purely a read-index hint. Not applied to ui-images.comp.glsl, whose slots come from an SSBO load the compiler cannot prove uniform. Co-Authored-By: Claude Opus 4.8 --- shaders/ui-text.comp.glsl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/shaders/ui-text.comp.glsl b/shaders/ui-text.comp.glsl index c940035..88a0b9d 100644 --- a/shaders/ui-text.comp.glsl +++ b/shaders/ui-text.comp.glsl @@ -36,9 +36,12 @@ void main() { vec2 t = (sp - it.rect.xy) / it.rect.zw; vec2 uv = mix(it.uv.xy, it.uv.zw, t); + // Font slots are push constants — provably dynamically uniform, so no + // nonuniformEXT: lets the compiler hoist the descriptor load out of the + // per-pixel glyph loop and avoid the divergent-descriptor path. float sdf = texture( - sampler2D(uiTextures[nonuniformEXT(pc.fontTextureSlot)], - uiSamplers[nonuniformEXT(pc.fontSamplerSlot)]), + sampler2D(uiTextures[pc.fontTextureSlot], + uiSamplers[pc.fontSamplerSlot]), uv ).r;