-
Notifications
You must be signed in to change notification settings - Fork 622
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
Readback Vulkan fixes #1430
base: main
Are you sure you want to change the base?
Readback Vulkan fixes #1430
Conversation
can I have a compiled build to test it |
https://github.com/cemu-project/Cemu/actions/runs/12012239663/artifacts/2238726253 |
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.
I did tell you on discord that most readback formats follow the same pattern, but you happened to pick the formats that need specialized handling. Apologizes for putting you on the wrong track
@@ -79,6 +79,16 @@ uint32 LatteTextureReadbackInfoVk::GetImageSize(LatteTextureView* textureView) | |||
// todo - if driver does not support VK_FORMAT_D24_UNORM_S8_UINT this is represented as VK_FORMAT_D32_SFLOAT_S8_UINT which is 8 bytes | |||
return baseTexture->width * baseTexture->height * 4; | |||
} | |||
else if (textureView->format == Latte::E_GX2SURFFMT::R5_G6_B5_UNORM ) | |||
{ | |||
cemu_assert(textureFormat == VK_FORMAT_R8G8B8A8_UNORM); |
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.
Latte::E_GX2SURFFMT::R5_G6_B5_UNORM
is a bit tricky, because it can be emulated as either VK_FORMAT_R5G6B5_UNORM_PACK16
or if that is not supported by the driver the Vulkan backend will fallback to VK_FORMAT_R8G8B8A8_UNORM
. See the code here. The readback code needs to handle this correctly. For non-matching formats conversion is necessary. If you want to keep it simple you could ignore the more complicated case and return 0 when textureFormat != VK_FORMAT_R5G6B5_UNORM_PACK16
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.
Hopefully things are ok now.
cemu_assert(textureFormat == VK_FORMAT_R8G8B8A8_UNORM); | ||
return baseTexture->width * baseTexture->height * 4; | ||
} | ||
else if (textureView->format == Latte::E_GX2SURFFMT::R5_G5_B5_A1_UNORM ) |
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.
For R5_G5_B5_A1_UNORM
conversion is always necessary since the backend doesn't use Vulkan formats that are bit-compatible. See code here. Maybe just drop this case for now?
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.
Removed
Latte::E_GX2SURFFMT::R5_G6_B5_UNORM is 2 bytes per texel Co-authored-by: Exzap <[email protected]>
Can I have a test build? It has still not been approved to test the fix. |
https://github.com/cemu-project/Cemu/actions/runs/12012239663/artifacts/2238726253 Does this work for you? |
I tested all of them except The Legend of Zelda: Phantom Hourglass seems version 2.4 has a regression meaning their graphical corruption and uses 5gb whereas 2.3 uses half of that. seems to happen on both DS games I tested so may affect all the DS games. So can't test the pr to see if it works. tested Harvest Moon 64 and seemed to render the same but didn't check the log for any difference if it still got hit or issue unrelated. |
Tentative fixes, i could not verify as i don't own the games, for #1296 and #1305 .
Can you please test @Triticum0