Skip to content

Commit 91c9652

Browse files
committed
allow renderToVanillaDepth to work with non exact size (forces the rendering into bottom left corner) when useViewportDims is enabled (TODO: why are we only doing this when useViewportDims is true? (in theory we should _always_ do it if renderToVanillaDepth is true (just dont fiddle the viewport)))
1 parent 9d355aa commit 91c9652

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

src/main/java/me/cortex/voxy/client/core/IrisVoxyRenderPipeline.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,20 @@ protected void postOpaquePreTranslucent(Viewport<?> viewport, int sourceDepthTex
168168

169169
@Override
170170
protected void finish(Viewport<?> viewport, int sourceDepthTexture, int outputFramebuffer, int srcWidth, int srcHeight) {
171-
if (this.data.renderToVanillaDepth && srcWidth == viewport.width && srcHeight == viewport.height) {//We can only depthblit out if destination size is the same
172-
glColorMask(false, false, false, false);
173-
AbstractRenderPipeline.transformBlitDepth(this.depthBlit,
174-
this.fbTranslucent.getDepthTex().id, outputFramebuffer,
175-
viewport, new Matrix4f(viewport.vanillaProjection).mul(viewport.modelView));
176-
glColorMask(true, true, true, true);
171+
if (this.data.renderToVanillaDepth) {
172+
//We can only depthblit out if destination size is the same, if they arnt, force them tobe
173+
boolean mustFiddledViewport = srcWidth != viewport.width || srcHeight != viewport.height;
174+
if (this.data.useViewportDims||!mustFiddledViewport) {
175+
glColorMask(false, false, false, false);
176+
if (mustFiddledViewport)
177+
glViewport(0, 0, viewport.width, viewport.height);
178+
AbstractRenderPipeline.transformBlitDepth(this.depthBlit,
179+
this.fbTranslucent.getDepthTex().id, outputFramebuffer,
180+
viewport, new Matrix4f(viewport.vanillaProjection).mul(viewport.modelView));
181+
if (mustFiddledViewport)
182+
glViewport(0, 0, srcWidth, srcHeight);
183+
glColorMask(true, true, true, true);
184+
}
177185
} else {
178186
// normally disabled by AbstractRenderPipeline but since we are skipping it we do it here
179187
glDisable(GL_STENCIL_TEST);

0 commit comments

Comments
 (0)