Copy depth texture to avoid texture feedback loops#1814
Copy depth texture to avoid texture feedback loops#1814illwieckz merged 2 commits intoDaemonEngine:masterfrom
Conversation
Depth and stencil buffers are always implemented as part of one render target. |
Since it's about to be used more times. I named it like PrepareForSamplingDepthMap instead of something about texture barrier, because I may want to add more stuff in for DaemonEngine#1814 where there is the possibility to use a copy of the depth texture instead. Also attempt to track depth buffer dirtiness with material system.
Since it's about to be used more times. I named it like PrepareForSamplingDepthMap instead of something about texture barrier, because I may want to add more stuff in for DaemonEngine#1814 where there is the possibility to use a copy of the depth texture instead. Also, always mark depth buffer dirtiness with material system.
Since it's about to be used more times. I named it like PrepareForSamplingDepthMap instead of something about texture barrier, because I may want to add more stuff in for #1814 where there is the possibility to use a copy of the depth texture instead. Also, always mark depth buffer dirtiness with material system.
5473f57 to
8d943fa
Compare
If the texture barrier GL extension is enabled, make a read-only copy of the depth buffer to use for u_DepthMap sampling, thereby avoiding texture feedback loops in another way. Configurable by setting r_readonlyDepthBuffer 0 (skip the copy even if there is no texture barrier - useful for low-performance systems) or r_readonlyDepthBuffer 2 (always make the copy - useful for testing that code path). Fixes DaemonEngine#1783 (broken depth fade on Apple Silicon).
|
This is ready. On my worst GPU, the Intel UHD 630, I registered about a 10% performance drop (53 -> 48 FPS). So we definitely want to disable it in low presets. |
|
On an ATI X550 I only seen a 1 fps difference, so I guess it depends on the driver. I'll add the cvar to the presets indeed. |
|
This GPU can have texture barrier according to reports. So make sure your comparison is between |
|
See Unvanquished/Unvanquished#3430 for the game presets/ui menu: Now that I think about it, it's probably better to do instead:
Not only because
I felt it was better for the UI where we make the effort to put the “best” at the top. |
Same missing 1 fps when forcing the read only as well. |
2 is mostly intended for debugging, so in the UI I would put a checkbox which would work well with the current 0/1 values. |
|
OK, it makes sense that way then. I updated my PR to use a checkbox instead. |
|
Merging this for the release. |
Depends on #1813.
Implement a code path for sampling
u_DepthMapin shaders from a separate copy of the depth texture, instead of the same one that is attached to the rendering FBO. By default, this will be enabled if the driver does not implementTextureBarrier, in order to prevent texture feedback loops. Behavior is controlled byr_copyDepthBuffer. This is meant to fix #1783. Seems to work on my Mac system.Also I keep having some issues with SSAO + bindless textures on a Mesa + AMD setup. In a game with map
survival-pitI got the SSAO artifacts as shown below. (Same ones I used to get with dummygame. I still got those even after #1731 which I though would fix them but didn't, but they may have gone away after a Mesa update.) I can't reproduce the artifacts in a local game but if I play a demo recorded from an online game, I get the artifacts the whole time. Anywayset r_copyDepthBuffer 2from this PR fixes those artifacts for me.Things to do:
r_depthShaders(incompatible debug cvar) is disabled