wip defered translucency
This commit is contained in:
@@ -58,17 +58,20 @@ public abstract class AbstractRenderPipeline extends TrackedObject {
|
|||||||
|
|
||||||
public final DepthFramebuffer fb = new DepthFramebuffer(GL_DEPTH24_STENCIL8);
|
public final DepthFramebuffer fb = new DepthFramebuffer(GL_DEPTH24_STENCIL8);
|
||||||
|
|
||||||
|
protected final boolean deferTranslucency;
|
||||||
|
|
||||||
private static final int DEPTH_SAMPLER = glGenSamplers();
|
private static final int DEPTH_SAMPLER = glGenSamplers();
|
||||||
static {
|
static {
|
||||||
glSamplerParameteri(DEPTH_SAMPLER, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
glSamplerParameteri(DEPTH_SAMPLER, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
glSamplerParameteri(DEPTH_SAMPLER, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
glSamplerParameteri(DEPTH_SAMPLER, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AbstractRenderPipeline(AsyncNodeManager nodeManager, NodeCleaner nodeCleaner, HierarchicalOcclusionTraverser traversal, BooleanSupplier frexSupplier) {
|
protected AbstractRenderPipeline(AsyncNodeManager nodeManager, NodeCleaner nodeCleaner, HierarchicalOcclusionTraverser traversal, BooleanSupplier frexSupplier, boolean deferTranslucency) {
|
||||||
this.frexStillHasWork = frexSupplier;
|
this.frexStillHasWork = frexSupplier;
|
||||||
this.nodeManager = nodeManager;
|
this.nodeManager = nodeManager;
|
||||||
this.nodeCleaner = nodeCleaner;
|
this.nodeCleaner = nodeCleaner;
|
||||||
this.traversal = traversal;
|
this.traversal = traversal;
|
||||||
|
this.deferTranslucency = deferTranslucency;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Allows pipelines to configure model baking system
|
//Allows pipelines to configure model baking system
|
||||||
@@ -107,7 +110,9 @@ public abstract class AbstractRenderPipeline extends TrackedObject {
|
|||||||
|
|
||||||
this.postOpaquePreTranslucent(viewport);
|
this.postOpaquePreTranslucent(viewport);
|
||||||
|
|
||||||
rs.renderTranslucent(viewport);
|
if (!this.deferTranslucency) {
|
||||||
|
rs.renderTranslucent(viewport);
|
||||||
|
}
|
||||||
|
|
||||||
this.finish(viewport, sourceFrameBuffer, srcWidth, srcHeight);
|
this.finish(viewport, sourceFrameBuffer, srcWidth, srcHeight);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, sourceFrameBuffer);
|
glBindFramebuffer(GL_FRAMEBUFFER, sourceFrameBuffer);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class IrisVoxyRenderPipeline extends AbstractRenderPipeline {
|
|||||||
private final GlBuffer shaderUniforms;
|
private final GlBuffer shaderUniforms;
|
||||||
|
|
||||||
public IrisVoxyRenderPipeline(IrisVoxyRenderPipelineData data, AsyncNodeManager nodeManager, NodeCleaner nodeCleaner, HierarchicalOcclusionTraverser traversal, BooleanSupplier frexSupplier) {
|
public IrisVoxyRenderPipeline(IrisVoxyRenderPipelineData data, AsyncNodeManager nodeManager, NodeCleaner nodeCleaner, HierarchicalOcclusionTraverser traversal, BooleanSupplier frexSupplier) {
|
||||||
super(nodeManager, nodeCleaner, traversal, frexSupplier);
|
super(nodeManager, nodeCleaner, traversal, frexSupplier, data.shouldDeferTranslucency());
|
||||||
this.data = data;
|
this.data = data;
|
||||||
if (this.data.thePipeline != null) {
|
if (this.data.thePipeline != null) {
|
||||||
throw new IllegalStateException("Pipeline data already bound");
|
throw new IllegalStateException("Pipeline data already bound");
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class NormalRenderPipeline extends AbstractRenderPipeline {
|
|||||||
.compile();
|
.compile();
|
||||||
|
|
||||||
protected NormalRenderPipeline(AsyncNodeManager nodeManager, NodeCleaner nodeCleaner, HierarchicalOcclusionTraverser traversal, BooleanSupplier frexSupplier) {
|
protected NormalRenderPipeline(AsyncNodeManager nodeManager, NodeCleaner nodeCleaner, HierarchicalOcclusionTraverser traversal, BooleanSupplier frexSupplier) {
|
||||||
super(nodeManager, nodeCleaner, traversal, frexSupplier);
|
super(nodeManager, nodeCleaner, traversal, frexSupplier, false);
|
||||||
this.useEnvFog = VoxyConfig.CONFIG.useEnvironmentalFog;
|
this.useEnvFog = VoxyConfig.CONFIG.useEnvironmentalFog;
|
||||||
this.finalBlit = new FullscreenBlit("voxy:post/blit_texture_depth_cutout.frag",
|
this.finalBlit = new FullscreenBlit("voxy:post/blit_texture_depth_cutout.frag",
|
||||||
a->a.defineIf("USE_ENV_FOG", this.useEnvFog).define("EMIT_COLOUR"));
|
a->a.defineIf("USE_ENV_FOG", this.useEnvFog).define("EMIT_COLOUR"));
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ public class IrisShaderPatch {
|
|||||||
public static final boolean IMPERSONATE_DISTANT_HORIZONS = System.getProperty("voxy.impersonateDHShader", "false").equalsIgnoreCase("true");
|
public static final boolean IMPERSONATE_DISTANT_HORIZONS = System.getProperty("voxy.impersonateDHShader", "false").equalsIgnoreCase("true");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static final class SSBODeserializer implements JsonDeserializer<Int2ObjectOpenHashMap<String>> {
|
private static final class SSBODeserializer implements JsonDeserializer<Int2ObjectOpenHashMap<String>> {
|
||||||
@Override
|
@Override
|
||||||
public Int2ObjectOpenHashMap<String> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
public Int2ObjectOpenHashMap<String> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||||
@@ -176,6 +175,7 @@ public class IrisShaderPatch {
|
|||||||
public boolean excludeLodsFromVanillaDepth;
|
public boolean excludeLodsFromVanillaDepth;
|
||||||
public float[] renderScale;
|
public float[] renderScale;
|
||||||
public boolean useViewportDims;
|
public boolean useViewportDims;
|
||||||
|
//public boolean deferTranslucentRendering;
|
||||||
public String checkValid() {
|
public String checkValid() {
|
||||||
if (this.blending != null) {
|
if (this.blending != null) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -268,6 +268,10 @@ public class IrisShaderPatch {
|
|||||||
return new float[]{Math.max(0.01f,this.patchData.renderScale[0]),Math.max(0.01f,this.patchData.renderScale[1])};
|
return new float[]{Math.max(0.01f,this.patchData.renderScale[0]),Math.max(0.01f,this.patchData.renderScale[1])};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean deferedTranslucentRendering() {
|
||||||
|
return false;//this.patchData.deferTranslucentRendering;
|
||||||
|
}
|
||||||
|
|
||||||
public Runnable createBlendSetup() {
|
public Runnable createBlendSetup() {
|
||||||
if (this.patchData.blending == null || this.patchData.blending.isEmpty()) {
|
if (this.patchData.blending == null || this.patchData.blending.isEmpty()) {
|
||||||
return ()->{};//No blending change
|
return ()->{};//No blending change
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ public class IrisVoxyRenderPipelineData {
|
|||||||
public final float[] resolutionScale;
|
public final float[] resolutionScale;
|
||||||
public final String TAA;
|
public final String TAA;
|
||||||
public final boolean useViewportDims;
|
public final boolean useViewportDims;
|
||||||
|
public final boolean deferTranslucency;
|
||||||
|
|
||||||
private IrisVoxyRenderPipelineData(IrisShaderPatch patch, int[] opaqueDrawTargets, int[] translucentDrawTargets, StructLayout uniformSet, Runnable blendingSetup, ImageSet imageSet, SSBOSet ssboSet) {
|
private IrisVoxyRenderPipelineData(IrisShaderPatch patch, int[] opaqueDrawTargets, int[] translucentDrawTargets, StructLayout uniformSet, Runnable blendingSetup, ImageSet imageSet, SSBOSet ssboSet) {
|
||||||
this.opaqueDrawTargets = opaqueDrawTargets;
|
this.opaqueDrawTargets = opaqueDrawTargets;
|
||||||
@@ -65,6 +66,7 @@ public class IrisVoxyRenderPipelineData {
|
|||||||
this.TAA = patch.getTAAShift();
|
this.TAA = patch.getTAAShift();
|
||||||
this.resolutionScale = patch.getRenderScale();
|
this.resolutionScale = patch.getRenderScale();
|
||||||
this.useViewportDims = patch.useViewportDims();
|
this.useViewportDims = patch.useViewportDims();
|
||||||
|
this.deferTranslucency = patch.deferedTranslucentRendering();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SSBOSet getSsboSet() {
|
public SSBOSet getSsboSet() {
|
||||||
@@ -92,6 +94,7 @@ public class IrisVoxyRenderPipelineData {
|
|||||||
public static IrisVoxyRenderPipelineData buildPipeline(IrisRenderingPipeline ipipe, IrisShaderPatch patch, CustomUniforms cu, ShaderStorageBufferHolder ssboHolder) {
|
public static IrisVoxyRenderPipelineData buildPipeline(IrisRenderingPipeline ipipe, IrisShaderPatch patch, CustomUniforms cu, ShaderStorageBufferHolder ssboHolder) {
|
||||||
var uniforms = createUniformLayoutStructAndUpdater(createUniformSet(cu, patch));
|
var uniforms = createUniformLayoutStructAndUpdater(createUniformSet(cu, patch));
|
||||||
|
|
||||||
|
|
||||||
var imageSet = createImageSet(ipipe, patch);
|
var imageSet = createImageSet(ipipe, patch);
|
||||||
|
|
||||||
var ssboSet = createSSBOLayouts(patch.getSSBOs(), ssboHolder);
|
var ssboSet = createSSBOLayouts(patch.getSSBOs(), ssboHolder);
|
||||||
@@ -130,6 +133,11 @@ public class IrisVoxyRenderPipelineData {
|
|||||||
case VEC4I -> "ivec4";
|
case VEC4I -> "ivec4";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean shouldDeferTranslucency() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public record StructLayout(int size, String layout, LongConsumer updater) {}
|
public record StructLayout(int size, String layout, LongConsumer updater) {}
|
||||||
private static StructLayout createUniformLayoutStructAndUpdater(List<UniformWritingHolder> uniforms) {
|
private static StructLayout createUniformLayoutStructAndUpdater(List<UniformWritingHolder> uniforms) {
|
||||||
if (uniforms.size() == 0) {
|
if (uniforms.size() == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user