[rlsw] Review depth formats and fix depth writing#5317
Merged
Conversation
Contributor
Author
|
After some more testing, the results are mixed about 32-bit format. I found it strange that the 32-bit format was slower, but it seems to vary depending on the example, sometimes it's very slightly slower or basically identical, but in the Well, it would probably need more specific profiling. |
Owner
|
@Bigfoot71 thanks for the review! Definitely the 8-bit depth buffer use is very limited. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I reviewed the depth formats and removed the 8-bit one. It could have been marginally useful for orthographic projection, but without heavier adjustments it would never really be practical.
I also added a 32-bit floating-point depth format, which avoids conversions, though after testing it turned out to be slightly slower than 16-bit with conversion. So 16-bit remains the default.
I also added saturation when writing depth values, since in some cases, when the camera was very close to a clipped triangle, the depth value could exceed the limit and cause an overflow.
This might require reviewing some details in the clipping, I find it strange at first glance...
This issue seems to mention the related UB problem: #5309
I compiled in debug mode with UBSan and ran several examples, didn't notice any issues on my side with this update.
The 24-bit format has also been quickly reviewed and tested, everything seems perfect!