From dcacdedba9ec81f70b57f585a9bb24f4753812c2 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Tue, 13 Jul 2021 14:00:44 -0700 Subject: [PATCH 1/2] Bump version - 0.1.1 --- changelog.txt | 10 ++++++++++ gradle.properties | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index e1c78e5fa..b8bae6ece 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,13 @@ +0.1.1: +New + - Flywheel driven chest and bell rendering, ~20x performance improvement in contrived cases +Fixes + - Fix potential crash related to rendering breaking overlay +Technical/API + - Deprecate instance registration functions in favor of builders + - Refactor breaking overlay renderer to be cleaner and more contained + - Move per-world material managers out of WorldContext into InstancedRenderDispatcher + 0.1.0: Fixes - Render layer events are always dispatched, even when the backend is disabled diff --git a/gradle.properties b/gradle.properties index ca26875c7..67be8fc69 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false # mod version info -mod_version=0.1.0 +mod_version=0.1.1 mc_update_version=1.16 minecraft_version=1.16.5 forge_version=36.0.42 From defc4dace589b046723015bc78279b98535ec22c Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Tue, 13 Jul 2021 15:57:14 -0700 Subject: [PATCH 2/2] Hacky program link debug info - Log which gl ids are assigned to different programs - Log name and basic state information --- changelog.txt | 3 +++ .../jozufozu/flywheel/backend/ShaderContext.java | 13 +++++++++++-- .../jozufozu/flywheel/backend/loading/Program.java | 13 +++++++++++++ .../flywheel/core/shader/spec/ProgramState.java | 6 ++++++ 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index b8bae6ece..bd10b8520 100644 --- a/changelog.txt +++ b/changelog.txt @@ -7,6 +7,9 @@ Technical/API - Deprecate instance registration functions in favor of builders - Refactor breaking overlay renderer to be cleaner and more contained - Move per-world material managers out of WorldContext into InstancedRenderDispatcher + - Add helper for getting information about texture atlases + - Add more debug information for shader loading + - Delete shaders after they're linked to programs 0.1.0: Fixes diff --git a/src/main/java/com/jozufozu/flywheel/backend/ShaderContext.java b/src/main/java/com/jozufozu/flywheel/backend/ShaderContext.java index 4f8595c64..a265b1999 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/ShaderContext.java +++ b/src/main/java/com/jozufozu/flywheel/backend/ShaderContext.java @@ -44,7 +44,16 @@ public abstract class ShaderContext

implements IShaderConte fragmentFile.defineAll(state.getDefines()); } - return link(buildProgram(spec.name, vertexFile, fragmentFile)); + Program linked = link(buildProgram(spec.name, vertexFile, fragmentFile)); + + String descriptor = linked.program + ": " + spec.name; + + if (state != null) + descriptor += "#" + state; + + Backend.log.debug(descriptor); + + return linked; } protected Shader getSource(ShaderType type, ResourceLocation name) { @@ -52,7 +61,7 @@ public abstract class ShaderContext

implements IShaderConte } protected Program link(Program program) { - return program.link(); + return program.link().deleteLinkedShaders(); } @Override diff --git a/src/main/java/com/jozufozu/flywheel/backend/loading/Program.java b/src/main/java/com/jozufozu/flywheel/backend/loading/Program.java index 43f6fefe8..c5a8d9d96 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/loading/Program.java +++ b/src/main/java/com/jozufozu/flywheel/backend/loading/Program.java @@ -11,11 +11,16 @@ import static org.lwjgl.opengl.GL20.glLinkProgram; import java.util.EnumMap; import java.util.Map; +import java.util.function.IntConsumer; + +import org.lwjgl.opengl.GL20; import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.gl.shader.GlShader; import com.jozufozu.flywheel.backend.gl.shader.ShaderType; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; import net.minecraft.util.ResourceLocation; public class Program { @@ -26,10 +31,13 @@ public class Program { public final Map attached; + private final IntList shaders; + public Program(ResourceLocation name) { this.name = name; this.program = glCreateProgram(); attached = new EnumMap<>(ShaderType.class); + shaders = new IntArrayList(2); } public Program attachShader(Shader shader, GlShader glShader) { @@ -66,4 +74,9 @@ public class Program { return this; } + + public Program deleteLinkedShaders() { + shaders.forEach((IntConsumer) GL20::glDeleteShader); + return this; + } } diff --git a/src/main/java/com/jozufozu/flywheel/core/shader/spec/ProgramState.java b/src/main/java/com/jozufozu/flywheel/core/shader/spec/ProgramState.java index 2e39487e0..e42e9c5d4 100644 --- a/src/main/java/com/jozufozu/flywheel/core/shader/spec/ProgramState.java +++ b/src/main/java/com/jozufozu/flywheel/core/shader/spec/ProgramState.java @@ -2,6 +2,7 @@ package com.jozufozu.flywheel.core.shader.spec; import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; import com.jozufozu.flywheel.core.shader.extension.IProgramExtension; import com.jozufozu.flywheel.util.CodecUtil; @@ -55,4 +56,9 @@ public class ProgramState { public List getExtensions() { return extensions; } + + @Override + public String toString() { + return "ProgramState{" + "gameState=" + context.getID() + ", defines=" + defines + ", extensions=" + extensions.stream().map(IProgramExtension::getID).collect(Collectors.toList()) + '}'; + } }