diff --git a/src/client/render/pipeline.cpp b/src/client/render/pipeline.cpp index 5558d05b0dcd7..8cc9672aaf897 100644 --- a/src/client/render/pipeline.cpp +++ b/src/client/render/pipeline.cpp @@ -179,6 +179,23 @@ void TextureBufferOutput::activate(PipelineContext &context) // Use legacy call when there's single texture without depth texture // This binds default depth buffer to the FBO + + // This is currently neccessary for a working depth buffer in the following cases: + // - post-processing disabled, undersampling enabled + // (addUpscaling specifies no depth texture) + // - post-processing disabled, 3d_mode = sidebyside / topbottom / crossview + // (populateSideBySidePipeline specifies no depth texture) + // - post-processing disabled, 3d_mode = interlaced (probably) + // (populateInterlacedPipeline specifies no depth texture) + // With post-processing disabled, the world is rendered to the TextureBufferOutput + // created in the functions listed above, so a depth buffer is needed + // (-> this workaround is needed). + // With post-processing enabled, only a fullscreen rectangle is rendered to + // this TextureBufferOutput, so a depth buffer isn't actually needed. + // But: These pipeline steps shouldn't rely on what ends up being rendered to + // the TextureBufferOutput they provide, since that may change. + // https://irc.minetest.net/minetest-dev/2022-10-04#i_6021940 + if (textures.size() == 1 && depth_stencil == NO_DEPTH_TEXTURE) { driver->setRenderTarget(textures[0], m_clear, m_clear, context.clear_color); return;