mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-30 00:17:40 +00:00
GPU: Add SDL_CalculateGPUTextureFormatSize (#11146)
--------- Co-authored-by: Sam Lantinga <slouken@libsdl.org>
This commit is contained in:
parent
6d85127560
commit
6ea4a66451
7 changed files with 34 additions and 13 deletions
|
@ -2796,3 +2796,16 @@ void SDL_ReleaseGPUFence(
|
|||
device->driverData,
|
||||
fence);
|
||||
}
|
||||
|
||||
Uint32 SDL_CalculateGPUTextureFormatSize(
|
||||
SDL_GPUTextureFormat format,
|
||||
Uint32 width,
|
||||
Uint32 height,
|
||||
Uint32 depth_or_layer_count)
|
||||
{
|
||||
Uint32 blockWidth = Texture_GetBlockWidth(format);
|
||||
Uint32 blockHeight = Texture_GetBlockHeight(format);
|
||||
Uint32 blocksPerRow = (width + blockWidth - 1) / blockWidth;
|
||||
Uint32 blocksPerColumn = (height + blockHeight - 1) / blockHeight;
|
||||
return depth_or_layer_count * blocksPerRow * blocksPerColumn * SDL_GPUTextureFormatTexelBlockSize(format);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue