Browse Source

video_core: Fix B5G6R5_UNORM render target format

nce_cpp
ReinUsesLisp 6 years ago
parent
commit
46c327d2d9
  1. 2
      src/video_core/morton.cpp
  2. 1
      src/video_core/renderer_opengl/gl_texture_cache.cpp
  3. 1
      src/video_core/renderer_vulkan/maxwell_to_vk.cpp
  4. 2
      src/video_core/surface.cpp
  5. 5
      src/video_core/surface.h

2
src/video_core/morton.cpp

@ -46,6 +46,7 @@ static constexpr ConversionArray morton_to_linear_fns = {
MortonCopy<true, PixelFormat::ABGR8I>,
MortonCopy<true, PixelFormat::ABGR8UI>,
MortonCopy<true, PixelFormat::B5G6R5U>,
MortonCopy<true, PixelFormat::B5G5R5A1U>,
MortonCopy<true, PixelFormat::A2B10G10R10U>,
MortonCopy<true, PixelFormat::A2B10G10R10UI>,
MortonCopy<true, PixelFormat::A1B5G5R5U>,
@ -137,6 +138,7 @@ static constexpr ConversionArray linear_to_morton_fns = {
MortonCopy<false, PixelFormat::ABGR8I>,
MortonCopy<false, PixelFormat::ABGR8UI>,
MortonCopy<false, PixelFormat::B5G6R5U>,
MortonCopy<false, PixelFormat::B5G5R5A1U>,
MortonCopy<false, PixelFormat::A2B10G10R10U>,
MortonCopy<false, PixelFormat::A2B10G10R10UI>,
MortonCopy<false, PixelFormat::A1B5G5R5U>,

1
src/video_core/renderer_opengl/gl_texture_cache.cpp

@ -46,6 +46,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format
{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}, // B5G6R5U
{GL_RGB5_A1, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // B5G5R5A1U
{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

1
src/video_core/renderer_vulkan/maxwell_to_vk.cpp

@ -122,6 +122,7 @@ struct FormatTuple {
{VK_FORMAT_A8B8G8R8_SINT_PACK32, Attachable | Storage}, // ABGR8I
{VK_FORMAT_A8B8G8R8_UINT_PACK32, Attachable | Storage}, // ABGR8UI
{VK_FORMAT_R5G6B5_UNORM_PACK16, Attachable}, // B5G6R5U
{VK_FORMAT_A1R5G5B5_UNORM_PACK16, Attachable}, // B5G5R5A1U
{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)

2
src/video_core/surface.cpp

@ -155,7 +155,7 @@ PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format)
case Tegra::RenderTargetFormat::B5G6R5_UNORM:
return PixelFormat::B5G6R5U;
case Tegra::RenderTargetFormat::BGR5A1_UNORM:
return PixelFormat::A1B5G5R5U;
return PixelFormat::B5G5R5A1U;
case Tegra::RenderTargetFormat::RG8_UNORM:
return PixelFormat::RG8U;
case Tegra::RenderTargetFormat::RG8_SNORM:

5
src/video_core/surface.h

@ -20,6 +20,7 @@ enum class PixelFormat {
ABGR8I,
ABGR8UI,
B5G6R5U,
B5G5R5A1U,
A2B10G10R10U,
A2B10G10R10UI,
A1B5G5R5U,
@ -143,6 +144,7 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{
0, // ABGR8I
0, // ABGR8UI
0, // B5G6R5U
0, // B5G5R5A1U
0, // A2B10G10R10U
0, // A2B10G10R10UI
0, // A1B5G5R5U
@ -250,6 +252,7 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{
1, // ABGR8I
1, // ABGR8UI
1, // B5G6R5U
1, // B5G5R5A1U
1, // A2B10G10R10U
1, // A2B10G10R10UI
1, // A1B5G5R5U
@ -349,6 +352,7 @@ constexpr std::array<u32, MaxPixelFormat> block_height_table = {{
1, // ABGR8I
1, // ABGR8UI
1, // B5G6R5U
1, // B5G5R5A1U
1, // A2B10G10R10U
1, // A2B10G10R10UI
1, // A1B5G5R5U
@ -448,6 +452,7 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{
32, // ABGR8I
32, // ABGR8UI
16, // B5G6R5U
16, // B5G5R5A1U
32, // A2B10G10R10U
32, // A2B10G10R10UI
16, // A1B5G5R5U

Loading…
Cancel
Save