diff options
| author | 2018-12-27 20:43:06 -0500 | |
|---|---|---|
| committer | 2018-12-28 15:36:45 -0500 | |
| commit | 2020ba06e10d46eafa8ddd28460ebbdc87df3db5 (patch) | |
| tree | 8ff5c75b22e2ff41af35434c1825955572ed42b1 /src | |
| parent | Merge pull request #1958 from lioncash/audio (diff) | |
| download | yuzu-2020ba06e10d46eafa8ddd28460ebbdc87df3db5.tar.gz yuzu-2020ba06e10d46eafa8ddd28460ebbdc87df3db5.tar.xz yuzu-2020ba06e10d46eafa8ddd28460ebbdc87df3db5.zip | |
gpu: Remove PixelFormat G8R8U and G8R8S, as they do not seem to exist.
- Fixes UI rendering issues in The Legend of Zelda: Breath of the Wild.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/morton.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 22 | ||||
| -rw-r--r-- | src/video_core/surface.cpp | 7 | ||||
| -rw-r--r-- | src/video_core/surface.h | 92 |
4 files changed, 46 insertions, 79 deletions
diff --git a/src/video_core/morton.cpp b/src/video_core/morton.cpp index 47e76d8fe..b68f4fb13 100644 --- a/src/video_core/morton.cpp +++ b/src/video_core/morton.cpp | |||
| @@ -66,8 +66,6 @@ static constexpr ConversionArray morton_to_linear_fns = { | |||
| 66 | MortonCopy<true, PixelFormat::BC6H_UF16>, | 66 | MortonCopy<true, PixelFormat::BC6H_UF16>, |
| 67 | MortonCopy<true, PixelFormat::BC6H_SF16>, | 67 | MortonCopy<true, PixelFormat::BC6H_SF16>, |
| 68 | MortonCopy<true, PixelFormat::ASTC_2D_4X4>, | 68 | MortonCopy<true, PixelFormat::ASTC_2D_4X4>, |
| 69 | MortonCopy<true, PixelFormat::G8R8U>, | ||
| 70 | MortonCopy<true, PixelFormat::G8R8S>, | ||
| 71 | MortonCopy<true, PixelFormat::BGRA8>, | 69 | MortonCopy<true, PixelFormat::BGRA8>, |
| 72 | MortonCopy<true, PixelFormat::RGBA32F>, | 70 | MortonCopy<true, PixelFormat::RGBA32F>, |
| 73 | MortonCopy<true, PixelFormat::RG32F>, | 71 | MortonCopy<true, PixelFormat::RG32F>, |
| @@ -138,8 +136,6 @@ static constexpr ConversionArray linear_to_morton_fns = { | |||
| 138 | MortonCopy<false, PixelFormat::BC6H_SF16>, | 136 | MortonCopy<false, PixelFormat::BC6H_SF16>, |
| 139 | // TODO(Subv): Swizzling ASTC formats are not supported | 137 | // TODO(Subv): Swizzling ASTC formats are not supported |
| 140 | nullptr, | 138 | nullptr, |
| 141 | MortonCopy<false, PixelFormat::G8R8U>, | ||
| 142 | MortonCopy<false, PixelFormat::G8R8S>, | ||
| 143 | MortonCopy<false, PixelFormat::BGRA8>, | 139 | MortonCopy<false, PixelFormat::BGRA8>, |
| 144 | MortonCopy<false, PixelFormat::RGBA32F>, | 140 | MortonCopy<false, PixelFormat::RGBA32F>, |
| 145 | MortonCopy<false, PixelFormat::RG32F>, | 141 | MortonCopy<false, PixelFormat::RG32F>, |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 7ea07631a..75b4fe88d 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -288,8 +288,6 @@ static constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex | |||
| 288 | {GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, ComponentType::Float, | 288 | {GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, ComponentType::Float, |
| 289 | true}, // BC6H_SF16 | 289 | true}, // BC6H_SF16 |
| 290 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4 | 290 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4 |
| 291 | {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8U | ||
| 292 | {GL_RG8, GL_RG, GL_BYTE, ComponentType::SNorm, false}, // G8R8S | ||
| 293 | {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8 | 291 | {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8 |
| 294 | {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F | 292 | {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F |
| 295 | {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F | 293 | {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F |
| @@ -620,18 +618,6 @@ static void ConvertS8Z24ToZ24S8(std::vector<u8>& data, u32 width, u32 height, bo | |||
| 620 | } | 618 | } |
| 621 | } | 619 | } |
| 622 | 620 | ||
| 623 | static void ConvertG8R8ToR8G8(std::vector<u8>& data, u32 width, u32 height) { | ||
| 624 | constexpr auto bpp{GetBytesPerPixel(PixelFormat::G8R8U)}; | ||
| 625 | for (std::size_t y = 0; y < height; ++y) { | ||
| 626 | for (std::size_t x = 0; x < width; ++x) { | ||
| 627 | const std::size_t offset{bpp * (y * width + x)}; | ||
| 628 | const u8 temp{data[offset]}; | ||
| 629 | data[offset] = data[offset + 1]; | ||
| 630 | data[offset + 1] = temp; | ||
| 631 | } | ||
| 632 | } | ||
| 633 | } | ||
| 634 | |||
| 635 | /** | 621 | /** |
| 636 | * Helper function to perform software conversion (as needed) when loading a buffer from Switch | 622 | * Helper function to perform software conversion (as needed) when loading a buffer from Switch |
| 637 | * memory. This is for Maxwell pixel formats that cannot be represented as-is in OpenGL or with | 623 | * memory. This is for Maxwell pixel formats that cannot be represented as-is in OpenGL or with |
| @@ -664,12 +650,6 @@ static void ConvertFormatAsNeeded_LoadGLBuffer(std::vector<u8>& data, PixelForma | |||
| 664 | // Convert the S8Z24 depth format to Z24S8, as OpenGL does not support S8Z24. | 650 | // Convert the S8Z24 depth format to Z24S8, as OpenGL does not support S8Z24. |
| 665 | ConvertS8Z24ToZ24S8(data, width, height, false); | 651 | ConvertS8Z24ToZ24S8(data, width, height, false); |
| 666 | break; | 652 | break; |
| 667 | |||
| 668 | case PixelFormat::G8R8U: | ||
| 669 | case PixelFormat::G8R8S: | ||
| 670 | // Convert the G8R8 color format to R8G8, as OpenGL does not support G8R8. | ||
| 671 | ConvertG8R8ToR8G8(data, width, height); | ||
| 672 | break; | ||
| 673 | } | 653 | } |
| 674 | } | 654 | } |
| 675 | 655 | ||
| @@ -681,8 +661,6 @@ static void ConvertFormatAsNeeded_LoadGLBuffer(std::vector<u8>& data, PixelForma | |||
| 681 | static void ConvertFormatAsNeeded_FlushGLBuffer(std::vector<u8>& data, PixelFormat pixel_format, | 661 | static void ConvertFormatAsNeeded_FlushGLBuffer(std::vector<u8>& data, PixelFormat pixel_format, |
| 682 | u32 width, u32 height) { | 662 | u32 width, u32 height) { |
| 683 | switch (pixel_format) { | 663 | switch (pixel_format) { |
| 684 | case PixelFormat::G8R8U: | ||
| 685 | case PixelFormat::G8R8S: | ||
| 686 | case PixelFormat::ASTC_2D_4X4: | 664 | case PixelFormat::ASTC_2D_4X4: |
| 687 | case PixelFormat::ASTC_2D_8X8: | 665 | case PixelFormat::ASTC_2D_8X8: |
| 688 | case PixelFormat::ASTC_2D_4X4_SRGB: | 666 | case PixelFormat::ASTC_2D_4X4_SRGB: |
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp index a97b1562b..1a344229f 100644 --- a/src/video_core/surface.cpp +++ b/src/video_core/surface.cpp | |||
| @@ -196,11 +196,14 @@ PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format, | |||
| 196 | LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast<u32>(component_type)); | 196 | LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast<u32>(component_type)); |
| 197 | UNREACHABLE(); | 197 | UNREACHABLE(); |
| 198 | case Tegra::Texture::TextureFormat::G8R8: | 198 | case Tegra::Texture::TextureFormat::G8R8: |
| 199 | // TextureFormat::G8R8 is actually ordered red then green, as such we can use | ||
| 200 | // PixelFormat::RG8U and PixelFormat::RG8S. This was tested with The Legend of Zelda: Breath | ||
| 201 | // of the Wild, which uses this format to render the hearts on the UI. | ||
| 199 | switch (component_type) { | 202 | switch (component_type) { |
| 200 | case Tegra::Texture::ComponentType::UNORM: | 203 | case Tegra::Texture::ComponentType::UNORM: |
| 201 | return PixelFormat::G8R8U; | 204 | return PixelFormat::RG8U; |
| 202 | case Tegra::Texture::ComponentType::SNORM: | 205 | case Tegra::Texture::ComponentType::SNORM: |
| 203 | return PixelFormat::G8R8S; | 206 | return PixelFormat::RG8S; |
| 204 | } | 207 | } |
| 205 | LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast<u32>(component_type)); | 208 | LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast<u32>(component_type)); |
| 206 | UNREACHABLE(); | 209 | UNREACHABLE(); |
diff --git a/src/video_core/surface.h b/src/video_core/surface.h index e23cfecbc..c2259c3c2 100644 --- a/src/video_core/surface.h +++ b/src/video_core/surface.h | |||
| @@ -38,57 +38,55 @@ enum class PixelFormat { | |||
| 38 | BC6H_UF16 = 20, | 38 | BC6H_UF16 = 20, |
| 39 | BC6H_SF16 = 21, | 39 | BC6H_SF16 = 21, |
| 40 | ASTC_2D_4X4 = 22, | 40 | ASTC_2D_4X4 = 22, |
| 41 | G8R8U = 23, | 41 | BGRA8 = 23, |
| 42 | G8R8S = 24, | 42 | RGBA32F = 24, |
| 43 | BGRA8 = 25, | 43 | RG32F = 25, |
| 44 | RGBA32F = 26, | 44 | R32F = 26, |
| 45 | RG32F = 27, | 45 | R16F = 27, |
| 46 | R32F = 28, | 46 | R16U = 28, |
| 47 | R16F = 29, | 47 | R16S = 29, |
| 48 | R16U = 30, | 48 | R16UI = 30, |
| 49 | R16S = 31, | 49 | R16I = 31, |
| 50 | R16UI = 32, | 50 | RG16 = 32, |
| 51 | R16I = 33, | 51 | RG16F = 33, |
| 52 | RG16 = 34, | 52 | RG16UI = 34, |
| 53 | RG16F = 35, | 53 | RG16I = 35, |
| 54 | RG16UI = 36, | 54 | RG16S = 36, |
| 55 | RG16I = 37, | 55 | RGB32F = 37, |
| 56 | RG16S = 38, | 56 | RGBA8_SRGB = 38, |
| 57 | RGB32F = 39, | 57 | RG8U = 39, |
| 58 | RGBA8_SRGB = 40, | 58 | RG8S = 40, |
| 59 | RG8U = 41, | 59 | RG32UI = 41, |
| 60 | RG8S = 42, | 60 | R32UI = 42, |
| 61 | RG32UI = 43, | 61 | ASTC_2D_8X8 = 43, |
| 62 | R32UI = 44, | 62 | ASTC_2D_8X5 = 44, |
| 63 | ASTC_2D_8X8 = 45, | 63 | ASTC_2D_5X4 = 45, |
| 64 | ASTC_2D_8X5 = 46, | 64 | BGRA8_SRGB = 46, |
| 65 | ASTC_2D_5X4 = 47, | 65 | DXT1_SRGB = 47, |
| 66 | BGRA8_SRGB = 48, | 66 | DXT23_SRGB = 48, |
| 67 | DXT1_SRGB = 49, | 67 | DXT45_SRGB = 49, |
| 68 | DXT23_SRGB = 50, | 68 | BC7U_SRGB = 50, |
| 69 | DXT45_SRGB = 51, | 69 | ASTC_2D_4X4_SRGB = 51, |
| 70 | BC7U_SRGB = 52, | 70 | ASTC_2D_8X8_SRGB = 52, |
| 71 | ASTC_2D_4X4_SRGB = 53, | 71 | ASTC_2D_8X5_SRGB = 53, |
| 72 | ASTC_2D_8X8_SRGB = 54, | 72 | ASTC_2D_5X4_SRGB = 54, |
| 73 | ASTC_2D_8X5_SRGB = 55, | 73 | ASTC_2D_5X5 = 55, |
| 74 | ASTC_2D_5X4_SRGB = 56, | 74 | ASTC_2D_5X5_SRGB = 56, |
| 75 | ASTC_2D_5X5 = 57, | 75 | ASTC_2D_10X8 = 57, |
| 76 | ASTC_2D_5X5_SRGB = 58, | 76 | ASTC_2D_10X8_SRGB = 58, |
| 77 | ASTC_2D_10X8 = 59, | ||
| 78 | ASTC_2D_10X8_SRGB = 60, | ||
| 79 | 77 | ||
| 80 | MaxColorFormat, | 78 | MaxColorFormat, |
| 81 | 79 | ||
| 82 | // Depth formats | 80 | // Depth formats |
| 83 | Z32F = 61, | 81 | Z32F = 59, |
| 84 | Z16 = 62, | 82 | Z16 = 60, |
| 85 | 83 | ||
| 86 | MaxDepthFormat, | 84 | MaxDepthFormat, |
| 87 | 85 | ||
| 88 | // DepthStencil formats | 86 | // DepthStencil formats |
| 89 | Z24S8 = 63, | 87 | Z24S8 = 61, |
| 90 | S8Z24 = 64, | 88 | S8Z24 = 62, |
| 91 | Z32FS8 = 65, | 89 | Z32FS8 = 63, |
| 92 | 90 | ||
| 93 | MaxDepthStencilFormat, | 91 | MaxDepthStencilFormat, |
| 94 | 92 | ||
| @@ -149,8 +147,6 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_table = {{ | |||
| 149 | 4, // BC6H_UF16 | 147 | 4, // BC6H_UF16 |
| 150 | 4, // BC6H_SF16 | 148 | 4, // BC6H_SF16 |
| 151 | 4, // ASTC_2D_4X4 | 149 | 4, // ASTC_2D_4X4 |
| 152 | 1, // G8R8U | ||
| 153 | 1, // G8R8S | ||
| 154 | 1, // BGRA8 | 150 | 1, // BGRA8 |
| 155 | 1, // RGBA32F | 151 | 1, // RGBA32F |
| 156 | 1, // RG32F | 152 | 1, // RG32F |
| @@ -232,8 +228,6 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{ | |||
| 232 | 4, // BC6H_UF16 | 228 | 4, // BC6H_UF16 |
| 233 | 4, // BC6H_SF16 | 229 | 4, // BC6H_SF16 |
| 234 | 4, // ASTC_2D_4X4 | 230 | 4, // ASTC_2D_4X4 |
| 235 | 1, // G8R8U | ||
| 236 | 1, // G8R8S | ||
| 237 | 1, // BGRA8 | 231 | 1, // BGRA8 |
| 238 | 1, // RGBA32F | 232 | 1, // RGBA32F |
| 239 | 1, // RG32F | 233 | 1, // RG32F |
| @@ -309,8 +303,6 @@ constexpr std::array<u32, MaxPixelFormat> block_height_table = {{ | |||
| 309 | 4, // BC6H_UF16 | 303 | 4, // BC6H_UF16 |
| 310 | 4, // BC6H_SF16 | 304 | 4, // BC6H_SF16 |
| 311 | 4, // ASTC_2D_4X4 | 305 | 4, // ASTC_2D_4X4 |
| 312 | 1, // G8R8U | ||
| 313 | 1, // G8R8S | ||
| 314 | 1, // BGRA8 | 306 | 1, // BGRA8 |
| 315 | 1, // RGBA32F | 307 | 1, // RGBA32F |
| 316 | 1, // RG32F | 308 | 1, // RG32F |
| @@ -386,8 +378,6 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{ | |||
| 386 | 128, // BC6H_UF16 | 378 | 128, // BC6H_UF16 |
| 387 | 128, // BC6H_SF16 | 379 | 128, // BC6H_SF16 |
| 388 | 128, // ASTC_2D_4X4 | 380 | 128, // ASTC_2D_4X4 |
| 389 | 16, // G8R8U | ||
| 390 | 16, // G8R8S | ||
| 391 | 32, // BGRA8 | 381 | 32, // BGRA8 |
| 392 | 128, // RGBA32F | 382 | 128, // RGBA32F |
| 393 | 64, // RG32F | 383 | 64, // RG32F |