-
Notifications
You must be signed in to change notification settings - Fork 62
Copy depth texture to avoid texture feedback loops #1814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Merging this for the release. |
Depends on #1813.
Implement a code path for sampling
u_DepthMap
in 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-pit
I 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 2
from this PR fixes those artifacts for me.Things to do:
r_depthShaders
(incompatible debug cvar) is disabled