Added SDL_GetPixelFormatFromGPUTextureFormat() and SDL_GetGPUTextureFormatFromPixelFormat()

Fixes https://github.com/libsdl-org/SDL/issues/13899
This commit is contained in:
Sam Lantinga
2025-09-07 21:15:51 -07:00
parent d3a6be9607
commit 035eed351c
6 changed files with 93 additions and 59 deletions

View File

@@ -4429,6 +4429,26 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_CalculateGPUTextureFormatSize(
Uint32 height,
Uint32 depth_or_layer_count);
/**
* Get the SDL pixel format corresponding to a GPU texture format.
*
* \param format a texture format.
* \returns the corresponding pixel format, or SDL_PIXELFORMAT_UNKNOWN if there is no corresponding pixel format.
*
* \since This function is available since SDL 3.4.0.
*/
extern SDL_DECLSPEC SDL_PixelFormat SDLCALL SDL_GetPixelFormatFromGPUTextureFormat(SDL_GPUTextureFormat format);
/**
* Get the GPU texture format corresponding to an SDL pixel format.
*
* \param format a pixel format.
* \returns the corresponding GPU texture format, or SDL_GPU_TEXTUREFORMAT_INVALID if there is no corresponding GPU texture format.
*
* \since This function is available since SDL 3.4.0.
*/
extern SDL_DECLSPEC SDL_GPUTextureFormat SDLCALL SDL_GetGPUTextureFormatFromPixelFormat(SDL_PixelFormat format);
#ifdef SDL_PLATFORM_GDK
/**