mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-28 16:06:28 +01:00
Merge branch 'dev' into shader-pipeline
This commit is contained in:
commit
b2a670d4de
5 changed files with 44 additions and 3 deletions
|
@ -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:
|
0.1.0:
|
||||||
Fixes
|
Fixes
|
||||||
- Render layer events are always dispatched, even when the backend is disabled
|
- Render layer events are always dispatched, even when the backend is disabled
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
org.gradle.jvmargs=-Xmx3G
|
org.gradle.jvmargs=-Xmx3G
|
||||||
org.gradle.daemon=false
|
org.gradle.daemon=false
|
||||||
# mod version info
|
# mod version info
|
||||||
mod_version=0.1.0
|
mod_version=0.1.1
|
||||||
mc_update_version=1.16
|
mc_update_version=1.16
|
||||||
minecraft_version=1.16.5
|
minecraft_version=1.16.5
|
||||||
forge_version=36.0.42
|
forge_version=36.0.42
|
||||||
|
|
|
@ -44,7 +44,16 @@ public abstract class ShaderContext<P extends GlProgram> implements IShaderConte
|
||||||
fragmentFile.defineAll(state.getDefines());
|
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) {
|
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) {
|
protected Program link(Program program) {
|
||||||
return program.link();
|
return program.link().deleteLinkedShaders();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,11 +11,16 @@ import static org.lwjgl.opengl.GL20.glLinkProgram;
|
||||||
|
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.Map;
|
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.Backend;
|
||||||
import com.jozufozu.flywheel.backend.gl.shader.GlShader;
|
import com.jozufozu.flywheel.backend.gl.shader.GlShader;
|
||||||
import com.jozufozu.flywheel.backend.gl.shader.ShaderType;
|
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;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class Program {
|
public class Program {
|
||||||
|
@ -26,10 +31,13 @@ public class Program {
|
||||||
|
|
||||||
public final Map<ShaderType, Shader> attached;
|
public final Map<ShaderType, Shader> attached;
|
||||||
|
|
||||||
|
private final IntList shaders;
|
||||||
|
|
||||||
public Program(ResourceLocation name) {
|
public Program(ResourceLocation name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.program = glCreateProgram();
|
this.program = glCreateProgram();
|
||||||
attached = new EnumMap<>(ShaderType.class);
|
attached = new EnumMap<>(ShaderType.class);
|
||||||
|
shaders = new IntArrayList(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Program attachShader(Shader shader, GlShader glShader) {
|
public Program attachShader(Shader shader, GlShader glShader) {
|
||||||
|
@ -66,4 +74,9 @@ public class Program {
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Program deleteLinkedShaders() {
|
||||||
|
shaders.forEach((IntConsumer) GL20::glDeleteShader);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.jozufozu.flywheel.core.shader.spec;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.core.shader.extension.IProgramExtension;
|
import com.jozufozu.flywheel.core.shader.extension.IProgramExtension;
|
||||||
import com.jozufozu.flywheel.util.CodecUtil;
|
import com.jozufozu.flywheel.util.CodecUtil;
|
||||||
|
@ -55,4 +56,9 @@ public class ProgramState {
|
||||||
public List<IProgramExtension> getExtensions() {
|
public List<IProgramExtension> getExtensions() {
|
||||||
return extensions;
|
return extensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ProgramState{" + "gameState=" + context.getID() + ", defines=" + defines + ", extensions=" + extensions.stream().map(IProgramExtension::getID).collect(Collectors.toList()) + '}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue