video_core: Implement RGBA32_SINT render target

This commit is contained in:
ReinUsesLisp 2020-06-30 04:53:48 -03:00
parent 9338599d72
commit 1d20aac795
7 changed files with 71 additions and 58 deletions

View File

@ -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,

View File

@ -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>,

View File

@ -47,6 +47,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format
{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

View File

@ -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

View File

@ -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,

View File

@ -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:

View File

@ -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