Texture format support varies depending on driver, hardware, and usage
flags. In general, you should use SDL_GPUTextureSupportsFormat to query if
a format is supported before using it. However, there are a few guaranteed
formats.
FIXME: Check universal support for 32-bit component formats FIXME: Check
universal support for SIMULTANEOUS_READ_WRITE
For SAMPLER usage, the following formats are universally supported:
Specifies the pixel format of a texture.
Texture format support varies depending on driver, hardware, and usage flags. In general, you should use SDL_GPUTextureSupportsFormat to query if a format is supported before using it. However, there are a few guaranteed formats.
FIXME: Check universal support for 32-bit component formats FIXME: Check universal support for SIMULTANEOUS_READ_WRITE
For SAMPLER usage, the following formats are universally supported:
- R8G8B8A8_UNORM - B8G8R8A8_UNORM - R8_UNORM - R8_SNORM - R8G8_UNORM - R8G8_SNORM - R8G8B8A8_SNORM - R16_FLOAT - R16G16_FLOAT - R16G16B16A16_FLOAT - R32_FLOAT - R32G32_FLOAT - R32G32B32A32_FLOAT - R11G11B10_UFLOAT - R8G8B8A8_UNORM_SRGB - B8G8R8A8_UNORM_SRGB - D16_UNORM
For COLOR_TARGET usage, the following formats are universally supported:
- R8G8B8A8_UNORM - B8G8R8A8_UNORM - R8_UNORM - R16_FLOAT - R16G16_FLOAT - R16G16B16A16_FLOAT - R32_FLOAT - R32G32_FLOAT - R32G32B32A32_FLOAT - R8_UINT - R8G8_UINT - R8G8B8A8_UINT - R16_UINT - R16G16_UINT - R16G16B16A16_UINT - R8_INT - R8G8_INT - R8G8B8A8_INT - R16_INT - R16G16_INT - R16G16B16A16_INT - R8G8B8A8_UNORM_SRGB - B8G8R8A8_UNORM_SRGB
For STORAGE usages, the following formats are universally supported:
- R8G8B8A8_UNORM - R8G8B8A8_SNORM - R16G16B16A16_FLOAT - R32_FLOAT - R32G32_FLOAT - R32G32B32A32_FLOAT - R8G8B8A8_UINT - R16G16B16A16_UINT - R8G8B8A8_INT - R16G16B16A16_INT
For DEPTH_STENCIL_TARGET usage, the following formats are universally supported:
- D16_UNORM - Either (but not necessarily both!) D24_UNORM or D32_FLOAT - Either (but not necessarily both!) D24_UNORM_S8_UINT or D32_FLOAT_S8_UINT
Unless D16_UNORM is sufficient for your purposes, always check which of D24/D32 is supported before creating a depth-stencil texture!