mirror of
https://github.com/yuzu-mirror/yuzu
synced 2024-11-27 20:10:27 +00:00
Surfaces: Implement ASTC 6x6 10x10 12x12 8x6 6x5
This commit is contained in:
parent
e664c24355
commit
b9ddb517b1
4 changed files with 185 additions and 70 deletions
|
@ -101,6 +101,16 @@ static constexpr ConversionArray morton_to_linear_fns = {
|
|||
MortonCopy<true, PixelFormat::ASTC_2D_5X5_SRGB>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_10X8>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_10X8_SRGB>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_6X6>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_6X6_SRGB>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_10X10>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_10X10_SRGB>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_12X12>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_12X12_SRGB>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_8X6>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_8X6_SRGB>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_6X5>,
|
||||
MortonCopy<true, PixelFormat::ASTC_2D_6X5_SRGB>,
|
||||
MortonCopy<true, PixelFormat::Z32F>,
|
||||
MortonCopy<true, PixelFormat::Z16>,
|
||||
MortonCopy<true, PixelFormat::Z24S8>,
|
||||
|
@ -170,6 +180,16 @@ static constexpr ConversionArray linear_to_morton_fns = {
|
|||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
MortonCopy<false, PixelFormat::Z32F>,
|
||||
MortonCopy<false, PixelFormat::Z16>,
|
||||
MortonCopy<false, PixelFormat::Z24S8>,
|
||||
|
|
|
@ -120,6 +120,16 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format
|
|||
{GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_5X5_SRGB
|
||||
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_10X8
|
||||
{GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_10X8_SRGB
|
||||
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_6X6
|
||||
{GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_6X6_SRGB
|
||||
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_10X10
|
||||
{GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_10X10_SRGB
|
||||
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_12X12
|
||||
{GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_12X12_SRGB
|
||||
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_8X6
|
||||
{GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_8X6_SRGB
|
||||
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_6X5
|
||||
{GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_6X5_SRGB
|
||||
|
||||
// Depth formats
|
||||
{GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F
|
||||
|
|
|
@ -350,6 +350,16 @@ PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format,
|
|||
return is_srgb ? PixelFormat::ASTC_2D_8X5_SRGB : PixelFormat::ASTC_2D_8X5;
|
||||
case Tegra::Texture::TextureFormat::ASTC_2D_10X8:
|
||||
return is_srgb ? PixelFormat::ASTC_2D_10X8_SRGB : PixelFormat::ASTC_2D_10X8;
|
||||
case Tegra::Texture::TextureFormat::ASTC_2D_6X6:
|
||||
return is_srgb ? PixelFormat::ASTC_2D_6X6_SRGB : PixelFormat::ASTC_2D_6X6;
|
||||
case Tegra::Texture::TextureFormat::ASTC_2D_10X10:
|
||||
return is_srgb ? PixelFormat::ASTC_2D_10X10_SRGB : PixelFormat::ASTC_2D_10X10;
|
||||
case Tegra::Texture::TextureFormat::ASTC_2D_12X12:
|
||||
return is_srgb ? PixelFormat::ASTC_2D_12X12_SRGB : PixelFormat::ASTC_2D_12X12;
|
||||
case Tegra::Texture::TextureFormat::ASTC_2D_8X6:
|
||||
return is_srgb ? PixelFormat::ASTC_2D_8X6_SRGB : PixelFormat::ASTC_2D_8X6;
|
||||
case Tegra::Texture::TextureFormat::ASTC_2D_6X5:
|
||||
return is_srgb ? PixelFormat::ASTC_2D_6X5_SRGB : PixelFormat::ASTC_2D_6X5;
|
||||
case Tegra::Texture::TextureFormat::R16_G16:
|
||||
switch (component_type) {
|
||||
case Tegra::Texture::ComponentType::FLOAT:
|
||||
|
@ -510,6 +520,16 @@ bool IsPixelFormatASTC(PixelFormat format) {
|
|||
case PixelFormat::ASTC_2D_8X5_SRGB:
|
||||
case PixelFormat::ASTC_2D_10X8:
|
||||
case PixelFormat::ASTC_2D_10X8_SRGB:
|
||||
case PixelFormat::ASTC_2D_6X6:
|
||||
case PixelFormat::ASTC_2D_6X6_SRGB:
|
||||
case PixelFormat::ASTC_2D_10X10:
|
||||
case PixelFormat::ASTC_2D_10X10_SRGB:
|
||||
case PixelFormat::ASTC_2D_12X12:
|
||||
case PixelFormat::ASTC_2D_12X12_SRGB:
|
||||
case PixelFormat::ASTC_2D_8X6:
|
||||
case PixelFormat::ASTC_2D_8X6_SRGB:
|
||||
case PixelFormat::ASTC_2D_6X5:
|
||||
case PixelFormat::ASTC_2D_6X5_SRGB:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
@ -530,6 +550,11 @@ bool IsPixelFormatSRGB(PixelFormat format) {
|
|||
case PixelFormat::ASTC_2D_5X4_SRGB:
|
||||
case PixelFormat::ASTC_2D_5X5_SRGB:
|
||||
case PixelFormat::ASTC_2D_10X8_SRGB:
|
||||
case PixelFormat::ASTC_2D_6X6_SRGB:
|
||||
case PixelFormat::ASTC_2D_10X10_SRGB:
|
||||
case PixelFormat::ASTC_2D_12X12_SRGB:
|
||||
case PixelFormat::ASTC_2D_8X6_SRGB:
|
||||
case PixelFormat::ASTC_2D_6X5_SRGB:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
|
|
@ -75,19 +75,29 @@ enum class PixelFormat {
|
|||
ASTC_2D_5X5_SRGB = 57,
|
||||
ASTC_2D_10X8 = 58,
|
||||
ASTC_2D_10X8_SRGB = 59,
|
||||
ASTC_2D_6X6 = 60,
|
||||
ASTC_2D_6X6_SRGB = 61,
|
||||
ASTC_2D_10X10 = 62,
|
||||
ASTC_2D_10X10_SRGB = 63,
|
||||
ASTC_2D_12X12 = 64,
|
||||
ASTC_2D_12X12_SRGB = 65,
|
||||
ASTC_2D_8X6 = 66,
|
||||
ASTC_2D_8X6_SRGB = 67,
|
||||
ASTC_2D_6X5 = 68,
|
||||
ASTC_2D_6X5_SRGB = 69,
|
||||
|
||||
MaxColorFormat,
|
||||
|
||||
// Depth formats
|
||||
Z32F = 60,
|
||||
Z16 = 61,
|
||||
Z32F = 70,
|
||||
Z16 = 71,
|
||||
|
||||
MaxDepthFormat,
|
||||
|
||||
// DepthStencil formats
|
||||
Z24S8 = 62,
|
||||
S8Z24 = 63,
|
||||
Z32FS8 = 64,
|
||||
Z24S8 = 72,
|
||||
S8Z24 = 73,
|
||||
Z32FS8 = 74,
|
||||
|
||||
MaxDepthStencilFormat,
|
||||
|
||||
|
@ -185,6 +195,16 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{
|
|||
2, // ASTC_2D_5X5_SRGB
|
||||
2, // ASTC_2D_10X8
|
||||
2, // ASTC_2D_10X8_SRGB
|
||||
2, // ASTC_2D_6X6
|
||||
2, // ASTC_2D_6X6_SRGB
|
||||
2, // ASTC_2D_10X10
|
||||
2, // ASTC_2D_10X10_SRGB
|
||||
2, // ASTC_2D_12X12
|
||||
2, // ASTC_2D_12X12_SRGB
|
||||
2, // ASTC_2D_8X6
|
||||
2, // ASTC_2D_8X6_SRGB
|
||||
2, // ASTC_2D_6X5
|
||||
2, // ASTC_2D_6X5_SRGB
|
||||
0, // Z32F
|
||||
0, // Z16
|
||||
0, // Z24S8
|
||||
|
@ -269,6 +289,16 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{
|
|||
5, // ASTC_2D_5X5_SRGB
|
||||
10, // ASTC_2D_10X8
|
||||
10, // ASTC_2D_10X8_SRGB
|
||||
6, // ASTC_2D_6X6
|
||||
6, // ASTC_2D_6X6_SRGB
|
||||
10, // ASTC_2D_10X10
|
||||
10, // ASTC_2D_10X10_SRGB
|
||||
12, // ASTC_2D_12X12
|
||||
12, // ASTC_2D_12X12_SRGB
|
||||
8, // ASTC_2D_8X6
|
||||
8, // ASTC_2D_8X6_SRGB
|
||||
6, // ASTC_2D_6X5
|
||||
6, // ASTC_2D_6X5_SRGB
|
||||
1, // Z32F
|
||||
1, // Z16
|
||||
1, // Z24S8
|
||||
|
@ -345,6 +375,16 @@ constexpr std::array<u32, MaxPixelFormat> block_height_table = {{
|
|||
5, // ASTC_2D_5X5_SRGB
|
||||
8, // ASTC_2D_10X8
|
||||
8, // ASTC_2D_10X8_SRGB
|
||||
6, // ASTC_2D_6X6
|
||||
6, // ASTC_2D_6X6_SRGB
|
||||
10, // ASTC_2D_10X10
|
||||
10, // ASTC_2D_10X10_SRGB
|
||||
12, // ASTC_2D_12X12
|
||||
12, // ASTC_2D_12X12_SRGB
|
||||
6, // ASTC_2D_8X6
|
||||
6, // ASTC_2D_8X6_SRGB
|
||||
5, // ASTC_2D_6X5
|
||||
5, // ASTC_2D_6X5_SRGB
|
||||
1, // Z32F
|
||||
1, // Z16
|
||||
1, // Z24S8
|
||||
|
@ -421,6 +461,16 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{
|
|||
128, // ASTC_2D_5X5_SRGB
|
||||
128, // ASTC_2D_10X8
|
||||
128, // ASTC_2D_10X8_SRGB
|
||||
128, // ASTC_2D_6X6
|
||||
128, // ASTC_2D_6X6_SRGB
|
||||
128, // ASTC_2D_10X10
|
||||
128, // ASTC_2D_10X10_SRGB
|
||||
128, // ASTC_2D_12X12
|
||||
128, // ASTC_2D_12X12_SRGB
|
||||
128, // ASTC_2D_8X6
|
||||
128, // ASTC_2D_8X6_SRGB
|
||||
128, // ASTC_2D_6X5
|
||||
128, // ASTC_2D_6X5_SRGB
|
||||
32, // Z32F
|
||||
16, // Z16
|
||||
32, // Z24S8
|
||||
|
@ -512,6 +562,16 @@ constexpr std::array<SurfaceCompression, MaxPixelFormat> compression_type_table
|
|||
SurfaceCompression::Converted, // ASTC_2D_5X5_SRGB
|
||||
SurfaceCompression::Converted, // ASTC_2D_10X8
|
||||
SurfaceCompression::Converted, // ASTC_2D_10X8_SRGB
|
||||
SurfaceCompression::Converted, // ASTC_2D_6X6
|
||||
SurfaceCompression::Converted, // ASTC_2D_6X6_SRGB
|
||||
SurfaceCompression::Converted, // ASTC_2D_10X10
|
||||
SurfaceCompression::Converted, // ASTC_2D_10X10_SRGB
|
||||
SurfaceCompression::Converted, // ASTC_2D_12X12
|
||||
SurfaceCompression::Converted, // ASTC_2D_12X12_SRGB
|
||||
SurfaceCompression::Converted, // ASTC_2D_8X6
|
||||
SurfaceCompression::Converted, // ASTC_2D_8X6_SRGB
|
||||
SurfaceCompression::Converted, // ASTC_2D_6X5
|
||||
SurfaceCompression::Converted, // ASTC_2D_6X5_SRGB
|
||||
SurfaceCompression::None, // Z32F
|
||||
SurfaceCompression::None, // Z16
|
||||
SurfaceCompression::None, // Z24S8
|
||||
|
|
Loading…
Reference in a new issue