attempted fix for incorrect sampling of depth buffer stuffs
This commit is contained in:
@@ -53,6 +53,11 @@ public abstract class AbstractRenderPipeline extends TrackedObject {
|
|||||||
private final FullscreenBlit depthMaskBlit = new FullscreenBlit("voxy:post/fullscreen2.vert", "voxy:post/noop.frag");
|
private final FullscreenBlit depthMaskBlit = new FullscreenBlit("voxy:post/fullscreen2.vert", "voxy:post/noop.frag");
|
||||||
private final FullscreenBlit depthSetBlit = new FullscreenBlit("voxy:post/fullscreen2.vert", "voxy:post/depth0.frag");
|
private final FullscreenBlit depthSetBlit = new FullscreenBlit("voxy:post/fullscreen2.vert", "voxy:post/depth0.frag");
|
||||||
private final FullscreenBlit depthCopy = new FullscreenBlit("voxy:post/fullscreen2.vert", "voxy:post/depth_copy.frag");
|
private final FullscreenBlit depthCopy = new FullscreenBlit("voxy:post/fullscreen2.vert", "voxy:post/depth_copy.frag");
|
||||||
|
private static final int DEPTH_SAMPLER = glGenSamplers();
|
||||||
|
static {
|
||||||
|
glSamplerParameteri(DEPTH_SAMPLER, GL_TEXTURE_MAG_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) {
|
||||||
this.frexStillHasWork = frexSupplier;
|
this.frexStillHasWork = frexSupplier;
|
||||||
@@ -109,9 +114,11 @@ public abstract class AbstractRenderPipeline extends TrackedObject {
|
|||||||
// the mismatched formats in this case is the d32 to d24s8
|
// the mismatched formats in this case is the d32 to d24s8
|
||||||
glBindFramebuffer(GL30.GL_FRAMEBUFFER, targetFb);
|
glBindFramebuffer(GL30.GL_FRAMEBUFFER, targetFb);
|
||||||
|
|
||||||
|
this.depthCopy.bind();
|
||||||
int depthTexture = glGetNamedFramebufferAttachmentParameteri(sourceFrameBuffer, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
int depthTexture = glGetNamedFramebufferAttachmentParameteri(sourceFrameBuffer, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||||
glBindTextureUnit(0, depthTexture);
|
glBindTextureUnit(0, depthTexture);
|
||||||
|
glBindSampler(0, DEPTH_SAMPLER);
|
||||||
|
glUniform2f(1,((float)width)/srcWidth, ((float)height)/srcHeight);
|
||||||
glColorMask(false,false,false,false);
|
glColorMask(false,false,false,false);
|
||||||
this.depthCopy.blit();
|
this.depthCopy.blit();
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ public class IrisVoxyRenderPipeline extends AbstractRenderPipeline {
|
|||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.data.useViewportDims) {
|
if (!this.data.useViewportDims) {
|
||||||
srcWidth = viewport.width;
|
srcWidth = viewport.width;
|
||||||
srcHeight = viewport.height;
|
srcHeight = viewport.height;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#version 330 core
|
#version 330 core
|
||||||
|
|
||||||
layout(binding = 0) uniform sampler2D depthTex;
|
layout(binding = 0) uniform sampler2D depthTex;
|
||||||
|
layout(location = 1) uniform vec2 scaleFactor;
|
||||||
|
|
||||||
in vec2 UV;
|
in vec2 UV;
|
||||||
void main() {
|
void main() {
|
||||||
gl_FragDepth = texture(depthTex, UV).r;
|
gl_FragDepth = texture(depthTex, UV*scaleFactor).r;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user