From 5b1ca516e1879469bf5886b4ac0922824d35c37d Mon Sep 17 00:00:00 2001 From: Moritz Zwerger Date: Tue, 23 Apr 2024 11:30:31 +0200 Subject: [PATCH] shader: correctly apply defaults This (should) fix shader building on intel gpus with mesa drivers. `foutColor` was optimized out because the initial values appear to be always 0. Thus it was not building, because the uTintColor uniform was not found (and maybe it otherwise would have appeared black) --- .../assets/minosoft/rendering/shader/sky/planet/planet.fsh | 3 ++- .../minosoft/rendering/shader/sky/skybox/texture/texture.fsh | 3 ++- .../assets/minosoft/rendering/shader/world/border/border.fsh | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/resources/assets/minosoft/rendering/shader/sky/planet/planet.fsh b/src/main/resources/assets/minosoft/rendering/shader/sky/planet/planet.fsh index b241b2c5e..34786ac5a 100644 --- a/src/main/resources/assets/minosoft/rendering/shader/sky/planet/planet.fsh +++ b/src/main/resources/assets/minosoft/rendering/shader/sky/planet/planet.fsh @@ -23,7 +23,8 @@ uniform vec4 uTintColor; void main() { - applyTexel(); + applyDefaults(); foutColor *= uTintColor; discard_alpha(); + applyTexel(); } diff --git a/src/main/resources/assets/minosoft/rendering/shader/sky/skybox/texture/texture.fsh b/src/main/resources/assets/minosoft/rendering/shader/sky/skybox/texture/texture.fsh index 6b4be7f54..8d9e8b54c 100644 --- a/src/main/resources/assets/minosoft/rendering/shader/sky/skybox/texture/texture.fsh +++ b/src/main/resources/assets/minosoft/rendering/shader/sky/skybox/texture/texture.fsh @@ -23,6 +23,7 @@ uniform vec4 uTintColor; #include "minosoft:animation" void main() { + applyDefaults(); + foutColor.rgb *= uTintColor.rgb; applyTexel(); - foutColor *= uTintColor; } diff --git a/src/main/resources/assets/minosoft/rendering/shader/world/border/border.fsh b/src/main/resources/assets/minosoft/rendering/shader/world/border/border.fsh index a889423eb..7be92adaa 100644 --- a/src/main/resources/assets/minosoft/rendering/shader/world/border/border.fsh +++ b/src/main/resources/assets/minosoft/rendering/shader/world/border/border.fsh @@ -24,6 +24,7 @@ uniform vec4 uTintColor; #include "minosoft:animation" void main() { - applyTexel(); + applyDefaults(); foutColor *= uTintColor; + applyTexel(); }