Skip to content

Commit

Permalink
GPU: 32-bit component texture formats
Browse files Browse the repository at this point in the history
  • Loading branch information
thatcosmonaut committed Sep 27, 2024
1 parent 769ff47 commit 14e0acb
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/SDL3/SDL_gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ typedef enum SDL_GPUIndexElementSize
* 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
Expand Down Expand Up @@ -435,13 +438,19 @@ typedef enum SDL_GPUTextureFormat
SDL_GPU_TEXTUREFORMAT_R16_UINT,
SDL_GPU_TEXTUREFORMAT_R16G16_UINT,
SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT,
SDL_GPU_TEXTUREFORMAT_R32_UINT,
SDL_GPU_TEXTUREFORMAT_R32G32_UINT,
SDL_GPU_TEXTUREFORMAT_R32G32B32A32_UINT,
/* Signed Integer Color Formats */
SDL_GPU_TEXTUREFORMAT_R8_INT,
SDL_GPU_TEXTUREFORMAT_R8G8_INT,
SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT,
SDL_GPU_TEXTUREFORMAT_R16_INT,
SDL_GPU_TEXTUREFORMAT_R16G16_INT,
SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT,
SDL_GPU_TEXTUREFORMAT_R32_INT,
SDL_GPU_TEXTUREFORMAT_R32G32_INT,
SDL_GPU_TEXTUREFORMAT_R32G32B32A32_INT,
/* SRGB Unsigned Normalized Color Formats */
SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB,
SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB,
Expand Down
6 changes: 6 additions & 0 deletions src/gpu/d3d11/SDL_gpu_d3d11.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,18 @@ static DXGI_FORMAT SDLToD3D11_TextureFormat[] = {
DXGI_FORMAT_R16_UINT, // R16_UINT
DXGI_FORMAT_R16G16_UINT, // R16G16_UINT
DXGI_FORMAT_R16G16B16A16_UINT, // R16G16B16A16_UINT
DXGI_FORMAT_R32_UINT, // R32_UINT
DXGI_FORMAT_R32G32_UINT, // R32G32_UINT
DXGI_FORMAT_R32G32B32A32_UINT, // R32G32B32A32_UINT
DXGI_FORMAT_R8_SINT, // R8_INT
DXGI_FORMAT_R8G8_SINT, // R8G8_INT
DXGI_FORMAT_R8G8B8A8_SINT, // R8G8B8A8_INT
DXGI_FORMAT_R16_SINT, // R16_INT
DXGI_FORMAT_R16G16_SINT, // R16G16_INT
DXGI_FORMAT_R16G16B16A16_SINT, // R16G16B16A16_INT
DXGI_FORMAT_R32_SINT, // R32_INT
DXGI_FORMAT_R32G32_SINT, // R32G32_INT
DXGI_FORMAT_R32G32B32A32_SINT, // R32G32B32A32_INT
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, // R8G8B8A8_UNORM_SRGB
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, // B8G8R8A8_UNORM_SRGB
DXGI_FORMAT_BC1_UNORM_SRGB, // BC1_UNORM_SRGB
Expand Down
6 changes: 6 additions & 0 deletions src/gpu/d3d12/SDL_gpu_d3d12.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,18 @@ static DXGI_FORMAT SDLToD3D12_TextureFormat[] = {
DXGI_FORMAT_R16_UINT, // R16_UINT
DXGI_FORMAT_R16G16_UINT, // R16G16_UINT
DXGI_FORMAT_R16G16B16A16_UINT, // R16G16B16A16_UINT
DXGI_FORMAT_R32_UINT, // R32_UINT
DXGI_FORMAT_R32G32_UINT, // R32G32_UINT
DXGI_FORMAT_R32G32B32A32_UINT, // R32G32B32A32_UINT
DXGI_FORMAT_R8_SINT, // R8_INT
DXGI_FORMAT_R8G8_SINT, // R8G8_INT
DXGI_FORMAT_R8G8B8A8_SINT, // R8G8B8A8_INT
DXGI_FORMAT_R16_SINT, // R16_INT
DXGI_FORMAT_R16G16_SINT, // R16G16_INT
DXGI_FORMAT_R16G16B16A16_SINT, // R16G16B16A16_INT
DXGI_FORMAT_R32_SINT, // R32_INT
DXGI_FORMAT_R32G32_SINT, // R32G32_INT
DXGI_FORMAT_R32G32B32A32_SINT, // R32G32B32A32_INT
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, // R8G8B8A8_UNORM_SRGB
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, // B8G8R8A8_UNORM_SRGB
DXGI_FORMAT_BC1_UNORM_SRGB, // BC1_UNORM_SRGB
Expand Down
6 changes: 6 additions & 0 deletions src/gpu/metal/SDL_gpu_metal.m
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,18 @@ static void METAL_ReleaseWindow(
MTLPixelFormatR16Uint, // R16_UINT
MTLPixelFormatRG16Uint, // R16G16_UINT
MTLPixelFormatRGBA16Uint, // R16G16B16A16_UINT
MTLPixelFormatR32Uint, // R32_UINT
MTLPixelFormatRG32Uint, // R32G32_UINT
MTLPixelFormatRGBA32Uint, // R32G32B32A32_UINT
MTLPixelFormatR8Sint, // R8_UINT
MTLPixelFormatRG8Sint, // R8G8_UINT
MTLPixelFormatRGBA8Sint, // R8G8B8A8_UINT
MTLPixelFormatR16Sint, // R16_UINT
MTLPixelFormatRG16Sint, // R16G16_UINT
MTLPixelFormatRGBA16Sint, // R16G16B16A16_UINT
MTLPixelFormatR32Sint, // R32_INT
MTLPixelFormatRG32Sint, // R32G32_INT
MTLPixelFormatRGBA32Sint, // R32G32B32A32_INT
MTLPixelFormatRGBA8Unorm_sRGB, // R8G8B8A8_UNORM_SRGB
MTLPixelFormatBGRA8Unorm_sRGB, // B8G8R8A8_UNORM_SRGB
#ifdef SDL_PLATFORM_MACOS
Expand Down
6 changes: 6 additions & 0 deletions src/gpu/vulkan/SDL_gpu_vulkan.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,18 @@ static VkFormat SDLToVK_TextureFormat[] = {
VK_FORMAT_R16_UINT, // R16_UINT
VK_FORMAT_R16G16_UINT, // R16G16_UINT
VK_FORMAT_R16G16B16A16_UINT, // R16G16B16A16_UINT
VK_FORMAT_R32_UINT, // R32_UINT
VK_FORMAT_R32G32_UINT, // R32G32_UINT
VK_FORMAT_R32G32B32A32_UINT, // R32G32B32A32_UINT
VK_FORMAT_R8_SINT, // R8_INT
VK_FORMAT_R8G8_SINT, // R8G8_INT
VK_FORMAT_R8G8B8A8_SINT, // R8G8B8A8_INT
VK_FORMAT_R16_SINT, // R16_INT
VK_FORMAT_R16G16_SINT, // R16G16_INT
VK_FORMAT_R16G16B16A16_SINT, // R16G16B16A16_INT
VK_FORMAT_R32_SINT, // R32_INT
VK_FORMAT_R32G32_SINT, // R32G32_INT
VK_FORMAT_R32G32B32A32_SINT, // R32G32B32A32_INT
VK_FORMAT_R8G8B8A8_SRGB, // R8G8B8A8_UNORM_SRGB
VK_FORMAT_B8G8R8A8_SRGB, // B8G8R8A8_UNORM_SRGB
VK_FORMAT_BC1_RGBA_SRGB_BLOCK, // BC1_UNORM_SRGB
Expand Down

0 comments on commit 14e0acb

Please sign in to comment.