1
0
Fork 0
forked from suyu/suyu

VideoCore: Implement formats needed for N64 emulation.

This commit is contained in:
Fernando Sahmkow 2022-04-13 20:19:06 +02:00
parent 770e19f51a
commit fd7afda1e8
6 changed files with 10 additions and 10 deletions

View file

@ -87,7 +87,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> FORMAT_TAB
{GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}, // BC3_SRGB {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}, // BC3_SRGB
{GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM}, // BC7_SRGB {GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM}, // BC7_SRGB
{GL_RGBA4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV}, // A4B4G4R4_UNORM {GL_RGBA4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV}, // A4B4G4R4_UNORM
{GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R4G4_UNORM {GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // G4R4_UNORM
{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR}, // ASTC_2D_4X4_SRGB {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR}, // ASTC_2D_4X4_SRGB
{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR}, // ASTC_2D_8X8_SRGB {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR}, // ASTC_2D_8X8_SRGB
{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR}, // ASTC_2D_8X5_SRGB {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR}, // ASTC_2D_8X5_SRGB

View file

@ -184,7 +184,7 @@ struct FormatTuple {
{VK_FORMAT_BC3_SRGB_BLOCK}, // BC3_SRGB {VK_FORMAT_BC3_SRGB_BLOCK}, // BC3_SRGB
{VK_FORMAT_BC7_SRGB_BLOCK}, // BC7_SRGB {VK_FORMAT_BC7_SRGB_BLOCK}, // BC7_SRGB
{VK_FORMAT_R4G4B4A4_UNORM_PACK16, Attachable}, // A4B4G4R4_UNORM {VK_FORMAT_R4G4B4A4_UNORM_PACK16, Attachable}, // A4B4G4R4_UNORM
{VK_FORMAT_R4G4_UNORM_PACK8}, // R4G4_UNORM {VK_FORMAT_R4G4_UNORM_PACK8}, // G4R4_UNORM
{VK_FORMAT_ASTC_4x4_SRGB_BLOCK}, // ASTC_2D_4X4_SRGB {VK_FORMAT_ASTC_4x4_SRGB_BLOCK}, // ASTC_2D_4X4_SRGB
{VK_FORMAT_ASTC_8x8_SRGB_BLOCK}, // ASTC_2D_8X8_SRGB {VK_FORMAT_ASTC_8x8_SRGB_BLOCK}, // ASTC_2D_8X8_SRGB
{VK_FORMAT_ASTC_8x5_SRGB_BLOCK}, // ASTC_2D_8X5_SRGB {VK_FORMAT_ASTC_8x5_SRGB_BLOCK}, // ASTC_2D_8X5_SRGB

View file

@ -592,7 +592,7 @@ void TryTransformSwizzleIfNeeded(PixelFormat format, std::array<SwizzleSource, 4
case PixelFormat::A5B5G5R1_UNORM: case PixelFormat::A5B5G5R1_UNORM:
std::ranges::transform(swizzle, swizzle.begin(), SwapSpecial); std::ranges::transform(swizzle, swizzle.begin(), SwapSpecial);
break; break;
case PixelFormat::R4G4_UNORM: case PixelFormat::G4R4_UNORM:
std::ranges::transform(swizzle, swizzle.begin(), SwapGreenRed); std::ranges::transform(swizzle, swizzle.begin(), SwapGreenRed);
break; break;
default: default:

View file

@ -82,7 +82,7 @@ enum class PixelFormat {
BC3_SRGB, BC3_SRGB,
BC7_SRGB, BC7_SRGB,
A4B4G4R4_UNORM, A4B4G4R4_UNORM,
R4G4_UNORM, G4R4_UNORM,
ASTC_2D_4X4_SRGB, ASTC_2D_4X4_SRGB,
ASTC_2D_8X8_SRGB, ASTC_2D_8X8_SRGB,
ASTC_2D_8X5_SRGB, ASTC_2D_8X5_SRGB,
@ -218,7 +218,7 @@ constexpr std::array<u8, MaxPixelFormat> BLOCK_WIDTH_TABLE = {{
4, // BC3_SRGB 4, // BC3_SRGB
4, // BC7_SRGB 4, // BC7_SRGB
1, // A4B4G4R4_UNORM 1, // A4B4G4R4_UNORM
1, // R4G4_UNORM 1, // G4R4_UNORM
4, // ASTC_2D_4X4_SRGB 4, // ASTC_2D_4X4_SRGB
8, // ASTC_2D_8X8_SRGB 8, // ASTC_2D_8X8_SRGB
8, // ASTC_2D_8X5_SRGB 8, // ASTC_2D_8X5_SRGB
@ -323,7 +323,7 @@ constexpr std::array<u8, MaxPixelFormat> BLOCK_HEIGHT_TABLE = {{
4, // BC3_SRGB 4, // BC3_SRGB
4, // BC7_SRGB 4, // BC7_SRGB
1, // A4B4G4R4_UNORM 1, // A4B4G4R4_UNORM
1, // R4G4_UNORM 1, // G4R4_UNORM
4, // ASTC_2D_4X4_SRGB 4, // ASTC_2D_4X4_SRGB
8, // ASTC_2D_8X8_SRGB 8, // ASTC_2D_8X8_SRGB
5, // ASTC_2D_8X5_SRGB 5, // ASTC_2D_8X5_SRGB
@ -428,7 +428,7 @@ constexpr std::array<u8, MaxPixelFormat> BITS_PER_BLOCK_TABLE = {{
128, // BC3_SRGB 128, // BC3_SRGB
128, // BC7_UNORM 128, // BC7_UNORM
16, // A4B4G4R4_UNORM 16, // A4B4G4R4_UNORM
8, // R4G4_UNORM 8, // G4R4_UNORM
128, // ASTC_2D_4X4_SRGB 128, // ASTC_2D_4X4_SRGB
128, // ASTC_2D_8X8_SRGB 128, // ASTC_2D_8X8_SRGB
128, // ASTC_2D_8X5_SRGB 128, // ASTC_2D_8X5_SRGB

View file

@ -63,7 +63,7 @@ PixelFormat PixelFormatFromTextureInfo(TextureFormat format, ComponentType red,
case Hash(TextureFormat::A4B4G4R4, UNORM): case Hash(TextureFormat::A4B4G4R4, UNORM):
return PixelFormat::A4B4G4R4_UNORM; return PixelFormat::A4B4G4R4_UNORM;
case Hash(TextureFormat::G4R4, UNORM): case Hash(TextureFormat::G4R4, UNORM):
return PixelFormat::R4G4_UNORM; return PixelFormat::G4R4_UNORM;
case Hash(TextureFormat::A5B5G5R1, UNORM): case Hash(TextureFormat::A5B5G5R1, UNORM):
return PixelFormat::A5B5G5R1_UNORM; return PixelFormat::A5B5G5R1_UNORM;
case Hash(TextureFormat::R8, UNORM): case Hash(TextureFormat::R8, UNORM):

View file

@ -153,8 +153,8 @@ struct fmt::formatter<VideoCore::Surface::PixelFormat> : fmt::formatter<fmt::str
return "BC7_SRGB"; return "BC7_SRGB";
case PixelFormat::A4B4G4R4_UNORM: case PixelFormat::A4B4G4R4_UNORM:
return "A4B4G4R4_UNORM"; return "A4B4G4R4_UNORM";
case PixelFormat::R4G4_UNORM: case PixelFormat::G4R4_UNORM:
return "R4G4_UNORM"; return "G4R4_UNORM";
case PixelFormat::ASTC_2D_4X4_SRGB: case PixelFormat::ASTC_2D_4X4_SRGB:
return "ASTC_2D_4X4_SRGB"; return "ASTC_2D_4X4_SRGB";
case PixelFormat::ASTC_2D_8X8_SRGB: case PixelFormat::ASTC_2D_8X8_SRGB: