mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
video_core: Update texture format
This commit is contained in:
parent
ec4e2d1fab
commit
c8ad039612
|
@ -166,7 +166,7 @@ struct FormatTuple {
|
|||
{VK_FORMAT_R16G16_UINT, Attachable | Storage}, // R16G16_UINT
|
||||
{VK_FORMAT_R16G16_SINT, Attachable | Storage}, // R16G16_SINT
|
||||
{VK_FORMAT_R16G16_SNORM, Attachable | Storage}, // R16G16_SNORM
|
||||
{VK_FORMAT_UNDEFINED}, // R32G32B32_FLOAT
|
||||
{VK_FORMAT_R32G32B32_SFLOAT}, // R32G32B32_FLOAT
|
||||
{VK_FORMAT_A8B8G8R8_SRGB_PACK32, Attachable}, // A8B8G8R8_SRGB
|
||||
{VK_FORMAT_R8G8_UNORM, Attachable | Storage}, // R8G8_UNORM
|
||||
{VK_FORMAT_R8G8_SNORM, Attachable | Storage}, // R8G8_SNORM
|
||||
|
@ -234,11 +234,6 @@ FormatInfo SurfaceFormat(const Device& device, FormatType format_type, bool with
|
|||
PixelFormat pixel_format) {
|
||||
ASSERT(static_cast<size_t>(pixel_format) < std::size(tex_format_tuples));
|
||||
FormatTuple tuple = tex_format_tuples[static_cast<size_t>(pixel_format)];
|
||||
if (tuple.format == VK_FORMAT_UNDEFINED) {
|
||||
UNIMPLEMENTED_MSG("Unimplemented texture format with pixel format={}", pixel_format);
|
||||
return FormatInfo{VK_FORMAT_A8B8G8R8_UNORM_PACK32, true, true};
|
||||
}
|
||||
|
||||
// Use A8B8G8R8_UNORM on hardware that doesn't support ASTC natively
|
||||
if (!device.IsOptimalAstcSupported() && VideoCore::Surface::IsPixelFormatASTC(pixel_format)) {
|
||||
const bool is_srgb = with_srgb && VideoCore::Surface::IsPixelFormatSRGB(pixel_format);
|
||||
|
|
|
@ -42,15 +42,15 @@ PixelFormat PixelFormatFromTextureInfo(TextureFormat format, ComponentType red,
|
|||
ComponentType blue, ComponentType alpha,
|
||||
bool is_srgb) noexcept {
|
||||
switch (Hash(format, red, green, blue, alpha, is_srgb)) {
|
||||
case Hash(TextureFormat::A8R8G8B8, UNORM):
|
||||
case Hash(TextureFormat::A8B8G8R8, UNORM):
|
||||
return PixelFormat::A8B8G8R8_UNORM;
|
||||
case Hash(TextureFormat::A8R8G8B8, SNORM):
|
||||
case Hash(TextureFormat::A8B8G8R8, SNORM):
|
||||
return PixelFormat::A8B8G8R8_SNORM;
|
||||
case Hash(TextureFormat::A8R8G8B8, UINT):
|
||||
case Hash(TextureFormat::A8B8G8R8, UINT):
|
||||
return PixelFormat::A8B8G8R8_UINT;
|
||||
case Hash(TextureFormat::A8R8G8B8, SINT):
|
||||
case Hash(TextureFormat::A8B8G8R8, SINT):
|
||||
return PixelFormat::A8B8G8R8_SINT;
|
||||
case Hash(TextureFormat::A8R8G8B8, UNORM, SRGB):
|
||||
case Hash(TextureFormat::A8B8G8R8, UNORM, SRGB):
|
||||
return PixelFormat::A8B8G8R8_SRGB;
|
||||
case Hash(TextureFormat::B5G6R5, UNORM):
|
||||
return PixelFormat::B5G6R5_UNORM;
|
||||
|
@ -74,13 +74,13 @@ PixelFormat PixelFormatFromTextureInfo(TextureFormat format, ComponentType red,
|
|||
return PixelFormat::R8_UINT;
|
||||
case Hash(TextureFormat::R8, SINT):
|
||||
return PixelFormat::R8_SINT;
|
||||
case Hash(TextureFormat::R8G8, UNORM):
|
||||
case Hash(TextureFormat::G8R8, UNORM):
|
||||
return PixelFormat::R8G8_UNORM;
|
||||
case Hash(TextureFormat::R8G8, SNORM):
|
||||
case Hash(TextureFormat::G8R8, SNORM):
|
||||
return PixelFormat::R8G8_SNORM;
|
||||
case Hash(TextureFormat::R8G8, UINT):
|
||||
case Hash(TextureFormat::G8R8, UINT):
|
||||
return PixelFormat::R8G8_UINT;
|
||||
case Hash(TextureFormat::R8G8, SINT):
|
||||
case Hash(TextureFormat::G8R8, SINT):
|
||||
return PixelFormat::R8G8_SINT;
|
||||
case Hash(TextureFormat::R16G16B16A16, FLOAT):
|
||||
return PixelFormat::R16G16B16A16_FLOAT;
|
||||
|
@ -136,49 +136,49 @@ PixelFormat PixelFormatFromTextureInfo(TextureFormat format, ComponentType red,
|
|||
return PixelFormat::R32_SINT;
|
||||
case Hash(TextureFormat::E5B9G9R9, FLOAT):
|
||||
return PixelFormat::E5B9G9R9_FLOAT;
|
||||
case Hash(TextureFormat::D32, FLOAT):
|
||||
case Hash(TextureFormat::Z32, FLOAT):
|
||||
return PixelFormat::D32_FLOAT;
|
||||
case Hash(TextureFormat::D16, UNORM):
|
||||
case Hash(TextureFormat::Z16, UNORM):
|
||||
return PixelFormat::D16_UNORM;
|
||||
case Hash(TextureFormat::S8D24, UINT, UNORM, UNORM, UNORM, LINEAR):
|
||||
case Hash(TextureFormat::Z24S8, UINT, UNORM, UNORM, UNORM, LINEAR):
|
||||
return PixelFormat::S8_UINT_D24_UNORM;
|
||||
case Hash(TextureFormat::S8D24, UINT, UNORM, UINT, UINT, LINEAR):
|
||||
case Hash(TextureFormat::Z24S8, UINT, UNORM, UINT, UINT, LINEAR):
|
||||
return PixelFormat::S8_UINT_D24_UNORM;
|
||||
case Hash(TextureFormat::R8G24, UINT, UNORM, UNORM, UNORM, LINEAR):
|
||||
case Hash(TextureFormat::G24R8, UINT, UNORM, UNORM, UNORM, LINEAR):
|
||||
return PixelFormat::S8_UINT_D24_UNORM;
|
||||
case Hash(TextureFormat::D24S8, UNORM, UINT, UINT, UINT, LINEAR):
|
||||
case Hash(TextureFormat::S8Z24, UNORM, UINT, UINT, UINT, LINEAR):
|
||||
return PixelFormat::D24_UNORM_S8_UINT;
|
||||
case Hash(TextureFormat::D32S8, FLOAT, UINT, UNORM, UNORM, LINEAR):
|
||||
case Hash(TextureFormat::Z32_X24S8, FLOAT, UINT, UNORM, UNORM, LINEAR):
|
||||
return PixelFormat::D32_FLOAT_S8_UINT;
|
||||
case Hash(TextureFormat::R32_B24G8, FLOAT, UINT, UNORM, UNORM, LINEAR):
|
||||
case Hash(TextureFormat::R32B24G8, FLOAT, UINT, UNORM, UNORM, LINEAR):
|
||||
return PixelFormat::D32_FLOAT_S8_UINT;
|
||||
case Hash(TextureFormat::BC1_RGBA, UNORM, LINEAR):
|
||||
case Hash(TextureFormat::DXT1, UNORM, LINEAR):
|
||||
return PixelFormat::BC1_RGBA_UNORM;
|
||||
case Hash(TextureFormat::BC1_RGBA, UNORM, SRGB):
|
||||
case Hash(TextureFormat::DXT1, UNORM, SRGB):
|
||||
return PixelFormat::BC1_RGBA_SRGB;
|
||||
case Hash(TextureFormat::BC2, UNORM, LINEAR):
|
||||
case Hash(TextureFormat::DXT23, UNORM, LINEAR):
|
||||
return PixelFormat::BC2_UNORM;
|
||||
case Hash(TextureFormat::BC2, UNORM, SRGB):
|
||||
case Hash(TextureFormat::DXT23, UNORM, SRGB):
|
||||
return PixelFormat::BC2_SRGB;
|
||||
case Hash(TextureFormat::BC3, UNORM, LINEAR):
|
||||
case Hash(TextureFormat::DXT45, UNORM, LINEAR):
|
||||
return PixelFormat::BC3_UNORM;
|
||||
case Hash(TextureFormat::BC3, UNORM, SRGB):
|
||||
case Hash(TextureFormat::DXT45, UNORM, SRGB):
|
||||
return PixelFormat::BC3_SRGB;
|
||||
case Hash(TextureFormat::BC4, UNORM):
|
||||
case Hash(TextureFormat::DXN1, UNORM):
|
||||
return PixelFormat::BC4_UNORM;
|
||||
case Hash(TextureFormat::BC4, SNORM):
|
||||
case Hash(TextureFormat::DXN1, SNORM):
|
||||
return PixelFormat::BC4_SNORM;
|
||||
case Hash(TextureFormat::BC5, UNORM):
|
||||
case Hash(TextureFormat::DXN2, UNORM):
|
||||
return PixelFormat::BC5_UNORM;
|
||||
case Hash(TextureFormat::BC5, SNORM):
|
||||
case Hash(TextureFormat::DXN2, SNORM):
|
||||
return PixelFormat::BC5_SNORM;
|
||||
case Hash(TextureFormat::BC7, UNORM, LINEAR):
|
||||
case Hash(TextureFormat::BC7U, UNORM, LINEAR):
|
||||
return PixelFormat::BC7_UNORM;
|
||||
case Hash(TextureFormat::BC7, UNORM, SRGB):
|
||||
case Hash(TextureFormat::BC7U, UNORM, SRGB):
|
||||
return PixelFormat::BC7_SRGB;
|
||||
case Hash(TextureFormat::BC6H_SFLOAT, FLOAT):
|
||||
case Hash(TextureFormat::BC6H_S16, FLOAT):
|
||||
return PixelFormat::BC6H_SFLOAT;
|
||||
case Hash(TextureFormat::BC6H_UFLOAT, FLOAT):
|
||||
case Hash(TextureFormat::BC6H_U16, FLOAT):
|
||||
return PixelFormat::BC6H_UFLOAT;
|
||||
case Hash(TextureFormat::ASTC_2D_4X4, UNORM, LINEAR):
|
||||
return PixelFormat::ASTC_2D_4X4_UNORM;
|
||||
|
|
|
@ -15,26 +15,26 @@ enum class TextureFormat : u32 {
|
|||
R32G32B32 = 0x02,
|
||||
R16G16B16A16 = 0x03,
|
||||
R32G32 = 0x04,
|
||||
R32_B24G8 = 0x05,
|
||||
R32B24G8 = 0x05,
|
||||
ETC2_RGB = 0x06,
|
||||
X8B8G8R8 = 0x07,
|
||||
A8R8G8B8 = 0x08,
|
||||
A8B8G8R8 = 0x08,
|
||||
A2B10G10R10 = 0x09,
|
||||
ETC2_RGB_PTA = 0x0a,
|
||||
ETC2_RGBA = 0x0b,
|
||||
R16G16 = 0x0c,
|
||||
R24G8 = 0x0d,
|
||||
R8G24 = 0x0e,
|
||||
G8R24 = 0x0d,
|
||||
G24R8 = 0x0e,
|
||||
R32 = 0x0f,
|
||||
BC6H_SFLOAT = 0x10,
|
||||
BC6H_UFLOAT = 0x11,
|
||||
BC6H_S16 = 0x10,
|
||||
BC6H_U16 = 0x11,
|
||||
A4B4G4R4 = 0x12,
|
||||
A5B5G5R1 = 0x13,
|
||||
A1B5G5R5 = 0x14,
|
||||
B5G6R5 = 0x15,
|
||||
B6G5R5 = 0x16,
|
||||
BC7 = 0x17,
|
||||
R8G8 = 0x18,
|
||||
BC7U = 0x17,
|
||||
G8R8 = 0x18,
|
||||
EAC = 0x19,
|
||||
EACX2 = 0x1a,
|
||||
R16 = 0x1b,
|
||||
|
@ -46,33 +46,33 @@ enum class TextureFormat : u32 {
|
|||
B10G11R11 = 0x21,
|
||||
G8B8G8R8 = 0x22,
|
||||
B8G8R8G8 = 0x23,
|
||||
BC1_RGBA = 0x24,
|
||||
BC2 = 0x25,
|
||||
BC3 = 0x26,
|
||||
BC4 = 0x27,
|
||||
BC5 = 0x28,
|
||||
S8D24 = 0x29,
|
||||
X8D24 = 0x2a,
|
||||
D24S8 = 0x2b,
|
||||
X4V4D24__COV4R4V = 0x2c,
|
||||
X4V4D24__COV8R8V = 0x2d,
|
||||
V8D24__COV4R12V = 0x2e,
|
||||
D32 = 0x2f,
|
||||
D32S8 = 0x30,
|
||||
X8D24_X20V4S8__COV4R4V = 0x31,
|
||||
X8D24_X20V4S8__COV8R8V = 0x32,
|
||||
D32_X20V4X8__COV4R4V = 0x33,
|
||||
D32_X20V4X8__COV8R8V = 0x34,
|
||||
D32_X20V4S8__COV4R4V = 0x35,
|
||||
D32_X20V4S8__COV8R8V = 0x36,
|
||||
X8D24_X16V8S8__COV4R12V = 0x37,
|
||||
D32_X16V8X8__COV4R12V = 0x38,
|
||||
D32_X16V8S8__COV4R12V = 0x39,
|
||||
D16 = 0x3a,
|
||||
V8D24__COV8R24V = 0x3b,
|
||||
X8D24_X16V8S8__COV8R24V = 0x3c,
|
||||
D32_X16V8X8__COV8R24V = 0x3d,
|
||||
D32_X16V8S8__COV8R24V = 0x3e,
|
||||
DXT1 = 0x24,
|
||||
DXT23 = 0x25,
|
||||
DXT45 = 0x26,
|
||||
DXN1 = 0x27,
|
||||
DXN2 = 0x28,
|
||||
Z24S8 = 0x29,
|
||||
X8Z24 = 0x2a,
|
||||
S8Z24 = 0x2b,
|
||||
X4V4Z24__COV4R4V = 0x2c,
|
||||
X4V4Z24__COV8R8V = 0x2d,
|
||||
V8Z24__COV4R12V = 0x2e,
|
||||
Z32 = 0x2f,
|
||||
Z32_X24S8 = 0x30,
|
||||
X8Z24_X20V4S8__COV4R4V = 0x31,
|
||||
X8Z24_X20V4S8__COV8R8V = 0x32,
|
||||
Z32_X20V4X8__COV4R4V = 0x33,
|
||||
Z32_X20V4X8__COV8R8V = 0x34,
|
||||
Z32_X20V4S8__COV4R4V = 0x35,
|
||||
Z32_X20V4S8__COV8R8V = 0x36,
|
||||
X8Z24_X16V8S8__COV4R12V = 0x37,
|
||||
Z32_X16V8X8__COV4R12V = 0x38,
|
||||
Z32_X16V8S8__COV4R12V = 0x39,
|
||||
Z16 = 0x3a,
|
||||
V8Z24__COV8R24V = 0x3b,
|
||||
X8Z24_X16V8S8__COV8R24V = 0x3c,
|
||||
Z32_X16V8X8__COV8R24V = 0x3d,
|
||||
Z32_X16V8S8__COV8R24V = 0x3e,
|
||||
ASTC_2D_4X4 = 0x40,
|
||||
ASTC_2D_5X5 = 0x41,
|
||||
ASTC_2D_6X6 = 0x42,
|
||||
|
|
Loading…
Reference in a new issue