mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-12 00:17:54 +00:00
Shader fixes (#1619)
This commit is contained in:
1 parent
189ff4a80f
commit
d91c356a99
2 files changed
+43
-45
No files matched your search
@@ -39,56 +39,54 @@ public class PatchedShaderPrinter {
|
||||
}
|
||||
|
||||
public static void debugPatchedShaders(String name, String vertex, String geometry, String tessControl, String tessEval, String fragment, String compute) {
|
||||
if (!Iris.getIrisConfig().areDebugOptionsEnabled()) {
|
||||
if (!prettyPrintShaders && !Iris.getIrisConfig().areDebugOptionsEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (prettyPrintShaders) {
|
||||
final Path debugOutDir = Minecraft.getMinecraft().mcDataDir.toPath().resolve("patched_shaders");
|
||||
if (!outputLocationCleared) {
|
||||
try {
|
||||
if (Files.exists(debugOutDir)) {
|
||||
try (Stream<Path> stream = Files.list(debugOutDir)) {
|
||||
stream.forEach(path -> {
|
||||
try {
|
||||
Files.delete(path);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Files.createDirectories(debugOutDir);
|
||||
} catch (IOException e) {
|
||||
Iris.logger.warn("Failed to initialize debug patched shader source location", e);
|
||||
}
|
||||
outputLocationCleared = true;
|
||||
}
|
||||
|
||||
final Path debugOutDir = Minecraft.getMinecraft().mcDataDir.toPath().resolve("patched_shaders");
|
||||
if (!outputLocationCleared) {
|
||||
try {
|
||||
programCounter++;
|
||||
String prefix = String.format("%03d_", programCounter);
|
||||
if (vertex != null) {
|
||||
Files.write(debugOutDir.resolve(prefix + name + ".vsh"), vertex.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
if (geometry != null) {
|
||||
Files.write(debugOutDir.resolve(prefix + name + ".gsh"), geometry.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
if (tessControl != null) {
|
||||
Files.write(debugOutDir.resolve(prefix + name + ".tcs"), tessControl.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
if (tessEval != null) {
|
||||
Files.write(debugOutDir.resolve(prefix + name + ".tes"), tessEval.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
if (fragment != null) {
|
||||
Files.write(debugOutDir.resolve(prefix + name + ".fsh"), fragment.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
if (compute != null) {
|
||||
Files.write(debugOutDir.resolve(prefix + name + ".csh"), compute.getBytes(StandardCharsets.UTF_8));
|
||||
if (Files.exists(debugOutDir)) {
|
||||
try (Stream<Path> stream = Files.list(debugOutDir)) {
|
||||
stream.forEach(path -> {
|
||||
try {
|
||||
Files.delete(path);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Files.createDirectories(debugOutDir);
|
||||
} catch (IOException e) {
|
||||
Iris.logger.warn("Failed to write debug patched shader source", e);
|
||||
Iris.logger.warn("Failed to initialize debug patched shader source location", e);
|
||||
}
|
||||
outputLocationCleared = true;
|
||||
}
|
||||
|
||||
try {
|
||||
programCounter++;
|
||||
String prefix = String.format("%03d_", programCounter);
|
||||
if (vertex != null) {
|
||||
Files.write(debugOutDir.resolve(prefix + name + ".vsh"), vertex.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
if (geometry != null) {
|
||||
Files.write(debugOutDir.resolve(prefix + name + ".gsh"), geometry.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
if (tessControl != null) {
|
||||
Files.write(debugOutDir.resolve(prefix + name + ".tcs"), tessControl.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
if (tessEval != null) {
|
||||
Files.write(debugOutDir.resolve(prefix + name + ".tes"), tessEval.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
if (fragment != null) {
|
||||
Files.write(debugOutDir.resolve(prefix + name + ".fsh"), fragment.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
if (compute != null) {
|
||||
Files.write(debugOutDir.resolve(prefix + name + ".csh"), compute.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Iris.logger.warn("Failed to write debug patched shader source", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user