Merge branch 'dev' into shader-pipeline

This commit is contained in:
Jozufozu 2021-07-13 23:31:16 -07:00
commit b2a670d4de
5 changed files with 44 additions and 3 deletions

View file

@ -1,3 +1,16 @@
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
- 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
- Render layer events are always dispatched, even when the backend is disabled

View file

@ -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

View file

@ -44,7 +44,16 @@ public abstract class ShaderContext<P extends GlProgram> 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<P extends GlProgram> implements IShaderConte
}
protected Program link(Program program) {
return program.link();
return program.link().deleteLinkedShaders();
}
@Override

View file

@ -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<ShaderType, Shader> 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;
}
}

View file

@ -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<IProgramExtension> getExtensions() {
return extensions;
}
@Override
public String toString() {
return "ProgramState{" + "gameState=" + context.getID() + ", defines=" + defines + ", extensions=" + extensions.stream().map(IProgramExtension::getID).collect(Collectors.toList()) + '}';
}
}