mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-20 20:32:14 +00:00
Support for custom uniforms (#902)
* wip backport of custom uniforms * Functioning custom uniforms maybe? * Workon separating dynamic/non-dynamic uniforms and making variables available to custom uniforms (currently the JVM dies horribly) * wip * It no longer crashes horrifically * star imports
This commit is contained in:
1 parent
6fa973dbc8
commit
bed724ba59
89 files changed
+4622
-266
No files matched your search
@@ -57,12 +57,15 @@ public final class ComputeProgram extends GlResource {
|
||||
return cachedWorkGroups;
|
||||
}
|
||||
|
||||
public void dispatch(float width, float height) {
|
||||
GL20.glUseProgram(getGlId());
|
||||
uniforms.update();
|
||||
samplers.update();
|
||||
images.update();
|
||||
public void use() {
|
||||
GL20.glUseProgram(getGlId());
|
||||
|
||||
uniforms.update();
|
||||
samplers.update();
|
||||
images.update();
|
||||
}
|
||||
|
||||
public void dispatch(float width, float height) {
|
||||
if (!Iris.getPipelineManager().getPipeline().map(WorldRenderingPipeline::allowConcurrentCompute).orElse(false)) {
|
||||
RenderSystem.memoryBarrier(40);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.OptionalInt;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.coderbot.iris.Iris;
|
||||
import net.coderbot.iris.gl.state.ValueUpdateNotifier;
|
||||
import net.coderbot.iris.gl.uniform.DynamicLocationalUniformHolder;
|
||||
@@ -20,6 +22,7 @@ import net.coderbot.iris.gl.uniform.UniformUpdateFrequency;
|
||||
import net.coderbot.iris.uniforms.SystemTimeUniforms;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import org.joml.Vector3i;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.ARBShaderImageLoadStore;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -172,8 +175,7 @@ public class ProgramUniforms {
|
||||
return OptionalInt.empty();
|
||||
}
|
||||
|
||||
// TODO: Temporary hack until custom uniforms are merged.
|
||||
if ((!locations.containsKey(id) && !uniformNames.containsKey(name)) || name.equals("framemod8")) {
|
||||
if ((!locations.containsKey(id) && !uniformNames.containsKey(name))) {
|
||||
locations.put(id, name);
|
||||
uniformNames.put(name, type);
|
||||
} else {
|
||||
@@ -240,12 +242,6 @@ public class ProgramUniforms {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: This is an absolutely horrific hack, but is needed until custom uniforms work.
|
||||
if ("framemod8".equals(name) && expected == UniformType.FLOAT && provided == UniformType.INT) {
|
||||
SystemTimeUniforms.addFloatFrameMod8Uniform(this);
|
||||
provided = UniformType.FLOAT;
|
||||
}
|
||||
|
||||
if (provided != null && provided != expected) {
|
||||
String expectedName;
|
||||
|
||||
@@ -283,7 +279,7 @@ public class ProgramUniforms {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public UniformHolder externallyManagedUniform(String name, UniformType type) {
|
||||
externalUniformNames.put(name, type);
|
||||
|
||||
|
||||
Reference in new issue
Block a user