-
Notifications
You must be signed in to change notification settings - Fork 2k
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
GPU: Add integer color target clears #11347
base: main
Are you sure you want to change the base?
Conversation
This is a dumb question, but do we need this? Is there a reason an app can't just convert 4 ints to floats before clearing? |
This would work for Metal and Vulkan (with some bitcasting to preserve the integer bit pattern), but not for D3D. The reason is that you can have integer texture formats with more bits than can be precisely represented by a float. E.g. if you have an R32_INT texture and you want to clear it to a value of Though, as the OP notes, this PR does not include the D3D shaders for clearing. @rabbit-ecl Could you write those up and provide a test program with integer texture clears in action? You can PR the test case to the SDL_gpu_examples repo. |
I'm still skeptical this is worth adding for high-precision clearing, but if y'all think it's worth it I won't stand in the way. |
I'm also presently of the opinion that this is not really worth it. |
Yeah I'll look into it and we can always drop it if it ends up being too hacky. I think most of the hard work here has already been done for the blit emulation paths. |
Adds proper clearing of integer color formats using a Vulkan-like SDL_GPUClearColor union in place of SDL_FColor.
D3D backends will still need a shader path to support the full range of R32_UINT / R32_INT formats.
Also added 32-bit integer formats missing from some
SDL_sysgpu.h
helper functions.Existing Issue(s)
#11343