forked from suyu/suyu
video_core: Implement RGBA32_SINT render target
This commit is contained in:
parent
9338599d72
commit
1d20aac795
7 changed files with 71 additions and 58 deletions
|
@ -54,6 +54,7 @@ enum class RenderTargetFormat : u32 {
|
|||
BGRA8_UNORM = 0xCF,
|
||||
BGRA8_SRGB = 0xD0,
|
||||
RGB10_A2_UNORM = 0xD1,
|
||||
RGB10_A2_UINT = 0xD2,
|
||||
RGBA8_UNORM = 0xD5,
|
||||
RGBA8_SRGB = 0xD6,
|
||||
RGBA8_SNORM = 0xD7,
|
||||
|
|
|
@ -47,6 +47,7 @@ static constexpr ConversionArray morton_to_linear_fns = {
|
|||
MortonCopy<true, PixelFormat::ABGR8UI>,
|
||||
MortonCopy<true, PixelFormat::B5G6R5U>,
|
||||
MortonCopy<true, PixelFormat::A2B10G10R10U>,
|
||||
MortonCopy<true, PixelFormat::A2B10G10R10UI>,
|
||||
MortonCopy<true, PixelFormat::A1B5G5R5U>,
|
||||
MortonCopy<true, PixelFormat::R8U>,
|
||||
MortonCopy<true, PixelFormat::R8S>,
|
||||
|
@ -137,6 +138,7 @@ static constexpr ConversionArray linear_to_morton_fns = {
|
|||
MortonCopy<false, PixelFormat::ABGR8UI>,
|
||||
MortonCopy<false, PixelFormat::B5G6R5U>,
|
||||
MortonCopy<false, PixelFormat::A2B10G10R10U>,
|
||||
MortonCopy<false, PixelFormat::A2B10G10R10UI>,
|
||||
MortonCopy<false, PixelFormat::A1B5G5R5U>,
|
||||
MortonCopy<false, PixelFormat::R8U>,
|
||||
MortonCopy<false, PixelFormat::R8S>,
|
||||
|
|
|
@ -41,64 +41,65 @@ struct FormatTuple {
|
|||
};
|
||||
|
||||
constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format_tuples = {{
|
||||
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // ABGR8U
|
||||
{GL_RGBA8_SNORM, GL_RGBA, GL_BYTE}, // ABGR8S
|
||||
{GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE}, // ABGR8I
|
||||
{GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE}, // ABGR8UI
|
||||
{GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV}, // B5G6R5U
|
||||
{GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10U
|
||||
{GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // A1B5G5R5U
|
||||
{GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R8U
|
||||
{GL_R8_SNORM, GL_RED, GL_BYTE}, // R8S
|
||||
{GL_R8I, GL_RED_INTEGER, GL_BYTE}, // R8I
|
||||
{GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE}, // R8UI
|
||||
{GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT}, // RGBA16F
|
||||
{GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT}, // RGBA16U
|
||||
{GL_RGBA16_SNORM, GL_RGBA, GL_SHORT}, // RGBA16S
|
||||
{GL_RGBA16I, GL_RGBA_INTEGER, GL_SHORT}, // RGBA16I
|
||||
{GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT}, // RGBA16UI
|
||||
{GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV}, // R11FG11FB10F
|
||||
{GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT}, // RGBA32UI
|
||||
{GL_COMPRESSED_RGBA_S3TC_DXT1_EXT}, // DXT1
|
||||
{GL_COMPRESSED_RGBA_S3TC_DXT3_EXT}, // DXT23
|
||||
{GL_COMPRESSED_RGBA_S3TC_DXT5_EXT}, // DXT45
|
||||
{GL_COMPRESSED_RED_RGTC1}, // DXN1
|
||||
{GL_COMPRESSED_RG_RGTC2}, // DXN2UNORM
|
||||
{GL_COMPRESSED_SIGNED_RG_RGTC2}, // DXN2SNORM
|
||||
{GL_COMPRESSED_RGBA_BPTC_UNORM}, // BC7U
|
||||
{GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT}, // BC6H_UF16
|
||||
{GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT}, // BC6H_SF16
|
||||
{GL_COMPRESSED_RGBA_ASTC_4x4_KHR}, // ASTC_2D_4X4
|
||||
{GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE}, // BGRA8
|
||||
{GL_RGBA32F, GL_RGBA, GL_FLOAT}, // RGBA32F
|
||||
{GL_RGBA32I, GL_RGBA_INTEGER, GL_INT}, // RGBA32I
|
||||
{GL_RG32F, GL_RG, GL_FLOAT}, // RG32F
|
||||
{GL_RG32I, GL_RG_INTEGER, GL_INT}, // RG32I
|
||||
{GL_R32F, GL_RED, GL_FLOAT}, // R32F
|
||||
{GL_R16F, GL_RED, GL_HALF_FLOAT}, // R16F
|
||||
{GL_R16, GL_RED, GL_UNSIGNED_SHORT}, // R16U
|
||||
{GL_R16_SNORM, GL_RED, GL_SHORT}, // R16S
|
||||
{GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT}, // R16UI
|
||||
{GL_R16I, GL_RED_INTEGER, GL_SHORT}, // R16I
|
||||
{GL_RG16, GL_RG, GL_UNSIGNED_SHORT}, // RG16
|
||||
{GL_RG16F, GL_RG, GL_HALF_FLOAT}, // RG16F
|
||||
{GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT}, // RG16UI
|
||||
{GL_RG16I, GL_RG_INTEGER, GL_SHORT}, // RG16I
|
||||
{GL_RG16_SNORM, GL_RG, GL_SHORT}, // RG16S
|
||||
{GL_RGB32F, GL_RGB, GL_FLOAT}, // RGB32F
|
||||
{GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // RGBA8_SRGB
|
||||
{GL_RG8, GL_RG, GL_UNSIGNED_BYTE}, // RG8U
|
||||
{GL_RG8_SNORM, GL_RG, GL_BYTE}, // RG8S
|
||||
{GL_RG8I, GL_RG_INTEGER, GL_BYTE}, // RG8I
|
||||
{GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_BYTE}, // RG8UI
|
||||
{GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT}, // RG32UI
|
||||
{GL_RGB16F, GL_RGBA, GL_HALF_FLOAT}, // RGBX16F
|
||||
{GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT}, // R32UI
|
||||
{GL_R32I, GL_RED_INTEGER, GL_INT}, // R32I
|
||||
{GL_COMPRESSED_RGBA_ASTC_8x8_KHR}, // ASTC_2D_8X8
|
||||
{GL_COMPRESSED_RGBA_ASTC_8x5_KHR}, // ASTC_2D_8X5
|
||||
{GL_COMPRESSED_RGBA_ASTC_5x4_KHR}, // ASTC_2D_5X4
|
||||
{GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE}, // BGRA8
|
||||
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // ABGR8U
|
||||
{GL_RGBA8_SNORM, GL_RGBA, GL_BYTE}, // ABGR8S
|
||||
{GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE}, // ABGR8I
|
||||
{GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE}, // ABGR8UI
|
||||
{GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV}, // B5G6R5U
|
||||
{GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10U
|
||||
{GL_RGB10_A2UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10UI
|
||||
{GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // A1B5G5R5U
|
||||
{GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R8U
|
||||
{GL_R8_SNORM, GL_RED, GL_BYTE}, // R8S
|
||||
{GL_R8I, GL_RED_INTEGER, GL_BYTE}, // R8I
|
||||
{GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE}, // R8UI
|
||||
{GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT}, // RGBA16F
|
||||
{GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT}, // RGBA16U
|
||||
{GL_RGBA16_SNORM, GL_RGBA, GL_SHORT}, // RGBA16S
|
||||
{GL_RGBA16I, GL_RGBA_INTEGER, GL_SHORT}, // RGBA16I
|
||||
{GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT}, // RGBA16UI
|
||||
{GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV}, // R11FG11FB10F
|
||||
{GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT}, // RGBA32UI
|
||||
{GL_COMPRESSED_RGBA_S3TC_DXT1_EXT}, // DXT1
|
||||
{GL_COMPRESSED_RGBA_S3TC_DXT3_EXT}, // DXT23
|
||||
{GL_COMPRESSED_RGBA_S3TC_DXT5_EXT}, // DXT45
|
||||
{GL_COMPRESSED_RED_RGTC1}, // DXN1
|
||||
{GL_COMPRESSED_RG_RGTC2}, // DXN2UNORM
|
||||
{GL_COMPRESSED_SIGNED_RG_RGTC2}, // DXN2SNORM
|
||||
{GL_COMPRESSED_RGBA_BPTC_UNORM}, // BC7U
|
||||
{GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT}, // BC6H_UF16
|
||||
{GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT}, // BC6H_SF16
|
||||
{GL_COMPRESSED_RGBA_ASTC_4x4_KHR}, // ASTC_2D_4X4
|
||||
{GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE}, // BGRA8
|
||||
{GL_RGBA32F, GL_RGBA, GL_FLOAT}, // RGBA32F
|
||||
{GL_RGBA32I, GL_RGBA_INTEGER, GL_INT}, // RGBA32I
|
||||
{GL_RG32F, GL_RG, GL_FLOAT}, // RG32F
|
||||
{GL_RG32I, GL_RG_INTEGER, GL_INT}, // RG32I
|
||||
{GL_R32F, GL_RED, GL_FLOAT}, // R32F
|
||||
{GL_R16F, GL_RED, GL_HALF_FLOAT}, // R16F
|
||||
{GL_R16, GL_RED, GL_UNSIGNED_SHORT}, // R16U
|
||||
{GL_R16_SNORM, GL_RED, GL_SHORT}, // R16S
|
||||
{GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT}, // R16UI
|
||||
{GL_R16I, GL_RED_INTEGER, GL_SHORT}, // R16I
|
||||
{GL_RG16, GL_RG, GL_UNSIGNED_SHORT}, // RG16
|
||||
{GL_RG16F, GL_RG, GL_HALF_FLOAT}, // RG16F
|
||||
{GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT}, // RG16UI
|
||||
{GL_RG16I, GL_RG_INTEGER, GL_SHORT}, // RG16I
|
||||
{GL_RG16_SNORM, GL_RG, GL_SHORT}, // RG16S
|
||||
{GL_RGB32F, GL_RGB, GL_FLOAT}, // RGB32F
|
||||
{GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // RGBA8_SRGB
|
||||
{GL_RG8, GL_RG, GL_UNSIGNED_BYTE}, // RG8U
|
||||
{GL_RG8_SNORM, GL_RG, GL_BYTE}, // RG8S
|
||||
{GL_RG8I, GL_RG_INTEGER, GL_BYTE}, // RG8I
|
||||
{GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_BYTE}, // RG8UI
|
||||
{GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT}, // RG32UI
|
||||
{GL_RGB16F, GL_RGBA, GL_HALF_FLOAT}, // RGBX16F
|
||||
{GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT}, // R32UI
|
||||
{GL_R32I, GL_RED_INTEGER, GL_INT}, // R32I
|
||||
{GL_COMPRESSED_RGBA_ASTC_8x8_KHR}, // ASTC_2D_8X8
|
||||
{GL_COMPRESSED_RGBA_ASTC_8x5_KHR}, // ASTC_2D_8X5
|
||||
{GL_COMPRESSED_RGBA_ASTC_5x4_KHR}, // ASTC_2D_5X4
|
||||
{GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE}, // BGRA8
|
||||
// Compressed sRGB formats
|
||||
{GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT}, // DXT1_SRGB
|
||||
{GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT}, // DXT23_SRGB
|
||||
|
|
|
@ -123,6 +123,7 @@ struct FormatTuple {
|
|||
{VK_FORMAT_A8B8G8R8_UINT_PACK32, Attachable | Storage}, // ABGR8UI
|
||||
{VK_FORMAT_B5G6R5_UNORM_PACK16}, // B5G6R5U
|
||||
{VK_FORMAT_A2B10G10R10_UNORM_PACK32, Attachable | Storage}, // A2B10G10R10U
|
||||
{VK_FORMAT_A2B10G10R10_UINT_PACK32, Attachable | Storage}, // A2B10G10R10UI
|
||||
{VK_FORMAT_A1R5G5B5_UNORM_PACK16, Attachable}, // A1B5G5R5U (flipped with swizzle)
|
||||
{VK_FORMAT_R8_UNORM, Attachable | Storage}, // R8U
|
||||
{VK_FORMAT_R8_SNORM, Attachable | Storage}, // R8S
|
||||
|
|
|
@ -81,6 +81,7 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(
|
|||
VK_FORMAT_A8B8G8R8_SRGB_PACK32,
|
||||
VK_FORMAT_B5G6R5_UNORM_PACK16,
|
||||
VK_FORMAT_A2B10G10R10_UNORM_PACK32,
|
||||
VK_FORMAT_A2B10G10R10_UINT_PACK32,
|
||||
VK_FORMAT_A1R5G5B5_UNORM_PACK16,
|
||||
VK_FORMAT_R32G32B32A32_SFLOAT,
|
||||
VK_FORMAT_R32G32B32A32_SINT,
|
||||
|
|
|
@ -122,6 +122,8 @@ PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format)
|
|||
return PixelFormat::BGRA8_SRGB;
|
||||
case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
|
||||
return PixelFormat::A2B10G10R10U;
|
||||
case Tegra::RenderTargetFormat::RGB10_A2_UINT:
|
||||
return PixelFormat::A2B10G10R10UI;
|
||||
case Tegra::RenderTargetFormat::RGBA8_UNORM:
|
||||
return PixelFormat::ABGR8U;
|
||||
case Tegra::RenderTargetFormat::RGBA8_SRGB:
|
||||
|
|
|
@ -21,6 +21,7 @@ enum class PixelFormat {
|
|||
ABGR8UI,
|
||||
B5G6R5U,
|
||||
A2B10G10R10U,
|
||||
A2B10G10R10UI,
|
||||
A1B5G5R5U,
|
||||
R8U,
|
||||
R8S,
|
||||
|
@ -143,6 +144,7 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{
|
|||
0, // ABGR8UI
|
||||
0, // B5G6R5U
|
||||
0, // A2B10G10R10U
|
||||
0, // A2B10G10R10UI
|
||||
0, // A1B5G5R5U
|
||||
0, // R8U
|
||||
0, // R8S
|
||||
|
@ -249,6 +251,7 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{
|
|||
1, // ABGR8UI
|
||||
1, // B5G6R5U
|
||||
1, // A2B10G10R10U
|
||||
1, // A2B10G10R10UI
|
||||
1, // A1B5G5R5U
|
||||
1, // R8U
|
||||
1, // R8S
|
||||
|
@ -347,6 +350,7 @@ constexpr std::array<u32, MaxPixelFormat> block_height_table = {{
|
|||
1, // ABGR8UI
|
||||
1, // B5G6R5U
|
||||
1, // A2B10G10R10U
|
||||
1, // A2B10G10R10UI
|
||||
1, // A1B5G5R5U
|
||||
1, // R8U
|
||||
1, // R8S
|
||||
|
@ -445,6 +449,7 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{
|
|||
32, // ABGR8UI
|
||||
16, // B5G6R5U
|
||||
32, // A2B10G10R10U
|
||||
32, // A2B10G10R10UI
|
||||
16, // A1B5G5R5U
|
||||
8, // R8U
|
||||
8, // R8S
|
||||
|
|
Loading…
Reference in a new issue