Skip to content

Commit fc28597

Browse files
committed
Don't treat shader "validation" issues as errors by default
- Related to issue #3 - I don't think OF/Iris do this at all?
1 parent efdcf95 commit fc28597

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/main/java/com/ventooth/swansong/config/DebugConfig.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,12 @@ public final class DebugConfig {
4444
public static boolean UseGLDebugGroups;
4545

4646
@Config.DefaultBoolean(false)
47-
public static boolean GLDebugMarkers;
47+
public static boolean FailOnShaderValidationErrors; // TODO: Desc
4848

4949
@Config.DefaultBoolean(false)
50-
public static boolean DumpCompiledUniforms;
50+
public static boolean GLDebugMarkers; // TODO: Desc
51+
52+
@Config.DefaultBoolean(false)
53+
public static boolean DumpCompiledUniforms; // TODO: Desc
5154
}
5255

src/main/java/com/ventooth/swansong/shader/loader/ShaderLoader.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import com.falsepattern.lib.util.MathUtil;
1414
import com.ventooth.swansong.EnvInfo;
1515
import com.ventooth.swansong.Share;
16+
import com.ventooth.swansong.config.DebugConfig;
17+
import com.ventooth.swansong.config.ModuleConfig;
1618
import com.ventooth.swansong.gl.GLProgram;
1719
import com.ventooth.swansong.gl.GLShader;
1820
import com.ventooth.swansong.resources.ShaderPackManager;
@@ -1269,9 +1271,15 @@ public GLProgram createProgram(@NotNull String name, @NotNull GLShader vertShade
12691271
if (infoLog.isEmpty()) {
12701272
infoLog = "Empty program info log";
12711273
}
1272-
program.glDeleteProgram();
12731274

1274-
throw new ShaderException("Failed to validate program: " + name + '\n' + (infoLog) + '\n');
1275+
// TODO: Unsure if this is necessary, related issue: SwanSong#3
1276+
val msg = "Failed to validate program: " + name + '\n' + (infoLog) + '\n';
1277+
if (ModuleConfig.Debug && DebugConfig.FailOnShaderValidationErrors) {
1278+
program.glDeleteProgram();
1279+
throw new ShaderException("Failed to validate program: " + name + '\n' + (infoLog) + '\n');
1280+
} else {
1281+
Share.log.warn(msg);
1282+
}
12751283
}
12761284

12771285
return program;

0 commit comments

Comments
 (0)