Skip to content

Commit

Permalink
Document a workaround in the render pipeline code
Browse files Browse the repository at this point in the history
I originally wanted to get of the legacy IVideoDriver::setRenderTarget and this
workaround altogether, but that ended up being too much work.
Instead I'm documenting my findings so they're not wasted.
  • Loading branch information
grorp committed Nov 8, 2024
1 parent b406709 commit 37b1a3e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/client/render/pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 37b1a3e

Please sign in to comment.