pre-setup
This commit is contained in:
@@ -69,6 +69,11 @@ public abstract class AbstractRenderPipeline extends TrackedObject {
|
|||||||
this.sectionRenderer = sectionRenderer;
|
this.sectionRenderer = sectionRenderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Called before the pipeline starts running, used to update uniforms etc
|
||||||
|
public void preSetup(Viewport<?> viewport) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract int setup(Viewport<?> viewport, int sourceFramebuffer, int srcWidth, int srcHeight);
|
protected abstract int setup(Viewport<?> viewport, int sourceFramebuffer, int srcWidth, int srcHeight);
|
||||||
protected abstract void postOpaquePreTranslucent(Viewport<?> viewport);
|
protected abstract void postOpaquePreTranslucent(Viewport<?> viewport);
|
||||||
protected void finish(Viewport<?> viewport, int sourceFrameBuffer, int srcWidth, int srcHeight) {
|
protected void finish(Viewport<?> viewport, int sourceFrameBuffer, int srcWidth, int srcHeight) {
|
||||||
|
|||||||
@@ -90,14 +90,18 @@ public class IrisVoxyRenderPipeline extends AbstractRenderPipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int setup(Viewport<?> viewport, int sourceFramebuffer, int srcWidth, int srcHeight) {
|
public void preSetup(Viewport<?> viewport) {
|
||||||
|
super.preSetup(viewport);
|
||||||
if (this.shaderUniforms != null) {
|
if (this.shaderUniforms != null) {
|
||||||
//Update the uniforms
|
//Update the uniforms
|
||||||
long ptr = UploadStream.INSTANCE.uploadTo(this.shaderUniforms);
|
long ptr = UploadStream.INSTANCE.uploadTo(this.shaderUniforms);
|
||||||
this.data.getUniforms().updater().accept(ptr);
|
this.data.getUniforms().updater().accept(ptr);
|
||||||
UploadStream.INSTANCE.commit();
|
UploadStream.INSTANCE.commit();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int setup(Viewport<?> viewport, int sourceFramebuffer, int srcWidth, int srcHeight) {
|
||||||
|
|
||||||
this.fb.resize(viewport.width, viewport.height);
|
this.fb.resize(viewport.width, viewport.height);
|
||||||
this.fbTranslucent.resize(viewport.width, viewport.height);
|
this.fbTranslucent.resize(viewport.width, viewport.height);
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ public class VoxyRenderSystem {
|
|||||||
this.renderDistanceTracker.setRenderDistance(VoxyConfig.CONFIG.sectionRenderDistance);
|
this.renderDistanceTracker.setRenderDistance(VoxyConfig.CONFIG.sectionRenderDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.chunkBoundRenderer = new ChunkBoundRenderer();
|
this.chunkBoundRenderer = new ChunkBoundRenderer(this.pipeline);
|
||||||
|
|
||||||
Logger.info("Voxy render system created with " + geometryCapacity + " geometry capacity, using pipeline '" + this.pipeline.getClass().getSimpleName() + "' with renderer '" + sectionRenderer.getClass().getSimpleName() + "'");
|
Logger.info("Voxy render system created with " + geometryCapacity + " geometry capacity, using pipeline '" + this.pipeline.getClass().getSimpleName() + "' with renderer '" + sectionRenderer.getClass().getSimpleName() + "'");
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
@@ -231,6 +231,7 @@ public class VoxyRenderSystem {
|
|||||||
|
|
||||||
//this.autoBalanceSubDivSize();
|
//this.autoBalanceSubDivSize();
|
||||||
|
|
||||||
|
this.pipeline.preSetup(viewport);
|
||||||
|
|
||||||
TimingStatistics.E.start();
|
TimingStatistics.E.start();
|
||||||
if (!IrisUtil.irisShadowActive()) {
|
if (!IrisUtil.irisShadowActive()) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package me.cortex.voxy.client.core.rendering;
|
|||||||
|
|
||||||
import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap;
|
import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
||||||
|
import me.cortex.voxy.client.core.AbstractRenderPipeline;
|
||||||
import me.cortex.voxy.client.core.gl.GlBuffer;
|
import me.cortex.voxy.client.core.gl.GlBuffer;
|
||||||
import me.cortex.voxy.client.core.gl.GlVertexArray;
|
import me.cortex.voxy.client.core.gl.GlVertexArray;
|
||||||
import me.cortex.voxy.client.core.gl.shader.AutoBindingShader;
|
import me.cortex.voxy.client.core.gl.shader.AutoBindingShader;
|
||||||
@@ -45,7 +46,7 @@ public class ChunkBoundRenderer {
|
|||||||
private final LongOpenHashSet addQueue = new LongOpenHashSet();
|
private final LongOpenHashSet addQueue = new LongOpenHashSet();
|
||||||
private final LongOpenHashSet remQueue = new LongOpenHashSet();
|
private final LongOpenHashSet remQueue = new LongOpenHashSet();
|
||||||
|
|
||||||
public ChunkBoundRenderer() {
|
public ChunkBoundRenderer(AbstractRenderPipeline pipeline) {
|
||||||
this.chunk2idx.defaultReturnValue(-1);
|
this.chunk2idx.defaultReturnValue(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#version 460 core
|
#version 460 core
|
||||||
#extension GL_ARB_gpu_shader_int64 : enable
|
|
||||||
#define VISIBILITY_ACCESS
|
|
||||||
#define VISIBILITY_BUFFER_BINDING 2
|
#define VISIBILITY_BUFFER_BINDING 2
|
||||||
#import <voxy:lod/gl46/bindings.glsl>
|
layout(binding = VISIBILITY_BUFFER_BINDING, std430) restrict buffer VisibilityBuffer {
|
||||||
|
uint visibilityData[];
|
||||||
|
};
|
||||||
|
|
||||||
layout(early_fragment_tests) in;
|
layout(early_fragment_tests) in;
|
||||||
|
|
||||||
flat in uint id;
|
flat in uint id;
|
||||||
@@ -11,5 +12,5 @@ flat in uint value;
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
visibilityData[id] = value;
|
visibilityData[id] = value;
|
||||||
//colour = vec4(float(id&7u)/7, float((id>>3)&7u)/7, float((id>>6)&7u)/7, 1);
|
//colour = vec4(float(id&7u)/7, float((id>>3)&7u)/7, float((id>>6)&7u)/7, 0);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user