From 8995de90676c60ef9e350b4d890975f197367f0f Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Mon, 28 Sep 2026 23:00:40 +0200 Subject: [PATCH] Stop the glass shader importing what older versions lack 1.21.4 and 1.21.5 read every shader's imports while loading resources, and dynamictransforms.glsl only exists from 1.21.6, so resources failed to load there. The glass shader declares the transforms block itself again, with LineWidth behind a define the pipeline sets before 1.21.11. Co-Authored-By: Claude Opus 5.5 --- .../org/saturnclient/impl/ui/GlassRenderer.java | 3 +++ .../assets/saturnclient/shaders/core/glass.fsh | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/saturnclient/impl/ui/GlassRenderer.java b/src/main/java/org/saturnclient/impl/ui/GlassRenderer.java index 37da9f3..9146cef 100644 --- a/src/main/java/org/saturnclient/impl/ui/GlassRenderer.java +++ b/src/main/java/org/saturnclient/impl/ui/GlassRenderer.java @@ -48,6 +48,9 @@ public final class GlassRenderer { .withLocation(Identifier.of("saturnclient", "pipeline/glass")) .withFragmentShader(Identifier.of("saturnclient", "core/glass")) .withSampler("Sampler1") + // The transforms block ends with LineWidth before 1.21.11 (see glass.fsh). + //? if <1.21.11 + //.withShaderDefine("HAS_LINE_WIDTH") .build(); private static final Identifier BLUR = Identifier.ofVanilla("post_effect/blur.json"); diff --git a/src/main/resources/assets/saturnclient/shaders/core/glass.fsh b/src/main/resources/assets/saturnclient/shaders/core/glass.fsh index 7d5ee7e..e58609c 100644 --- a/src/main/resources/assets/saturnclient/shaders/core/glass.fsh +++ b/src/main/resources/assets/saturnclient/shaders/core/glass.fsh @@ -3,8 +3,18 @@ // Saturn's glass: the blurred game behind the screen, cut to a panel's shape. For 1.21.6 and // later; glass_pre_1_21_6.fsh (with glass.json, the program 1.21.4 loads) is for older versions. -// Vanilla's own, since its layout changes between versions (1.21.11 dropped LineWidth) -#moj_import +// Vanilla's transforms, laid out as the version has them: 1.21.6 to 1.21.10 end with LineWidth, which +// 1.21.11 dropped (GlassRenderer defines HAS_LINE_WIDTH there). Not imported: the include only exists +// from 1.21.6, and 1.21.4 and 1.21.5 still read every shader's imports while loading resources. +layout(std140) uniform DynamicTransforms { + mat4 ModelViewMat; + vec4 ColorModulator; + vec3 ModelOffset; + mat4 TextureMat; +#ifdef HAS_LINE_WIDTH + float LineWidth; +#endif +}; // The panel's rounded rectangle, the same texture its background is drawn with uniform sampler2D Sampler0;