Skip to content

Commit d8964db

Browse files
committed
Fix Shader Processing
1 parent 13e6b9a commit d8964db

1 file changed

Lines changed: 4 additions & 14 deletions

File tree

source/funkin/backend/shaders/FunkinShader.hx

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,16 @@ class FunkinShader extends FlxShader implements IHScriptCustomBehaviour {
6161
return Shader.processGLSLText(_processGLSLText(source, glVersion, isFragment, pragmas), glVersion, isFragment);
6262

6363
private static function _processGLSLText(source:String, glVersion:String, isFragment:Bool, ?pragmas:Map<String, String>):String {
64-
var injectedFragColor = StringTools.contains(source, "out vec4"), canInjectFragColorFix = switch (glVersion) {
65-
case "300 es", "310 es", "320 es", "330", "400", "410", "420", "430", "440", "450", "460": isFragment;
66-
default: false;
67-
};
6864
if (pragmas != null) {
69-
final pragmaKeyword = ~/#pragma (\w+)/g;
65+
final pragmaKeyword = ~/#pragma\s+(\w+)/g;
7066
source = pragmaKeyword.map(source, (_) -> {
7167
var name = pragmaKeyword.matched(1), pragma:String;
7268
if (pragmas.exists(name)) pragma = pragmas.get(name);
7369
else {
7470
if (name != "header" && name != "body") return '#pragma $name';
7571
pragma = "";
7672
}
77-
78-
var pragma = pragmas.get(name);
79-
if (name == "header" && canInjectFragColorFix && !injectedFragColor) {
80-
injectedFragColor = true;
81-
if (!StringTools.contains(pragma, "out vec4")) return processGLSLText(Shader.fragColorHeaderFix + pragma, glVersion, isFragment, pragmas);
82-
}
83-
return processGLSLText(pragma, glVersion, isFragment, pragmas);
73+
return _processGLSLText(pragma, glVersion, isFragment, pragmas);
8474
});
8575
}
8676

@@ -99,10 +89,10 @@ class FunkinShader extends FlxShader implements IHScriptCustomBehaviour {
9989
final includeKeyword = ~/#include ['"](.+)['"]/g;
10090
final importKeyword = ~/#import\s+<(.*)>/g;
10191
source = importKeyword.map(source, (_) ->
102-
return processGLSLText(tryGetShaderCode(importKeyword.matched(1)), glVersion, isFragment, pragmas) ?? "");
92+
return _processGLSLText(tryGetShaderCode(importKeyword.matched(1)), glVersion, isFragment, pragmas) ?? "");
10393

10494
return source = includeKeyword.map(source, (_) ->
105-
return processGLSLText(tryGetShaderCode(includeKeyword.matched(1)), glVersion, isFragment, pragmas) ?? "");
95+
return _processGLSLText(tryGetShaderCode(includeKeyword.matched(1)), glVersion, isFragment, pragmas) ?? "");
10696
}
10797

10898
private static var __defaultsAvailable:Bool;

0 commit comments

Comments
 (0)