From dbbb3debe59b7efa741829aefa5dfb25ff2bfd18 Mon Sep 17 00:00:00 2001 From: IMS212 Date: Sun, 24 Dec 2023 08:58:52 -0800 Subject: [PATCH] Fix tesselation --- .../pipeline/newshader/ExtendedShader.java | 28 ++++++++++++++++++- .../pipeline/newshader/NewShaderTests.java | 10 +++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/coderbot/iris/pipeline/newshader/ExtendedShader.java b/src/main/java/net/coderbot/iris/pipeline/newshader/ExtendedShader.java index e536c4798b..1e10c602f0 100644 --- a/src/main/java/net/coderbot/iris/pipeline/newshader/ExtendedShader.java +++ b/src/main/java/net/coderbot/iris/pipeline/newshader/ExtendedShader.java @@ -259,7 +259,7 @@ public void attachToProgram() { } @Override - public void iris$createGeometryShader(ResourceProvider factory, String name) throws IOException { + public void iris$createExtraShaders(ResourceProvider factory, String name) throws IOException { factory.getResource(new ResourceLocation("minecraft", name + "_geometry.gsh")).ifPresent(geometry -> { try { this.geometry = Program.compileShader(IrisProgramTypes.GEOMETRY, name, geometry.open(), geometry.sourcePackId(), new GlslPreprocessor() { @@ -273,6 +273,32 @@ public String applyImport(boolean bl, String string) { e.printStackTrace(); } }); + factory.getResource(new ResourceLocation("minecraft", name + "_tessControl.tcs")).ifPresent(tessControl -> { + try { + this.tessControl = Program.compileShader(IrisProgramTypes.TESS_CONTROL, name, tessControl.open(), tessControl.sourcePackId(), new GlslPreprocessor() { + @Nullable + @Override + public String applyImport(boolean bl, String string) { + return null; + } + }); + } catch (IOException e) { + e.printStackTrace(); + } + }); + factory.getResource(new ResourceLocation("minecraft", name + "_tessEval.tes")).ifPresent(tessEval -> { + try { + this.tessEval = Program.compileShader(IrisProgramTypes.TESS_EVAL, name, tessEval.open(), tessEval.sourcePackId(), new GlslPreprocessor() { + @Nullable + @Override + public String applyImport(boolean bl, String string) { + return null; + } + }); + } catch (IOException e) { + e.printStackTrace(); + } + }); } public Program getGeometry() { diff --git a/src/main/java/net/coderbot/iris/pipeline/newshader/NewShaderTests.java b/src/main/java/net/coderbot/iris/pipeline/newshader/NewShaderTests.java index 19d3a87f4e..2545c3b7ab 100644 --- a/src/main/java/net/coderbot/iris/pipeline/newshader/NewShaderTests.java +++ b/src/main/java/net/coderbot/iris/pipeline/newshader/NewShaderTests.java @@ -205,6 +205,16 @@ public Optional getResource(ResourceLocation id) { return Optional.empty(); } return Optional.of(new StringResource(id, geometry)); + } else if (path.endsWith("tcs")) { + if (tessControl == null) { + return Optional.empty(); + } + return Optional.of(new StringResource(id, tessControl)); + } else if (path.endsWith("tes")) { + if (tessEval == null) { + return Optional.empty(); + } + return Optional.of(new StringResource(id, tessEval)); } else if (path.endsWith("fsh")) { return Optional.of(new StringResource(id, fragment)); }