mirror of
https://github.com/microsoft/DirectXTex.git
synced 2025-07-09 11:40:14 +02:00
Adds BytesPerBlock helper (#516)
Some checks are pending
CodeQL / Analyze (C/C++) (push) Waiting to run
CMake (Windows) / build (amd64, x64-Debug, windows-2019) (push) Waiting to run
CMake (Windows) / build (amd64, x64-Debug, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64, x64-Debug-Clang, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64, x64-Release, windows-2019) (push) Waiting to run
CMake (Windows) / build (amd64, x64-Release, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64, x64-Release-Clang, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64_arm64, arm64-Debug, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64_arm64, arm64-Release, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64_arm64, arm64ec-Debug, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64_arm64, arm64ec-Release, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64_x86, x86-Debug, windows-2019) (push) Waiting to run
CMake (Windows) / build (amd64_x86, x86-Debug, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64_x86, x86-Debug-Clang, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64_x86, x86-Release, windows-2019) (push) Waiting to run
CMake (Windows) / build (amd64_x86, x86-Release, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64_x86, x86-Release-Clang, windows-2022) (push) Waiting to run
MSBuild / build (Debug, ARM64, 2019) (push) Waiting to run
MSBuild / build (Debug, ARM64, 2022) (push) Waiting to run
MSBuild / build (Debug, x64, 2019) (push) Waiting to run
MSBuild / build (Debug, x64, 2022) (push) Waiting to run
MSBuild / build (Debug, x86, 2019) (push) Waiting to run
MSBuild / build (Debug, x86, 2022) (push) Waiting to run
MSBuild / build (Release, ARM64, 2019) (push) Waiting to run
MSBuild / build (Release, ARM64, 2022) (push) Waiting to run
MSBuild / build (Release, x64, 2019) (push) Waiting to run
MSBuild / build (Release, x64, 2022) (push) Waiting to run
MSBuild / build (Release, x86, 2019) (push) Waiting to run
MSBuild / build (Release, x86, 2022) (push) Waiting to run
Microsoft C++ Code Analysis / Analyze (push) Waiting to run
CTest (Windows) / build (amd64, x64-Debug, windows-2019) (push) Waiting to run
CTest (Windows) / build (amd64, x64-Debug, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64, x64-Debug-Clang, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64, x64-Release, windows-2019) (push) Waiting to run
CTest (Windows) / build (amd64, x64-Release, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64, x64-Release-Clang, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64_arm64, arm64-Debug, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64_arm64, arm64-Release, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64_arm64, arm64ec-Debug, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64_arm64, arm64ec-Release, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64_x86, x86-Debug, windows-2019) (push) Waiting to run
CTest (Windows) / build (amd64_x86, x86-Debug, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64_x86, x86-Debug-Clang, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64_x86, x86-Release, windows-2019) (push) Waiting to run
CTest (Windows) / build (amd64_x86, x86-Release, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64_x86, x86-Release-Clang, windows-2022) (push) Waiting to run
CMake (Windows using VCPKG) / build (amd64, x64-Debug-Clang-VCPKG, windows-2022) (push) Waiting to run
CMake (Windows using VCPKG) / build (amd64, x64-Debug-VCPKG, windows-2019) (push) Waiting to run
CMake (Windows using VCPKG) / build (amd64, x64-Debug-VCPKG, windows-2022) (push) Waiting to run
CMake (Windows using VCPKG) / build (amd64_arm64, arm64-Debug-VCPKG, windows-2022) (push) Waiting to run
CMake (Windows using VCPKG) / build (amd64_x86, x86-Debug-VCPKG, windows-2022) (push) Waiting to run
CMake (WSL) / build (x64-Debug-Linux, 11) (push) Waiting to run
CMake (WSL) / build (x64-Debug-Linux, 12) (push) Waiting to run
CMake (WSL) / build (x64-Debug-Linux, 10) (push) Waiting to run
CMake (WSL) / build (x64-Release-Linux, 10) (push) Waiting to run
CMake (WSL) / build (x64-Release-Linux, 11) (push) Waiting to run
CMake (WSL) / build (x64-Release-Linux, 12) (push) Waiting to run
Some checks are pending
CodeQL / Analyze (C/C++) (push) Waiting to run
CMake (Windows) / build (amd64, x64-Debug, windows-2019) (push) Waiting to run
CMake (Windows) / build (amd64, x64-Debug, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64, x64-Debug-Clang, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64, x64-Release, windows-2019) (push) Waiting to run
CMake (Windows) / build (amd64, x64-Release, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64, x64-Release-Clang, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64_arm64, arm64-Debug, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64_arm64, arm64-Release, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64_arm64, arm64ec-Debug, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64_arm64, arm64ec-Release, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64_x86, x86-Debug, windows-2019) (push) Waiting to run
CMake (Windows) / build (amd64_x86, x86-Debug, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64_x86, x86-Debug-Clang, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64_x86, x86-Release, windows-2019) (push) Waiting to run
CMake (Windows) / build (amd64_x86, x86-Release, windows-2022) (push) Waiting to run
CMake (Windows) / build (amd64_x86, x86-Release-Clang, windows-2022) (push) Waiting to run
MSBuild / build (Debug, ARM64, 2019) (push) Waiting to run
MSBuild / build (Debug, ARM64, 2022) (push) Waiting to run
MSBuild / build (Debug, x64, 2019) (push) Waiting to run
MSBuild / build (Debug, x64, 2022) (push) Waiting to run
MSBuild / build (Debug, x86, 2019) (push) Waiting to run
MSBuild / build (Debug, x86, 2022) (push) Waiting to run
MSBuild / build (Release, ARM64, 2019) (push) Waiting to run
MSBuild / build (Release, ARM64, 2022) (push) Waiting to run
MSBuild / build (Release, x64, 2019) (push) Waiting to run
MSBuild / build (Release, x64, 2022) (push) Waiting to run
MSBuild / build (Release, x86, 2019) (push) Waiting to run
MSBuild / build (Release, x86, 2022) (push) Waiting to run
Microsoft C++ Code Analysis / Analyze (push) Waiting to run
CTest (Windows) / build (amd64, x64-Debug, windows-2019) (push) Waiting to run
CTest (Windows) / build (amd64, x64-Debug, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64, x64-Debug-Clang, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64, x64-Release, windows-2019) (push) Waiting to run
CTest (Windows) / build (amd64, x64-Release, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64, x64-Release-Clang, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64_arm64, arm64-Debug, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64_arm64, arm64-Release, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64_arm64, arm64ec-Debug, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64_arm64, arm64ec-Release, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64_x86, x86-Debug, windows-2019) (push) Waiting to run
CTest (Windows) / build (amd64_x86, x86-Debug, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64_x86, x86-Debug-Clang, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64_x86, x86-Release, windows-2019) (push) Waiting to run
CTest (Windows) / build (amd64_x86, x86-Release, windows-2022) (push) Waiting to run
CTest (Windows) / build (amd64_x86, x86-Release-Clang, windows-2022) (push) Waiting to run
CMake (Windows using VCPKG) / build (amd64, x64-Debug-Clang-VCPKG, windows-2022) (push) Waiting to run
CMake (Windows using VCPKG) / build (amd64, x64-Debug-VCPKG, windows-2019) (push) Waiting to run
CMake (Windows using VCPKG) / build (amd64, x64-Debug-VCPKG, windows-2022) (push) Waiting to run
CMake (Windows using VCPKG) / build (amd64_arm64, arm64-Debug-VCPKG, windows-2022) (push) Waiting to run
CMake (Windows using VCPKG) / build (amd64_x86, x86-Debug-VCPKG, windows-2022) (push) Waiting to run
CMake (WSL) / build (x64-Debug-Linux, 11) (push) Waiting to run
CMake (WSL) / build (x64-Debug-Linux, 12) (push) Waiting to run
CMake (WSL) / build (x64-Debug-Linux, 10) (push) Waiting to run
CMake (WSL) / build (x64-Release-Linux, 10) (push) Waiting to run
CMake (WSL) / build (x64-Release-Linux, 11) (push) Waiting to run
CMake (WSL) / build (x64-Release-Linux, 12) (push) Waiting to run
This commit is contained in:
parent
73aa2f3c34
commit
25ee5b4f91
@ -72,6 +72,8 @@ namespace DirectX
|
|||||||
|
|
||||||
size_t __cdecl BitsPerColor(_In_ DXGI_FORMAT fmt) noexcept;
|
size_t __cdecl BitsPerColor(_In_ DXGI_FORMAT fmt) noexcept;
|
||||||
|
|
||||||
|
size_t __cdecl BytesPerBlock(_In_ DXGI_FORMAT fmt) noexcept;
|
||||||
|
|
||||||
enum FORMAT_TYPE
|
enum FORMAT_TYPE
|
||||||
{
|
{
|
||||||
FORMAT_TYPE_TYPELESS,
|
FORMAT_TYPE_TYPELESS,
|
||||||
|
@ -920,6 +920,45 @@ size_t DirectX::BitsPerColor(DXGI_FORMAT fmt) noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------
|
||||||
|
// Returns bytes per block for a given DXGI BC format, or 0 on failure
|
||||||
|
//-------------------------------------------------------------------------------------
|
||||||
|
_Use_decl_annotations_
|
||||||
|
size_t DirectX::BytesPerBlock(DXGI_FORMAT fmt) noexcept
|
||||||
|
{
|
||||||
|
switch (fmt)
|
||||||
|
{
|
||||||
|
case DXGI_FORMAT_BC1_TYPELESS:
|
||||||
|
case DXGI_FORMAT_BC1_UNORM:
|
||||||
|
case DXGI_FORMAT_BC1_UNORM_SRGB:
|
||||||
|
case DXGI_FORMAT_BC4_TYPELESS:
|
||||||
|
case DXGI_FORMAT_BC4_UNORM:
|
||||||
|
case DXGI_FORMAT_BC4_SNORM:
|
||||||
|
return 8;
|
||||||
|
|
||||||
|
case DXGI_FORMAT_BC2_TYPELESS:
|
||||||
|
case DXGI_FORMAT_BC2_UNORM:
|
||||||
|
case DXGI_FORMAT_BC2_UNORM_SRGB:
|
||||||
|
case DXGI_FORMAT_BC3_TYPELESS:
|
||||||
|
case DXGI_FORMAT_BC3_UNORM:
|
||||||
|
case DXGI_FORMAT_BC3_UNORM_SRGB:
|
||||||
|
case DXGI_FORMAT_BC5_TYPELESS:
|
||||||
|
case DXGI_FORMAT_BC5_UNORM:
|
||||||
|
case DXGI_FORMAT_BC5_SNORM:
|
||||||
|
case DXGI_FORMAT_BC6H_TYPELESS:
|
||||||
|
case DXGI_FORMAT_BC6H_UF16:
|
||||||
|
case DXGI_FORMAT_BC6H_SF16:
|
||||||
|
case DXGI_FORMAT_BC7_TYPELESS:
|
||||||
|
case DXGI_FORMAT_BC7_UNORM:
|
||||||
|
case DXGI_FORMAT_BC7_UNORM_SRGB:
|
||||||
|
return 16;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
// Computes the image row pitch in bytes, and the slice ptich (size in bytes of the image)
|
// Computes the image row pitch in bytes, and the slice ptich (size in bytes of the image)
|
||||||
// based on DXGI format, width, and height
|
// based on DXGI format, width, and height
|
||||||
|
Loading…
x
Reference in New Issue
Block a user