You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clearing of integer color targets is currently underspecified in SDL_GPU and has diverging behavior between backends.
D3D will take float and convert it to the closest representable integer for clearing, this means that some 32-bit integer values can't be represented!
Metal does the same, but uses double instead and thus should be able to represent all 32-bit integer values.
Vulkan will currently just bitcast the floats.
Clearing an R8_UINT with r=255.0 will result in integer 255 on Metal and D3D, but bitcasted garbage on Vulkan.
Somewhat relevant from WebGPU: gpuweb/gpuweb#1085gpuweb/gpuweb#965
WebGPU chose to mandate full 32-bit clears and implementations have to emulate the out-of-range clears on D3D.
The text was updated successfully, but these errors were encountered:
We should document this workaround for GPU as well.
As in user code or backend? Vulkan/Metal can support this for all values (32-bit ones anyway) but D3D would need a shader path for values >2**24. There's some precedence for this already in SDL_GPU's emulated blits.
I think we might want to replace SDL_FColor clear_color with a union or go the Metal way and use SDL_DColor (which currently doesn't exist).
Clearing of integer color targets is currently underspecified in SDL_GPU and has diverging behavior between backends.
D3D will take
float
and convert it to the closest representable integer for clearing, this means that some 32-bit integer values can't be represented!Metal does the same, but uses
double
instead and thus should be able to represent all 32-bit integer values.Vulkan will currently just bitcast the floats.
Clearing an
R8_UINT
withr=255.0
will result in integer 255 on Metal and D3D, but bitcasted garbage on Vulkan.Somewhat relevant from WebGPU: gpuweb/gpuweb#1085 gpuweb/gpuweb#965
WebGPU chose to mandate full 32-bit clears and implementations have to emulate the out-of-range clears on D3D.
The text was updated successfully, but these errors were encountered: