Implement ASTC_2D_8X8 (Bayonetta 2)
This commit is contained in:
parent
ba480ea2fb
commit
2845348608
@ -167,6 +167,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
|
|||||||
{GL_RG8, GL_RG, GL_BYTE, ComponentType::SNorm, false}, // RG8S
|
{GL_RG8, GL_RG, GL_BYTE, ComponentType::SNorm, false}, // RG8S
|
||||||
{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
|
||||||
|
|
||||||
// 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
|
||||||
@ -213,6 +214,7 @@ 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_8X8:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -223,6 +225,8 @@ 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_8X8:
|
||||||
|
return {8, 8};
|
||||||
default:
|
default:
|
||||||
LOG_CRITICAL(HW_GPU, "Unhandled format: {}", static_cast<u32>(format));
|
LOG_CRITICAL(HW_GPU, "Unhandled format: {}", static_cast<u32>(format));
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
@ -327,6 +331,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, size_t, VAddr),
|
|||||||
MortonCopy<true, PixelFormat::RG8S>,
|
MortonCopy<true, PixelFormat::RG8S>,
|
||||||
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::Z32F>,
|
MortonCopy<true, PixelFormat::Z32F>,
|
||||||
MortonCopy<true, PixelFormat::Z16>,
|
MortonCopy<true, PixelFormat::Z16>,
|
||||||
MortonCopy<true, PixelFormat::Z24S8>,
|
MortonCopy<true, PixelFormat::Z24S8>,
|
||||||
@ -386,6 +391,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, size_t, VAddr),
|
|||||||
MortonCopy<false, PixelFormat::RG8S>,
|
MortonCopy<false, PixelFormat::RG8S>,
|
||||||
MortonCopy<false, PixelFormat::RG32UI>,
|
MortonCopy<false, PixelFormat::RG32UI>,
|
||||||
MortonCopy<false, PixelFormat::R32UI>,
|
MortonCopy<false, PixelFormat::R32UI>,
|
||||||
|
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>,
|
||||||
@ -544,7 +550,8 @@ static void ConvertG8R8ToR8G8(std::vector<u8>& data, u32 width, u32 height) {
|
|||||||
static void ConvertFormatAsNeeded_LoadGLBuffer(std::vector<u8>& data, PixelFormat pixel_format,
|
static void ConvertFormatAsNeeded_LoadGLBuffer(std::vector<u8>& data, PixelFormat pixel_format,
|
||||||
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: {
|
||||||
// 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{};
|
||||||
|
@ -70,19 +70,20 @@ struct SurfaceParams {
|
|||||||
RG8S = 42,
|
RG8S = 42,
|
||||||
RG32UI = 43,
|
RG32UI = 43,
|
||||||
R32UI = 44,
|
R32UI = 44,
|
||||||
|
ASTC_2D_8X8 = 45,
|
||||||
|
|
||||||
MaxColorFormat,
|
MaxColorFormat,
|
||||||
|
|
||||||
// Depth formats
|
// Depth formats
|
||||||
Z32F = 45,
|
Z32F = 46,
|
||||||
Z16 = 46,
|
Z16 = 47,
|
||||||
|
|
||||||
MaxDepthFormat,
|
MaxDepthFormat,
|
||||||
|
|
||||||
// DepthStencil formats
|
// DepthStencil formats
|
||||||
Z24S8 = 47,
|
Z24S8 = 48,
|
||||||
S8Z24 = 48,
|
S8Z24 = 49,
|
||||||
Z32FS8 = 49,
|
Z32FS8 = 50,
|
||||||
|
|
||||||
MaxDepthStencilFormat,
|
MaxDepthStencilFormat,
|
||||||
|
|
||||||
@ -192,6 +193,7 @@ struct SurfaceParams {
|
|||||||
1, // RG8S
|
1, // RG8S
|
||||||
1, // RG32UI
|
1, // RG32UI
|
||||||
1, // R32UI
|
1, // R32UI
|
||||||
|
4, // ASTC_2D_8X8
|
||||||
1, // Z32F
|
1, // Z32F
|
||||||
1, // Z16
|
1, // Z16
|
||||||
1, // Z24S8
|
1, // Z24S8
|
||||||
@ -253,6 +255,7 @@ struct SurfaceParams {
|
|||||||
16, // RG8S
|
16, // RG8S
|
||||||
64, // RG32UI
|
64, // RG32UI
|
||||||
32, // R32UI
|
32, // R32UI
|
||||||
|
16, // ASTC_2D_8X8
|
||||||
32, // Z32F
|
32, // Z32F
|
||||||
16, // Z16
|
16, // Z16
|
||||||
32, // Z24S8
|
32, // Z24S8
|
||||||
@ -522,6 +525,8 @@ struct SurfaceParams {
|
|||||||
return PixelFormat::BC6H_SF16;
|
return PixelFormat::BC6H_SF16;
|
||||||
case Tegra::Texture::TextureFormat::ASTC_2D_4X4:
|
case Tegra::Texture::TextureFormat::ASTC_2D_4X4:
|
||||||
return PixelFormat::ASTC_2D_4X4;
|
return PixelFormat::ASTC_2D_4X4;
|
||||||
|
case Tegra::Texture::TextureFormat::ASTC_2D_8X8:
|
||||||
|
return PixelFormat::ASTC_2D_8X8;
|
||||||
case Tegra::Texture::TextureFormat::R16_G16:
|
case Tegra::Texture::TextureFormat::R16_G16:
|
||||||
switch (component_type) {
|
switch (component_type) {
|
||||||
case Tegra::Texture::ComponentType::FLOAT:
|
case Tegra::Texture::ComponentType::FLOAT:
|
||||||
|
@ -63,6 +63,7 @@ u32 BytesPerPixel(TextureFormat format) {
|
|||||||
case TextureFormat::R32_G32_B32:
|
case TextureFormat::R32_G32_B32:
|
||||||
return 12;
|
return 12;
|
||||||
case TextureFormat::ASTC_2D_4X4:
|
case TextureFormat::ASTC_2D_4X4:
|
||||||
|
case TextureFormat::ASTC_2D_8X8:
|
||||||
case TextureFormat::A8R8G8B8:
|
case TextureFormat::A8R8G8B8:
|
||||||
case TextureFormat::A2B10G10R10:
|
case TextureFormat::A2B10G10R10:
|
||||||
case TextureFormat::BF10GF11RF11:
|
case TextureFormat::BF10GF11RF11:
|
||||||
@ -111,6 +112,7 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat
|
|||||||
case TextureFormat::BC6H_UF16:
|
case TextureFormat::BC6H_UF16:
|
||||||
case TextureFormat::BC6H_SF16:
|
case TextureFormat::BC6H_SF16:
|
||||||
case TextureFormat::ASTC_2D_4X4:
|
case TextureFormat::ASTC_2D_4X4:
|
||||||
|
case TextureFormat::ASTC_2D_8X8:
|
||||||
case TextureFormat::A8R8G8B8:
|
case TextureFormat::A8R8G8B8:
|
||||||
case TextureFormat::A2B10G10R10:
|
case TextureFormat::A2B10G10R10:
|
||||||
case TextureFormat::A1B5G5R5:
|
case TextureFormat::A1B5G5R5:
|
||||||
|
Loading…
Reference in New Issue
Block a user