|
|
@ -231,6 +231,8 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
|
|
|
|
{GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // RG32UI
|
|
|
|
{GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // RG32UI
|
|
|
|
{GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // R32UI
|
|
|
|
{GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // R32UI
|
|
|
|
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_8X8
|
|
|
|
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_8X8
|
|
|
|
|
|
|
|
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_8X5
|
|
|
|
|
|
|
|
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_5X4
|
|
|
|
|
|
|
|
|
|
|
|
// Depth formats
|
|
|
|
// Depth formats
|
|
|
|
{GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F
|
|
|
|
{GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F
|
|
|
@ -277,7 +279,9 @@ static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType
|
|
|
|
static bool IsPixelFormatASTC(PixelFormat format) {
|
|
|
|
static bool IsPixelFormatASTC(PixelFormat format) {
|
|
|
|
switch (format) {
|
|
|
|
switch (format) {
|
|
|
|
case PixelFormat::ASTC_2D_4X4:
|
|
|
|
case PixelFormat::ASTC_2D_4X4:
|
|
|
|
|
|
|
|
case PixelFormat::ASTC_2D_5X4:
|
|
|
|
case PixelFormat::ASTC_2D_8X8:
|
|
|
|
case PixelFormat::ASTC_2D_8X8:
|
|
|
|
|
|
|
|
case PixelFormat::ASTC_2D_8X5:
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
@ -288,8 +292,12 @@ static std::pair<u32, u32> GetASTCBlockSize(PixelFormat format) {
|
|
|
|
switch (format) {
|
|
|
|
switch (format) {
|
|
|
|
case PixelFormat::ASTC_2D_4X4:
|
|
|
|
case PixelFormat::ASTC_2D_4X4:
|
|
|
|
return {4, 4};
|
|
|
|
return {4, 4};
|
|
|
|
|
|
|
|
case PixelFormat::ASTC_2D_5X4:
|
|
|
|
|
|
|
|
return {5, 4};
|
|
|
|
case PixelFormat::ASTC_2D_8X8:
|
|
|
|
case PixelFormat::ASTC_2D_8X8:
|
|
|
|
return {8, 8};
|
|
|
|
return {8, 8};
|
|
|
|
|
|
|
|
case PixelFormat::ASTC_2D_8X5:
|
|
|
|
|
|
|
|
return {8, 5};
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
LOG_CRITICAL(HW_GPU, "Unhandled format: {}", static_cast<u32>(format));
|
|
|
|
LOG_CRITICAL(HW_GPU, "Unhandled format: {}", static_cast<u32>(format));
|
|
|
|
UNREACHABLE();
|
|
|
|
UNREACHABLE();
|
|
|
@ -395,6 +403,8 @@ static constexpr std::array<void (*)(u32, u32, u32, u32, u32, u8*, std::size_t,
|
|
|
|
MortonCopy<true, PixelFormat::RG32UI>,
|
|
|
|
MortonCopy<true, PixelFormat::RG32UI>,
|
|
|
|
MortonCopy<true, PixelFormat::R32UI>,
|
|
|
|
MortonCopy<true, PixelFormat::R32UI>,
|
|
|
|
MortonCopy<true, PixelFormat::ASTC_2D_8X8>,
|
|
|
|
MortonCopy<true, PixelFormat::ASTC_2D_8X8>,
|
|
|
|
|
|
|
|
MortonCopy<true, PixelFormat::ASTC_2D_8X5>,
|
|
|
|
|
|
|
|
MortonCopy<true, PixelFormat::ASTC_2D_5X4>,
|
|
|
|
MortonCopy<true, PixelFormat::Z32F>,
|
|
|
|
MortonCopy<true, PixelFormat::Z32F>,
|
|
|
|
MortonCopy<true, PixelFormat::Z16>,
|
|
|
|
MortonCopy<true, PixelFormat::Z16>,
|
|
|
|
MortonCopy<true, PixelFormat::Z24S8>,
|
|
|
|
MortonCopy<true, PixelFormat::Z24S8>,
|
|
|
@ -455,6 +465,8 @@ static constexpr std::array<void (*)(u32, u32, u32, u32, u32, u8*, std::size_t,
|
|
|
|
MortonCopy<false, PixelFormat::RG32UI>,
|
|
|
|
MortonCopy<false, PixelFormat::RG32UI>,
|
|
|
|
MortonCopy<false, PixelFormat::R32UI>,
|
|
|
|
MortonCopy<false, PixelFormat::R32UI>,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
|
|
|
|
nullptr,
|
|
|
|
|
|
|
|
nullptr,
|
|
|
|
MortonCopy<false, PixelFormat::Z32F>,
|
|
|
|
MortonCopy<false, PixelFormat::Z32F>,
|
|
|
|
MortonCopy<false, PixelFormat::Z16>,
|
|
|
|
MortonCopy<false, PixelFormat::Z16>,
|
|
|
|
MortonCopy<false, PixelFormat::Z24S8>,
|
|
|
|
MortonCopy<false, PixelFormat::Z24S8>,
|
|
|
@ -790,7 +802,9 @@ static void ConvertFormatAsNeeded_LoadGLBuffer(std::vector<u8>& data, PixelForma
|
|
|
|
u32 width, u32 height) {
|
|
|
|
u32 width, u32 height) {
|
|
|
|
switch (pixel_format) {
|
|
|
|
switch (pixel_format) {
|
|
|
|
case PixelFormat::ASTC_2D_4X4:
|
|
|
|
case PixelFormat::ASTC_2D_4X4:
|
|
|
|
case PixelFormat::ASTC_2D_8X8: {
|
|
|
|
case PixelFormat::ASTC_2D_8X8:
|
|
|
|
|
|
|
|
case PixelFormat::ASTC_2D_8X5:
|
|
|
|
|
|
|
|
case PixelFormat::ASTC_2D_5X4: {
|
|
|
|
// Convert ASTC pixel formats to RGBA8, as most desktop GPUs do not support ASTC.
|
|
|
|
// Convert ASTC pixel formats to RGBA8, as most desktop GPUs do not support ASTC.
|
|
|
|
u32 block_width{};
|
|
|
|
u32 block_width{};
|
|
|
|
u32 block_height{};
|
|
|
|
u32 block_height{};
|
|
|
|