2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

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_UNORM = 0xCF,
BGRA8_SRGB = 0xD0, BGRA8_SRGB = 0xD0,
RGB10_A2_UNORM = 0xD1, RGB10_A2_UNORM = 0xD1,
RGB10_A2_UINT = 0xD2,
RGBA8_UNORM = 0xD5, RGBA8_UNORM = 0xD5,
RGBA8_SRGB = 0xD6, RGBA8_SRGB = 0xD6,
RGBA8_SNORM = 0xD7, RGBA8_SNORM = 0xD7,

View file

@ -47,6 +47,7 @@ static constexpr ConversionArray morton_to_linear_fns = {
MortonCopy<true, PixelFormat::ABGR8UI>, MortonCopy<true, PixelFormat::ABGR8UI>,
MortonCopy<true, PixelFormat::B5G6R5U>, MortonCopy<true, PixelFormat::B5G6R5U>,
MortonCopy<true, PixelFormat::A2B10G10R10U>, MortonCopy<true, PixelFormat::A2B10G10R10U>,
MortonCopy<true, PixelFormat::A2B10G10R10UI>,
MortonCopy<true, PixelFormat::A1B5G5R5U>, MortonCopy<true, PixelFormat::A1B5G5R5U>,
MortonCopy<true, PixelFormat::R8U>, MortonCopy<true, PixelFormat::R8U>,
MortonCopy<true, PixelFormat::R8S>, MortonCopy<true, PixelFormat::R8S>,
@ -137,6 +138,7 @@ static constexpr ConversionArray linear_to_morton_fns = {
MortonCopy<false, PixelFormat::ABGR8UI>, MortonCopy<false, PixelFormat::ABGR8UI>,
MortonCopy<false, PixelFormat::B5G6R5U>, MortonCopy<false, PixelFormat::B5G6R5U>,
MortonCopy<false, PixelFormat::A2B10G10R10U>, MortonCopy<false, PixelFormat::A2B10G10R10U>,
MortonCopy<false, PixelFormat::A2B10G10R10UI>,
MortonCopy<false, PixelFormat::A1B5G5R5U>, MortonCopy<false, PixelFormat::A1B5G5R5U>,
MortonCopy<false, PixelFormat::R8U>, MortonCopy<false, PixelFormat::R8U>,
MortonCopy<false, PixelFormat::R8S>, 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_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE}, // ABGR8UI
{GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV}, // B5G6R5U {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_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_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // A1B5G5R5U
{GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R8U {GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R8U
{GL_R8_SNORM, GL_RED, GL_BYTE}, // R8S {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_A8B8G8R8_UINT_PACK32, Attachable | Storage}, // ABGR8UI
{VK_FORMAT_B5G6R5_UNORM_PACK16}, // B5G6R5U {VK_FORMAT_B5G6R5_UNORM_PACK16}, // B5G6R5U
{VK_FORMAT_A2B10G10R10_UNORM_PACK32, Attachable | Storage}, // A2B10G10R10U {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_A1R5G5B5_UNORM_PACK16, Attachable}, // A1B5G5R5U (flipped with swizzle)
{VK_FORMAT_R8_UNORM, Attachable | Storage}, // R8U {VK_FORMAT_R8_UNORM, Attachable | Storage}, // R8U
{VK_FORMAT_R8_SNORM, Attachable | Storage}, // R8S {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_A8B8G8R8_SRGB_PACK32,
VK_FORMAT_B5G6R5_UNORM_PACK16, VK_FORMAT_B5G6R5_UNORM_PACK16,
VK_FORMAT_A2B10G10R10_UNORM_PACK32, VK_FORMAT_A2B10G10R10_UNORM_PACK32,
VK_FORMAT_A2B10G10R10_UINT_PACK32,
VK_FORMAT_A1R5G5B5_UNORM_PACK16, VK_FORMAT_A1R5G5B5_UNORM_PACK16,
VK_FORMAT_R32G32B32A32_SFLOAT, VK_FORMAT_R32G32B32A32_SFLOAT,
VK_FORMAT_R32G32B32A32_SINT, VK_FORMAT_R32G32B32A32_SINT,

View file

@ -122,6 +122,8 @@ PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format)
return PixelFormat::BGRA8_SRGB; return PixelFormat::BGRA8_SRGB;
case Tegra::RenderTargetFormat::RGB10_A2_UNORM: case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
return PixelFormat::A2B10G10R10U; return PixelFormat::A2B10G10R10U;
case Tegra::RenderTargetFormat::RGB10_A2_UINT:
return PixelFormat::A2B10G10R10UI;
case Tegra::RenderTargetFormat::RGBA8_UNORM: case Tegra::RenderTargetFormat::RGBA8_UNORM:
return PixelFormat::ABGR8U; return PixelFormat::ABGR8U;
case Tegra::RenderTargetFormat::RGBA8_SRGB: case Tegra::RenderTargetFormat::RGBA8_SRGB:

View file

@ -21,6 +21,7 @@ enum class PixelFormat {
ABGR8UI, ABGR8UI,
B5G6R5U, B5G6R5U,
A2B10G10R10U, A2B10G10R10U,
A2B10G10R10UI,
A1B5G5R5U, A1B5G5R5U,
R8U, R8U,
R8S, R8S,
@ -143,6 +144,7 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{
0, // ABGR8UI 0, // ABGR8UI
0, // B5G6R5U 0, // B5G6R5U
0, // A2B10G10R10U 0, // A2B10G10R10U
0, // A2B10G10R10UI
0, // A1B5G5R5U 0, // A1B5G5R5U
0, // R8U 0, // R8U
0, // R8S 0, // R8S
@ -249,6 +251,7 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{
1, // ABGR8UI 1, // ABGR8UI
1, // B5G6R5U 1, // B5G6R5U
1, // A2B10G10R10U 1, // A2B10G10R10U
1, // A2B10G10R10UI
1, // A1B5G5R5U 1, // A1B5G5R5U
1, // R8U 1, // R8U
1, // R8S 1, // R8S
@ -347,6 +350,7 @@ constexpr std::array<u32, MaxPixelFormat> block_height_table = {{
1, // ABGR8UI 1, // ABGR8UI
1, // B5G6R5U 1, // B5G6R5U
1, // A2B10G10R10U 1, // A2B10G10R10U
1, // A2B10G10R10UI
1, // A1B5G5R5U 1, // A1B5G5R5U
1, // R8U 1, // R8U
1, // R8S 1, // R8S
@ -445,6 +449,7 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{
32, // ABGR8UI 32, // ABGR8UI
16, // B5G6R5U 16, // B5G6R5U
32, // A2B10G10R10U 32, // A2B10G10R10U
32, // A2B10G10R10UI
16, // A1B5G5R5U 16, // A1B5G5R5U
8, // R8U 8, // R8U
8, // R8S 8, // R8S