support more texture sizes

This commit is contained in:
InoriRus
2022-06-10 19:27:34 +10:00
parent 224c692337
commit f1f4302f99
24 changed files with 5240 additions and 303 deletions
+219 -254
View File
@@ -1,6 +1,5 @@
#include "Emulator/Graphics/Tile.h"
#include "Kyty/Core/ArrayWrapper.h"
#include "Kyty/Core/DbgAssert.h"
#include "Kyty/Core/String.h"
#include "Kyty/Core/Threads.h"
@@ -13,11 +12,28 @@
#endif
#include <algorithm>
#include <iterator>
#ifdef KYTY_EMU_ENABLED
namespace Kyty::Libs::Graphics {
static uint32_t IntLog2(uint32_t i)
{
#if KYTY_COMPILER == KYTY_COMPILER_CLANG
return 31 - __builtin_clz(i | 1u);
#else
unsigned long temp;
_BitScanReverse(&temp, i | 1u);
return temp;
#endif
}
static bool IsPowerOfTwo(uint32_t x)
{
return (x != 0) && ((x & (x - 1)) == 0);
}
struct Uint128
{
uint64_t n[2];
@@ -111,17 +127,6 @@ public:
return pipe;
}
static uint32_t IntLog2(uint32_t i)
{
#if KYTY_COMPILER == KYTY_COMPILER_CLANG
return 31 - __builtin_clz(i | 1u);
#else
unsigned long temp;
_BitScanReverse(&temp, i | 1u);
return temp;
#endif
}
static uint32_t GetBankIndex(uint32_t x, uint32_t y, uint32_t bank_width, uint32_t bank_height, uint32_t num_banks, uint32_t num_pipes)
{
const uint32_t x_shift_offset = IntLog2(bank_width * num_pipes);
@@ -268,11 +273,15 @@ public:
static Tiler* g_tiler = nullptr;
static void init_maps();
void TileInit()
{
EXIT_IF(g_tiler != nullptr);
g_tiler = new Tiler;
init_maps();
}
// NOLINTNEXTLINE(readability-non-const-parameter)
@@ -457,11 +466,10 @@ void TileConvertTiledToLinear(void* dst, const void* src, TileMode mode, uint32_
{
EXIT_NOT_IMPLEMENTED(mode != TileMode::TextureTiled);
uint32_t padded_width[16] = {0};
uint32_t padded_height[16] = {0};
uint32_t level_sizes[16] = {0};
TilePaddedSize padded_sizes[16];
TileSizeOffset level_sizes[16];
TileGetTextureSize(dfmt, nfmt, width, height, pitch, levels, 13, neo, nullptr, level_sizes, padded_width, padded_height);
TileGetTextureSize(dfmt, nfmt, width, height, pitch, levels, 13, neo, nullptr, level_sizes, padded_sizes);
uint32_t mip_width = width;
uint32_t mip_height = height;
@@ -473,12 +481,9 @@ void TileConvertTiledToLinear(void* dst, const void* src, TileMode mode, uint32_
for (uint32_t l = 0; l < levels; l++)
{
Tiler1d t;
t.Init(dfmt, nfmt, mip_width, mip_height, mip_pitch, padded_width[l], padded_height[l], neo);
t.Init(dfmt, nfmt, mip_width, mip_height, mip_pitch, padded_sizes[l].width, padded_sizes[l].height, neo);
Detile1d(&t, dstptr, srcptr, neo);
dstptr += level_sizes[l];
srcptr += level_sizes[l];
Detile1d(&t, dstptr + level_sizes[l].offset, srcptr + level_sizes[l].offset, neo);
if (mip_width > 1)
{
@@ -700,273 +705,222 @@ void TileGetVideoOutSize(uint32_t width, uint32_t height, uint32_t pitch, bool t
size->align = ret_align;
}
struct TilePadded
struct TextureInfoPadded
{
uint32_t width = 0;
uint32_t height = 0;
};
struct TextureInfo
struct TextureInfoSize
{
uint32_t dfmt = 0;
uint32_t nfmt = 0;
uint32_t width = 0;
uint32_t height = 0;
uint32_t pitch = 0;
uint32_t levels = 0;
uint32_t tile = 0;
bool neo = false;
TileSizeAlign size[16];
TilePadded padded[16];
uint32_t total_size = 0;
uint32_t total_align = 0;
uint32_t mipmap_offset = 0;
uint32_t mipmap_size = 0;
};
static void FindTextureInfo(uint32_t tile, uint32_t dfmt, uint32_t nfmt, const TextureInfo** info, int* num)
struct TextureInfo
{
uint32_t dfmt = 0;
uint32_t nfmt = 0;
uint32_t width = 0;
uint32_t height = 0;
uint32_t pitch = 0;
uint32_t levels = 0;
uint32_t tile = 0;
bool neo = false;
TextureInfoSize size[16];
TextureInfoPadded padded[16];
};
#include "Tables/TileTextureInfo_10_10_0.inc"
#include "Tables/TileTextureInfo_13_10_0.inc"
#include "Tables/TileTextureInfo_13_10_9.inc"
#include "Tables/TileTextureInfo_13_35_0.inc"
#include "Tables/TileTextureInfo_13_36_0.inc"
#include "Tables/TileTextureInfo_13_37_0.inc"
#include "Tables/TileTextureInfo_13_37_9.inc"
#include "Tables/TileTextureInfo_14_10_0.inc"
#include "Tables/TileTextureInfo_2_4_7.inc"
#include "Tables/TileTextureInfo_8_10_0.inc"
#include "Tables/TileTextureInfo_8_10_9.inc"
#include "Tables/TileTextureInfo_8_1_0.inc"
static const TextureInfo* g_info_map_10_10_0[16][16][16][2] = {};
static const TextureInfo* g_info_map_13_10_0[16][16][16][2] = {};
static const TextureInfo* g_info_map_13_10_9[16][16][16][2] = {};
static const TextureInfo* g_info_map_13_35_0[16][16][16][2] = {};
static const TextureInfo* g_info_map_13_36_0[16][16][16][2] = {};
static const TextureInfo* g_info_map_13_37_0[16][16][16][2] = {};
static const TextureInfo* g_info_map_13_37_9[16][16][16][2] = {};
static const TextureInfo* g_info_map_14_10_0[16][16][16][2] = {};
static const TextureInfo* g_info_map_2_4_7[16][16][16][2] = {};
static const TextureInfo* g_info_map_8_1_0[16][16][16][2] = {};
static const TextureInfo* g_info_map_8_10_0[16][16][16][2] = {};
static const TextureInfo* g_info_map_8_10_9[16][16][16][2] = {};
template <class Map>
static void init_map(Map& map, const TextureInfo* info, int num)
{
for (int w = 0; w < 16; w++)
{
for (int h = 0; h < 16; h++)
{
for (int p = 0; p < 16; p++)
{
for (int n = 0; n < 2; n++)
{
map[w][h][p][n] = nullptr;
}
}
}
}
for (int index = 0; index < num; index++)
{
const auto& i = info[index];
if (!(i.width == 0 && i.height == 0 && i.pitch == 0))
{
EXIT_IF(!(IsPowerOfTwo(i.width) && IsPowerOfTwo(i.height) && IsPowerOfTwo(i.pitch)));
auto w = IntLog2(i.width);
auto h = IntLog2(i.height);
auto p = IntLog2(i.pitch);
auto n = i.neo ? 1 : 0;
EXIT_IF(w > 16 || h > 16 || p > 16 || n > 2);
EXIT_IF(map[w][h][p][n] != nullptr);
map[w][h][p][n] = &i;
}
}
}
template <class Map>
static const TextureInfo* check_map(Map& map, uint32_t width, uint32_t height, uint32_t pitch, bool neo)
{
// if (IsPowerOfTwo(width) && IsPowerOfTwo(height) && IsPowerOfTwo(pitch))
{
auto w = IntLog2(width);
auto h = IntLog2(height);
auto p = IntLog2(pitch);
auto n = neo ? 1 : 0;
return map[w][h][p][n];
}
// return nullptr;
}
static void init_maps()
{
init_map(g_info_map_10_10_0, infos_10_10_0_pow2, std::size(infos_10_10_0_pow2));
init_map(g_info_map_13_10_0, infos_13_10_0_pow2, std::size(infos_13_10_0_pow2));
init_map(g_info_map_13_10_9, infos_13_10_9_pow2, std::size(infos_13_10_9_pow2));
init_map(g_info_map_13_35_0, infos_13_35_0_pow2, std::size(infos_13_35_0_pow2));
init_map(g_info_map_13_36_0, infos_13_36_0_pow2, std::size(infos_13_36_0_pow2));
init_map(g_info_map_13_37_0, infos_13_37_0_pow2, std::size(infos_13_37_0_pow2));
init_map(g_info_map_13_37_9, infos_13_37_9_pow2, std::size(infos_13_37_9_pow2));
init_map(g_info_map_14_10_0, infos_14_10_0_pow2, std::size(infos_14_10_0_pow2));
init_map(g_info_map_2_4_7, infos_2_4_7_pow2, std::size(infos_2_4_7_pow2));
init_map(g_info_map_8_1_0, infos_8_1_0_pow2, std::size(infos_8_1_0_pow2));
init_map(g_info_map_8_10_0, infos_8_10_0_pow2, std::size(infos_8_10_0_pow2));
init_map(g_info_map_8_10_9, infos_8_10_9_pow2, std::size(infos_8_10_9_pow2));
}
#define KYTY_TEXTURE_CHECK(n) \
if (pow2) \
{ \
if (const auto* i = check_map(g_info_map_##n, width, height, pitch, neo); i != nullptr) \
{ \
*info = i; \
*num = 1; \
} else \
{ \
*info = nullptr; \
*num = 0; \
} \
} else \
{ \
*info = infos_##n; \
*num = std::size(infos_##n); \
}
// NOLINTNEXTLINE(readability-function-cognitive-complexity)
static void FindTextureInfo(uint32_t dfmt, uint32_t nfmt, uint32_t width, uint32_t height, uint32_t pitch, uint32_t tile, bool neo,
const TextureInfo** info, int* num, bool pow2)
{
EXIT_IF(info == nullptr);
EXIT_IF(num == nullptr);
static const TextureInfo infos_8[] = {
// clang-format off
// kDataFormatB8G8R8A8UnormSrgb, 512, 512, 0, 0, kTileModeDisplay_LinearAligned
{ 10, 9, 512, 512, 512, 10, 8, false, {{1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {512, 256}, {256, 256}, {256, 256}, {256, 256}, }, { {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, } },
{ 10, 9, 512, 512, 512, 10, 8, true, {{1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {512, 256}, {256, 256}, {256, 256}, {256, 256}, }, { {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, } },
// kDataFormatR8Unorm, 2048, 2048, 0, 0, kTileModeDisplay_LinearAligned
{ 1, 0, 2048, 2048, 2048, 12, 8, false, {{4194304, 256}, {1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {2048, 256}, {1024, 256}, {512, 256}, {256, 256}, {256, 256}, {256, 256}, }, { {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, } },
{ 1, 0, 2048, 2048, 2048, 12, 8, true, {{4194304, 256}, {1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {2048, 256}, {1024, 256}, {512, 256}, {256, 256}, {256, 256}, {256, 256}, }, { {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, } },
// kDataFormatB8G8R8A8Unorm, 1, 1, 64, 0, kTileModeDisplay_LinearAligned
{ 10, 0, 1, 1, 64, 1, 8, false, {{256, 256}, }, { {0, 0}, } },
{ 10, 0, 1, 1, 64, 1, 8, true, {{256, 256}, }, { {0, 0}, } },
// clang-format on
};
static const TextureInfo infos_13_10_0[] = {
// clang-format off
// kDataFormatB8G8R8A8Unorm, 512, 512, 0, 0, kTileModeThin_1dThin
{ 10, 0, 512, 512, 512, 10, 13, false, {{1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {256, 256}, {256, 256}, {256, 256}, {256, 256}, }, { {512, 512}, {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 10, 0, 512, 512, 512, 10, 13, true, {{1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {256, 256}, {256, 256}, {256, 256}, {256, 256}, }, { {512, 512}, {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatB8G8R8A8Unorm, 1024, 1024, 0, 0, kTileModeThin_1dThin
{ 10, 0, 1024, 1024, 1024, 11, 13, false, {{4194304, 256}, {1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {256, 256}, {256, 256}, {256, 256}, {256, 256}, }, { {1024, 1024}, {512, 512}, {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 10, 0, 1024, 1024, 1024, 11, 13, true, {{4194304, 256}, {1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {256, 256}, {256, 256}, {256, 256}, {256, 256}, }, { {1024, 1024}, {512, 512}, {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatB8G8R8A8Unorm, 2048, 2048, 0, 0, kTileModeThin_1dThin
{ 10, 0, 2048, 2048, 2048, 12, 13, false, {{16777216, 256}, {4194304, 256}, {1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {256, 256}, {256, 256}, {256, 256}, {256, 256}, }, { {2048, 2048}, {1024, 1024}, {512, 512}, {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 10, 0, 2048, 2048, 2048, 12, 13, true, {{16777216, 256}, {4194304, 256}, {1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {256, 256}, {256, 256}, {256, 256}, {256, 256}, }, { {2048, 2048}, {1024, 1024}, {512, 512}, {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatB8G8R8A8Unorm, 512, 768, 0, 0, kTileModeThin_1dThin
{ 10, 0, 512, 768, 512, 10, 13, false, {{1572864, 256}, {1048576, 256}, {131072, 256}, {32768, 256}, {8192, 256}, {2048, 256}, {512, 256}, {256, 256}, {256, 256}, {256, 256}, }, { {512, 768}, {256, 512}, {128, 256}, {64, 128}, {32, 64}, {16, 32}, {8, 16}, {8, 8}, {8, 8}, {8, 8}, } },
{ 10, 0, 512, 768, 512, 10, 13, true, {{1572864, 256}, {1048576, 256}, {131072, 256}, {32768, 256}, {8192, 256}, {2048, 256}, {512, 256}, {256, 256}, {256, 256}, {256, 256}, }, { {512, 768}, {256, 512}, {128, 256}, {64, 128}, {32, 64}, {16, 32}, {8, 16}, {8, 8}, {8, 8}, {8, 8}, } },
// clang-format on
};
static const TextureInfo infos_13_10_9[] = {
// clang-format off
// kDataFormatB8G8R8A8UnormSrgb, 512, 512, 0, 0, kTileModeThin_1dThin
{ 10, 9, 512, 512, 512, 10, 13, false, {{1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {256, 256}, {256, 256}, {256, 256}, {256, 256}, }, { {512, 512}, {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 10, 9, 512, 512, 512, 10, 13, true, {{1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {256, 256}, {256, 256}, {256, 256}, {256, 256}, }, { {512, 512}, {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// clang-format on
};
static const TextureInfo infos_13_35_0[] = {
// clang-format off
// kDataFormatBc1Unorm, 256, 64, 0, 0, kTileModeThin_1dThin
{ 35, 0, 256, 64, 256, 9, 13, false, {{8192, 256}, {2048, 256}, {1024, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, }, { {64, 16}, {32, 8}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 35, 0, 256, 64, 256, 9, 13, true, {{8192, 256}, {2048, 256}, {1024, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, }, { {64, 16}, {32, 8}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc1Unorm, 256, 256, 0, 0, kTileModeThin_1dThin
{ 35, 0, 256, 256, 256, 9, 13, false, {{32768, 256}, {8192, 256}, {2048, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, }, { {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 35, 0, 256, 256, 256, 9, 13, true, {{32768, 256}, {8192, 256}, {2048, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, }, { {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc1Unorm, 512, 512, 0, 0, kTileModeThin_1dThin
{ 35, 0, 512, 512, 512, 10, 13, false, {{131072, 256}, {32768, 256}, {8192, 256}, {2048, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, }, { {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 35, 0, 512, 512, 512, 10, 13, true, {{131072, 256}, {32768, 256}, {8192, 256}, {2048, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, }, { {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc1Unorm, 1024, 512, 0, 0, kTileModeThin_1dThin
{ 35, 0, 1024, 512, 1024, 11, 13, false, {{262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, }, { {256, 128}, {128, 64}, {64, 32}, {32, 16}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 35, 0, 1024, 512, 1024, 11, 13, true, {{262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, }, { {256, 128}, {128, 64}, {64, 32}, {32, 16}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc1Unorm, 1024, 1024, 0, 0, kTileModeThin_1dThin
{ 35, 0, 1024, 1024, 1024, 11, 13, false, {{524288, 256}, {131072, 256}, {32768, 256}, {8192, 256}, {2048, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, }, { {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 35, 0, 1024, 1024, 1024, 11, 13, true, {{524288, 256}, {131072, 256}, {32768, 256}, {8192, 256}, {2048, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, }, { {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc1Unorm, 2048, 1024, 0, 0, kTileModeThin_1dThin
{ 35, 0, 2048, 1024, 2048, 12, 13, false, {{1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, }, { {512, 256}, {256, 128}, {128, 64}, {64, 32}, {32, 16}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 35, 0, 2048, 1024, 2048, 12, 13, true, {{1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, }, { {512, 256}, {256, 128}, {128, 64}, {64, 32}, {32, 16}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc1Unorm, 2048, 2048, 0, 0, kTileModeThin_1dThin
{ 35, 0, 2048, 2048, 2048, 12, 13, false, {{2097152, 256}, {524288, 256}, {131072, 256}, {32768, 256}, {8192, 256}, {2048, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, }, { {512, 512}, {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 35, 0, 2048, 2048, 2048, 12, 13, true, {{2097152, 256}, {524288, 256}, {131072, 256}, {32768, 256}, {8192, 256}, {2048, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, {512, 256}, }, { {512, 512}, {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc1Unorm, 1920, 1080, 1920, 1, kTileModeThin_1dThin
{ 35, 0, 1920, 1080, 1920, 1, 13, false, {{1044480, 256}, }, { {480, 272}, } },
{ 35, 0, 1920, 1080, 1920, 1, 13, true, {{1044480, 256}, }, { {480, 272}, } },
// clang-format on
};
static const TextureInfo infos_13_36_0[] = {
// clang-format off
// kDataFormatBc2Unorm, 1, 32, 0, 0, kTileModeThin_1dThin
{ 36, 0, 1, 32, 32, 6, 13, false, {{1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 36, 0, 1, 32, 32, 6, 13, true, {{1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc2Unorm, 8, 32, 0, 0, kTileModeThin_1dThin
{ 36, 0, 8, 32, 32, 6, 13, false, {{1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 36, 0, 8, 32, 32, 6, 13, true, {{1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc2Unorm, 2048, 2048, 0, 0, kTileModeThin_1dThin
{ 36, 0, 2048, 2048, 2048, 12, 13, false, {{4194304, 256}, {1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {512, 512}, {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 36, 0, 2048, 2048, 2048, 12, 13, true, {{4194304, 256}, {1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {512, 512}, {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc2Unorm, 4096, 4096, 0, 0, kTileModeThin_1dThin
{ 36, 0, 4096, 4096, 4096, 13, 13, false, {{16777216, 256}, {4194304, 256}, {1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {1024, 1024}, {512, 512}, {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 36, 0, 4096, 4096, 4096, 13, 13, true, {{16777216, 256}, {4194304, 256}, {1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {1024, 1024}, {512, 512}, {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc2Unorm, 8192, 8192, 0, 0, kTileModeThin_1dThin
{ 36, 0, 8192, 8192, 8192, 14, 13, false, {{67108864, 256}, {16777216, 256}, {4194304, 256}, {1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {2048, 2048}, {1024, 1024}, {512, 512}, {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 36, 0, 8192, 8192, 8192, 14, 13, true, {{67108864, 256}, {16777216, 256}, {4194304, 256}, {1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {2048, 2048}, {1024, 1024}, {512, 512}, {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// clang-format on
};
static const TextureInfo infos_13_37_0[] = {
// clang-format off
// kDataFormatBc3Unorm, 16, 32, 0, 0, kTileModeThin_1dThin
{ 37, 0, 16, 32, 32, 6, 13, false, {{1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 37, 0, 16, 32, 32, 6, 13, true, {{1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc3Unorm, 32, 32, 0, 0, kTileModeThin_1dThin
{ 37, 0, 32, 32, 32, 6, 13, false, {{1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 37, 0, 32, 32, 32, 6, 13, true, {{1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc3Unorm, 64, 64, 0, 0, kTileModeThin_1dThin
{ 37, 0, 64, 64, 64, 7, 13, false, {{4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 37, 0, 64, 64, 64, 7, 13, true, {{4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc3Unorm, 128, 128, 0, 0, kTileModeThin_1dThin
{ 37, 0, 128, 128, 128, 8, 13, false, {{16384, 256}, {4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 37, 0, 128, 128, 128, 8, 13, true, {{16384, 256}, {4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc3Unorm, 256, 256, 0, 0, kTileModeThin_1dThin
{ 37, 0, 256, 256, 256, 9, 13, false, {{65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 37, 0, 256, 256, 256, 9, 13, true, {{65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc3Unorm, 512, 512, 0, 0, kTileModeThin_1dThin
{ 37, 0, 512, 512, 512, 10, 13, false, {{262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 37, 0, 512, 512, 512, 10, 13, true, {{262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc3Unorm, 1024, 256, 0, 0, kTileModeThin_1dThin
{ 37, 0, 1024, 256, 1024, 11, 13, false, {{262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {2048, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {256, 64}, {128, 32}, {64, 16}, {32, 8}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 37, 0, 1024, 256, 1024, 11, 13, true, {{262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {2048, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {256, 64}, {128, 32}, {64, 16}, {32, 8}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc3Unorm, 1024, 512, 0, 0, kTileModeThin_1dThin
{ 37, 0, 1024, 512, 1024, 11, 13, false, {{524288, 256}, {131072, 256}, {32768, 256}, {8192, 256}, {2048, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {256, 128}, {128, 64}, {64, 32}, {32, 16}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 37, 0, 1024, 512, 1024, 11, 13, true, {{524288, 256}, {131072, 256}, {32768, 256}, {8192, 256}, {2048, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {256, 128}, {128, 64}, {64, 32}, {32, 16}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc3Unorm, 1024, 1024, 0, 0, kTileModeThin_1dThin
{ 37, 0, 1024, 1024, 1024, 11, 13, false, {{1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 37, 0, 1024, 1024, 1024, 11, 13, true, {{1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc3Unorm, 2048, 128, 0, 0, kTileModeThin_1dThin
{ 37, 0, 2048, 128, 2048, 12, 13, false, {{262144, 256}, {65536, 256}, {16384, 256}, {8192, 256}, {4096, 256}, {2048, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {512, 32}, {256, 16}, {128, 8}, {64, 8}, {32, 8}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 37, 0, 2048, 128, 2048, 12, 13, true, {{262144, 256}, {65536, 256}, {16384, 256}, {8192, 256}, {4096, 256}, {2048, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {512, 32}, {256, 16}, {128, 8}, {64, 8}, {32, 8}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc3Unorm, 2048, 2048, 0, 0, kTileModeThin_1dThin
{ 37, 0, 2048, 2048, 2048, 12, 13, false, {{4194304, 256}, {1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {512, 512}, {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 37, 0, 2048, 2048, 2048, 12, 13, true, {{4194304, 256}, {1048576, 256}, {262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {512, 512}, {256, 256}, {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc3Unorm, 256, 32, 0, 0, kTileModeThin_1dThin
{ 37, 0, 256, 32, 256, 9, 13, false, {{8192, 256}, {4096, 256}, {2048, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {64, 8}, {32, 8}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 37, 0, 256, 32, 256, 9, 13, true, {{8192, 256}, {4096, 256}, {2048, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {64, 8}, {32, 8}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc3Unorm, 256, 64, 0, 0, kTileModeThin_1dThin
{ 37, 0, 256, 64, 256, 9, 13, false, {{16384, 256}, {4096, 256}, {2048, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {64, 16}, {32, 8}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 37, 0, 256, 64, 256, 9, 13, true, {{16384, 256}, {4096, 256}, {2048, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {64, 16}, {32, 8}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc3Unorm, 256, 128, 0, 0, kTileModeThin_1dThin
{ 37, 0, 256, 128, 256, 9, 13, false, {{32768, 256}, {8192, 256}, {2048, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {64, 32}, {32, 16}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 37, 0, 256, 128, 256, 9, 13, true, {{32768, 256}, {8192, 256}, {2048, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {64, 32}, {32, 16}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc3Unorm, 512, 256, 0, 0, kTileModeThin_1dThin
{ 37, 0, 512, 256, 512, 10, 13, false, {{131072, 256}, {32768, 256}, {8192, 256}, {2048, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {128, 64}, {64, 32}, {32, 16}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 37, 0, 512, 256, 512, 10, 13, true, {{131072, 256}, {32768, 256}, {8192, 256}, {2048, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {128, 64}, {64, 32}, {32, 16}, {16, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// kDataFormatBc3Unorm, 1920, 1080, 1920, 1, kTileModeThin_1dThin
{ 37, 0, 1920, 1080, 1920, 1, 13, false, {{2088960, 256}, }, { {480, 272}, } },
{ 37, 0, 1920, 1080, 1920, 1, 13, true, {{2088960, 256}, }, { {480, 272}, } },
// clang-format on
};
static const TextureInfo infos_13_37_9[] = {
// clang-format off
// kDataFormatBc3UnormSrgb, 512, 512, 0, 0, kTileModeThin_1dThin
{ 37, 9, 512, 512, 512, 10, 13, false, {{262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
{ 37, 9, 512, 512, 512, 10, 13, true, {{262144, 256}, {65536, 256}, {16384, 256}, {4096, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, {1024, 256}, }, { {128, 128}, {64, 64}, {32, 32}, {16, 16}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, {8, 8}, } },
// clang-format on
};
static const TextureInfo infos_14[] = {
// clang-format off
// kDataFormatB8G8R8A8Unorm, 256, 256, 0, 0, kTileModeThin_2dThin
{ 10, 0, 256, 256, 256, 9, 14, false, {{262144, 32768}, {65536, 32768}, {16384, 32768}, {4096, 32768}, {1024, 32768}, {256, 32768}, {256, 32768}, {256, 32768}, {256, 32768}, }, { {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, } },
{ 10, 0, 256, 256, 256, 9, 14, true, {{262144, 65536}, {65536, 65536}, {16384, 65536}, {4096, 65536}, {1024, 65536}, {256, 65536}, {256, 65536}, {256, 65536}, {256, 65536}, }, { {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, } },
// clang-format on
};
static const TextureInfo infos_10[] = {
// clang-format off
// kDataFormatB8G8R8A8Unorm, 96, 96, 128, 1, kTileModeDisplay_2dThin
{ 10, 0, 96, 96, 128, 1, 10, false, {{65536, 32768}, }, { {0, 0}, } },
{ 10, 0, 96, 96, 128, 1, 10, true, {{65536, 65536}, }, { {0, 0}, } },
// kDataFormatB8G8R8A8Unorm, 128, 128, 128, 1, kTileModeDisplay_2dThin
{ 10, 0, 128, 128, 128, 1, 10, false, {{65536, 32768}, }, { {0, 0}, } },
{ 10, 0, 128, 128, 128, 1, 10, true, {{65536, 65536}, }, { {0, 0}, } },
// kDataFormatB8G8R8A8Unorm, 960, 540, 1024, 1, kTileModeDisplay_2dThin
{ 10, 0, 960, 540, 1024, 1, 10, false, {{2359296, 32768}, }, { {0, 0}, } },
{ 10, 0, 960, 540, 1024, 1, 10, true, {{2621440, 65536}, }, { {0, 0}, } },
// kDataFormatB8G8R8A8Unorm, 1920, 1080, 1920, 1, kTileModeDisplay_2dThin
{ 10, 0, 1920, 1080, 1920, 1, 10, false, {{8355840, 32768}, }, { {0, 0}, } },
{ 10, 0, 1920, 1080, 1920, 1, 10, true, {{8847360, 65536}, }, { {0, 0}, } },
// kDataFormatB8G8R8A8Unorm, 3840, 2160, 3840, 1, kTileModeDisplay_2dThin
{ 10, 0, 3840, 2160, 3840, 1, 10, false, {{33423360, 32768}, }, { {0, 0}, } },
{ 10, 0, 3840, 2160, 3840, 1, 10, true, {{33423360, 65536}, }, { {0, 0}, } },
// kDataFormatB8G8R8A8Unorm, 4096, 4096, 4096, 1, kTileModeDisplay_2dThin
{ 10, 0, 4096, 4096, 4096, 1, 10, false, {{67108864, 32768}, }, { {0, 0}, } },
{ 10, 0, 4096, 4096, 4096, 1, 10, true, {{67108864, 65536}, }, { {0, 0}, } },
// kDataFormatB8G8R8A8Unorm, 8192, 4096, 8192, 1, kTileModeDisplay_2dThin
{ 10, 0, 8192, 4096, 8192, 1, 10, false, {{134217728, 32768}, }, { {0, 0}, } },
{ 10, 0, 8192, 4096, 8192, 1, 10, true, {{134217728, 65536}, }, { {0, 0}, } },
// clang-format on
};
static const TextureInfo infos_2[] = {
// clang-format off
// kDataFormatR32Float, 1920, 1080, 1920, 1, kTileModeDepth_2dThin_256
{ 4, 7, 1920, 1080, 1920, 1, 2, false, {{8355840, 32768}, }, { {0, 0}, } },
{ 4, 7, 1920, 1080, 1920, 1, 2, true, {{8847360, 65536}, }, { {0, 0}, } },
// clang-format on
};
switch (tile)
{
case 8:
*info = infos_8;
*num = KYTY_ARRAY_NUM(infos_8);
if (dfmt == 1 && nfmt == 0)
{
KYTY_TEXTURE_CHECK(8_1_0);
} else if (dfmt == 10 && nfmt == 0)
{
KYTY_TEXTURE_CHECK(8_10_0);
} else if (dfmt == 10 && nfmt == 9)
{
KYTY_TEXTURE_CHECK(8_10_9);
}
break;
case 13:
if (dfmt == 10 && nfmt == 0)
{
*info = infos_13_10_0;
*num = KYTY_ARRAY_NUM(infos_13_10_0);
KYTY_TEXTURE_CHECK(13_10_0);
} else if (dfmt == 10 && nfmt == 9)
{
*info = infos_13_10_9;
*num = KYTY_ARRAY_NUM(infos_13_10_9);
KYTY_TEXTURE_CHECK(13_10_9);
} else if (dfmt == 35 && nfmt == 0)
{
*info = infos_13_35_0;
*num = KYTY_ARRAY_NUM(infos_13_35_0);
KYTY_TEXTURE_CHECK(13_35_0);
} else if (dfmt == 36 && nfmt == 0)
{
*info = infos_13_36_0;
*num = KYTY_ARRAY_NUM(infos_13_36_0);
KYTY_TEXTURE_CHECK(13_36_0);
} else if (dfmt == 37 && nfmt == 0)
{
*info = infos_13_37_0;
*num = KYTY_ARRAY_NUM(infos_13_37_0);
KYTY_TEXTURE_CHECK(13_37_0);
} else if (dfmt == 37 && nfmt == 9)
{
*info = infos_13_37_9;
*num = KYTY_ARRAY_NUM(infos_13_37_9);
KYTY_TEXTURE_CHECK(13_37_9);
}
break;
case 14:
*info = infos_14;
*num = KYTY_ARRAY_NUM(infos_14);
if (dfmt == 10 && nfmt == 0)
{
KYTY_TEXTURE_CHECK(14_10_0);
}
break;
case 10:
*info = infos_10;
*num = KYTY_ARRAY_NUM(infos_10);
if (dfmt == 10 && nfmt == 0)
{
KYTY_TEXTURE_CHECK(10_10_0);
}
break;
case 2:
*info = infos_2;
*num = KYTY_ARRAY_NUM(infos_2);
if (dfmt == 4 && nfmt == 7)
{
KYTY_TEXTURE_CHECK(2_4_7);
}
break;
default: *info = nullptr; *num = 0;
}
}
// NOLINTNEXTLINE(readability-function-cognitive-complexity)
void TileGetTextureSize(uint32_t dfmt, uint32_t nfmt, uint32_t width, uint32_t height, uint32_t pitch, uint32_t levels, uint32_t tile,
bool neo, TileSizeAlign* total_size, uint32_t* level_sizes, uint32_t* padded_width, uint32_t* padded_height)
bool neo, TileSizeAlign* total_size, TileSizeOffset* level_sizes, TilePaddedSize* padded_size)
{
KYTY_PROFILER_FUNCTION();
const TextureInfo* infos = nullptr;
int num = 0;
FindTextureInfo(tile, dfmt, nfmt, &infos, &num);
bool pow2 = (IsPowerOfTwo(width) && IsPowerOfTwo(height) && IsPowerOfTwo(pitch));
EXIT_NOT_IMPLEMENTED(tile != 31 && infos == nullptr);
FindTextureInfo(dfmt, nfmt, width, height, pitch, tile, neo, &infos, &num, pow2);
EXIT_NOT_IMPLEMENTED(tile != 31 && tile != 8 && infos == nullptr);
EXIT_IF(levels == 0 || levels > 16);
for (int index = 0; index < num; index++)
{
@@ -974,24 +928,34 @@ void TileGetTextureSize(uint32_t dfmt, uint32_t nfmt, uint32_t width, uint32_t h
if (i.dfmt == dfmt && i.nfmt == nfmt && i.width == width && i.pitch == pitch && i.height == height && i.levels >= levels &&
i.tile == tile && i.neo == neo)
{
for (uint32_t l = 0; l < levels; l++)
if (total_size != nullptr)
{
if (total_size != nullptr)
total_size->size = i.size[levels - 1].total_size;
total_size->align = i.size[levels - 1].total_align;
}
if (level_sizes != nullptr)
{
if (levels == 1)
{
total_size->size += i.size[l].size;
total_size->align = i.size[l].align;
level_sizes[0].size = i.size[0].total_size;
level_sizes[0].offset = 0;
} else
{
for (uint32_t l = 0; l < levels; l++)
{
level_sizes[l].size = i.size[l].mipmap_size;
level_sizes[l].offset = i.size[l].mipmap_offset;
}
}
if (level_sizes != nullptr)
}
if (padded_size != nullptr)
{
for (uint32_t l = 0; l < levels; l++)
{
level_sizes[l] = i.size[l].size;
}
if (padded_width != nullptr)
{
padded_width[l] = i.padded[l].width;
}
if (padded_height != nullptr)
{
padded_height[l] = i.padded[l].height;
padded_size[l].width = i.padded[l].width;
padded_size[l].height = i.padded[l].height;
}
}
return;
@@ -1020,7 +984,8 @@ void TileGetTextureSize(uint32_t dfmt, uint32_t nfmt, uint32_t width, uint32_t h
}
if (level_sizes != nullptr)
{
level_sizes[0] = size;
level_sizes[0].size = size;
level_sizes[0].offset = 0;
}
}