Skip to content
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

Add support for reading depth buffers to the PackFramebufferSync function #15924

Merged
merged 2 commits into from
Aug 30, 2022

Conversation

hrydgard
Copy link
Owner

Also adds D16 conversion code (though, could probably get away with just creating a 16-bit depth buffer on the GPU and blit to it, where depth blit is available).

Not yet used, just getting it in separately.

Part of work on #15923 .

…tion.

Also adds D16 conversion code (though, could probably get away with just
creating a 16-bit depth buffer on the GPU and blit to it, where depth
blit is available).

Not yet used, just getting it in separately.
@hrydgard hrydgard added GE emulation Backend-independent GPU issues Code Cleanup Cleanup to make future work easier. Needs to be done sometimes. labels Aug 29, 2022
@hrydgard hrydgard added this to the v1.14.0 milestone Aug 29, 2022
GPU/Common/FramebufferManagerCommon.cpp Outdated Show resolved Hide resolved
GPU/Common/FramebufferManagerCommon.cpp Outdated Show resolved Hide resolved
} else {
for (uint32_t y = 0; y < height; ++y) {
for (uint32_t x = 0; x < width; ++x) {
dst16[x] = (uint16_t)(src32[x] * 65535.0f);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't be a correct conversion for our purposes, though? I thought I wrote some logic in... I guess it was #11676?

Under some versions of our depth support, we intentionally use 1/4 of the range (in the middle) for the actual depth values, where the rest is meant to be clamped. This reduces the bugs from not having depth clamp. If we have depth clamp, I think we use the full range, though.

We need to account for that somewhere (maybe not in thin3d, not sure) for 24 or 32 bit depth buffers.

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's right. I'll leave a TODO for now, since I might indeed try to address this elsewhere. This'll work when we don't reduce the range which is most of the time on Vulkan, for example.

@hrydgard hrydgard merged commit 30dc831 into master Aug 30, 2022
@hrydgard hrydgard deleted the prepare-depth-readback branch August 30, 2022 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Cleanup Cleanup to make future work easier. Needs to be done sometimes. GE emulation Backend-independent GPU issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants