1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-06 17:41:04 +00:00

Get rid of depth buffer workaround in the render pipeline code (#15407)

I originally wanted to get of the legacy IVideoDriver::setRenderTarget altogether,
but that ended up being too much work.
The remaining usage is in "dynamicshadowsrender.cpp".

Here's a comment I wrote about the workaround:

----------------------------------------

Use legacy call when there's single texture without depth texture
This means Irrlicht creates a depth texture for us and binds it to the FBO

This is currently necessary 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, can't test since it's broken)
  (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.

This workaround was added in 1e96403954 /
https://irc.minetest.net/minetest-dev/2022-10-04#i_6021940

This workaround should be replaced by explicitly configuring depth
textures where needed.

----------------------------------------
This commit is contained in:
grorp 2024-11-15 11:38:56 +01:00 committed by GitHub
parent d4378a74d3
commit a9fe83126a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 54 additions and 27 deletions

View file

@ -35,6 +35,13 @@ void InitInterlacedMaskStep::run(PipelineContext &context)
void populateInterlacedPipeline(RenderPipeline *pipeline, Client *client)
{
// FIXME: "3d_mode = interlaced" is currently broken. Two options:
// 1. Remove it
// 2. Fix it
// If you fix it, make sure to test it with "enable_post_processing = false".
// You'll probably have to add a depth texture to make that combination work.
// Also, this code should probably use selectColorFormat/selectDepthFormat.
static const u8 TEXTURE_LEFT = 0;
static const u8 TEXTURE_RIGHT = 1;
static const u8 TEXTURE_MASK = 2;