diff options
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 14 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 69 |
2 files changed, 49 insertions, 34 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 5d58ebd4f..05f153599 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -119,7 +119,8 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form | |||
| 119 | {GL_COMPRESSED_RGBA_BPTC_UNORM_ARB, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, | 119 | {GL_COMPRESSED_RGBA_BPTC_UNORM_ARB, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, |
| 120 | true}, // BC7U | 120 | true}, // BC7U |
| 121 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4 | 121 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4 |
| 122 | {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8 | 122 | {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8U |
| 123 | {GL_RG8, GL_RG, GL_BYTE, ComponentType::SNorm, false}, // G8R8S | ||
| 123 | {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8 | 124 | {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8 |
| 124 | {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F | 125 | {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F |
| 125 | {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F | 126 | {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F |
| @@ -260,7 +261,8 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU | |||
| 260 | MortonCopy<true, PixelFormat::DXN2SNORM>, | 261 | MortonCopy<true, PixelFormat::DXN2SNORM>, |
| 261 | MortonCopy<true, PixelFormat::BC7U>, | 262 | MortonCopy<true, PixelFormat::BC7U>, |
| 262 | MortonCopy<true, PixelFormat::ASTC_2D_4X4>, | 263 | MortonCopy<true, PixelFormat::ASTC_2D_4X4>, |
| 263 | MortonCopy<true, PixelFormat::G8R8>, | 264 | MortonCopy<true, PixelFormat::G8R8U>, |
| 265 | MortonCopy<true, PixelFormat::G8R8S>, | ||
| 264 | MortonCopy<true, PixelFormat::BGRA8>, | 266 | MortonCopy<true, PixelFormat::BGRA8>, |
| 265 | MortonCopy<true, PixelFormat::RGBA32F>, | 267 | MortonCopy<true, PixelFormat::RGBA32F>, |
| 266 | MortonCopy<true, PixelFormat::RG32F>, | 268 | MortonCopy<true, PixelFormat::RG32F>, |
| @@ -315,7 +317,8 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU | |||
| 315 | nullptr, | 317 | nullptr, |
| 316 | nullptr, | 318 | nullptr, |
| 317 | nullptr, | 319 | nullptr, |
| 318 | MortonCopy<false, PixelFormat::G8R8>, | 320 | MortonCopy<false, PixelFormat::G8R8U>, |
| 321 | MortonCopy<false, PixelFormat::G8R8S>, | ||
| 319 | MortonCopy<false, PixelFormat::BGRA8>, | 322 | MortonCopy<false, PixelFormat::BGRA8>, |
| 320 | MortonCopy<false, PixelFormat::RGBA32F>, | 323 | MortonCopy<false, PixelFormat::RGBA32F>, |
| 321 | MortonCopy<false, PixelFormat::RG32F>, | 324 | MortonCopy<false, PixelFormat::RG32F>, |
| @@ -461,7 +464,7 @@ static void ConvertS8Z24ToZ24S8(std::vector<u8>& data, u32 width, u32 height) { | |||
| 461 | } | 464 | } |
| 462 | 465 | ||
| 463 | static void ConvertG8R8ToR8G8(std::vector<u8>& data, u32 width, u32 height) { | 466 | static void ConvertG8R8ToR8G8(std::vector<u8>& data, u32 width, u32 height) { |
| 464 | const auto bpp{CachedSurface::GetGLBytesPerPixel(PixelFormat::G8R8)}; | 467 | const auto bpp{CachedSurface::GetGLBytesPerPixel(PixelFormat::G8R8U)}; |
| 465 | for (size_t y = 0; y < height; ++y) { | 468 | for (size_t y = 0; y < height; ++y) { |
| 466 | for (size_t x = 0; x < width; ++x) { | 469 | for (size_t x = 0; x < width; ++x) { |
| 467 | const size_t offset{bpp * (y * width + x)}; | 470 | const size_t offset{bpp * (y * width + x)}; |
| @@ -493,7 +496,8 @@ static void ConvertFormatAsNeeded_LoadGLBuffer(std::vector<u8>& data, PixelForma | |||
| 493 | ConvertS8Z24ToZ24S8(data, width, height); | 496 | ConvertS8Z24ToZ24S8(data, width, height); |
| 494 | break; | 497 | break; |
| 495 | 498 | ||
| 496 | case PixelFormat::G8R8: | 499 | case PixelFormat::G8R8U: |
| 500 | case PixelFormat::G8R8S: | ||
| 497 | // Convert the G8R8 color format to R8G8, as OpenGL does not support G8R8. | 501 | // Convert the G8R8 color format to R8G8, as OpenGL does not support G8R8. |
| 498 | ConvertG8R8ToR8G8(data, width, height); | 502 | ConvertG8R8ToR8G8(data, width, height); |
| 499 | break; | 503 | break; |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 36a41522b..b6fb235e3 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -43,36 +43,37 @@ struct SurfaceParams { | |||
| 43 | DXN2SNORM = 17, | 43 | DXN2SNORM = 17, |
| 44 | BC7U = 18, | 44 | BC7U = 18, |
| 45 | ASTC_2D_4X4 = 19, | 45 | ASTC_2D_4X4 = 19, |
| 46 | G8R8 = 20, | 46 | G8R8U = 20, |
| 47 | BGRA8 = 21, | 47 | G8R8S = 21, |
| 48 | RGBA32F = 22, | 48 | BGRA8 = 22, |
| 49 | RG32F = 23, | 49 | RGBA32F = 23, |
| 50 | R32F = 24, | 50 | RG32F = 24, |
| 51 | R16F = 25, | 51 | R32F = 25, |
| 52 | R16UNORM = 26, | 52 | R16F = 26, |
| 53 | R16S = 27, | 53 | R16UNORM = 27, |
| 54 | R16UI = 28, | 54 | R16S = 28, |
| 55 | R16I = 29, | 55 | R16UI = 29, |
| 56 | RG16 = 30, | 56 | R16I = 30, |
| 57 | RG16F = 31, | 57 | RG16 = 31, |
| 58 | RG16UI = 32, | 58 | RG16F = 32, |
| 59 | RG16I = 33, | 59 | RG16UI = 33, |
| 60 | RG16S = 34, | 60 | RG16I = 34, |
| 61 | RGB32F = 35, | 61 | RG16S = 35, |
| 62 | SRGBA8 = 36, | 62 | RGB32F = 36, |
| 63 | RG8U = 37, | 63 | SRGBA8 = 37, |
| 64 | RG8S = 38, | 64 | RG8U = 38, |
| 65 | RG32UI = 39, | 65 | RG8S = 39, |
| 66 | R32UI = 40, | 66 | RG32UI = 40, |
| 67 | R32UI = 41, | ||
| 67 | 68 | ||
| 68 | MaxColorFormat, | 69 | MaxColorFormat, |
| 69 | 70 | ||
| 70 | // DepthStencil formats | 71 | // DepthStencil formats |
| 71 | Z24S8 = 41, | 72 | Z24S8 = 42, |
| 72 | S8Z24 = 42, | 73 | S8Z24 = 43, |
| 73 | Z32F = 43, | 74 | Z32F = 44, |
| 74 | Z16 = 44, | 75 | Z16 = 45, |
| 75 | Z32FS8 = 45, | 76 | Z32FS8 = 46, |
| 76 | 77 | ||
| 77 | MaxDepthStencilFormat, | 78 | MaxDepthStencilFormat, |
| 78 | 79 | ||
| @@ -130,7 +131,8 @@ struct SurfaceParams { | |||
| 130 | 4, // DXN2SNORM | 131 | 4, // DXN2SNORM |
| 131 | 4, // BC7U | 132 | 4, // BC7U |
| 132 | 4, // ASTC_2D_4X4 | 133 | 4, // ASTC_2D_4X4 |
| 133 | 1, // G8R8 | 134 | 1, // G8R8U |
| 135 | 1, // G8R8S | ||
| 134 | 1, // BGRA8 | 136 | 1, // BGRA8 |
| 135 | 1, // RGBA32F | 137 | 1, // RGBA32F |
| 136 | 1, // RG32F | 138 | 1, // RG32F |
| @@ -187,7 +189,8 @@ struct SurfaceParams { | |||
| 187 | 128, // DXN2SNORM | 189 | 128, // DXN2SNORM |
| 188 | 128, // BC7U | 190 | 128, // BC7U |
| 189 | 32, // ASTC_2D_4X4 | 191 | 32, // ASTC_2D_4X4 |
| 190 | 16, // G8R8 | 192 | 16, // G8R8U |
| 193 | 16, // G8R8S | ||
| 191 | 32, // BGRA8 | 194 | 32, // BGRA8 |
| 192 | 128, // RGBA32F | 195 | 128, // RGBA32F |
| 193 | 64, // RG32F | 196 | 64, // RG32F |
| @@ -341,7 +344,15 @@ struct SurfaceParams { | |||
| 341 | static_cast<u32>(component_type)); | 344 | static_cast<u32>(component_type)); |
| 342 | UNREACHABLE(); | 345 | UNREACHABLE(); |
| 343 | case Tegra::Texture::TextureFormat::G8R8: | 346 | case Tegra::Texture::TextureFormat::G8R8: |
| 344 | return PixelFormat::G8R8; | 347 | switch (component_type) { |
| 348 | case Tegra::Texture::ComponentType::UNORM: | ||
| 349 | return PixelFormat::G8R8U; | ||
| 350 | case Tegra::Texture::ComponentType::SNORM: | ||
| 351 | return PixelFormat::G8R8S; | ||
| 352 | } | ||
| 353 | LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", | ||
| 354 | static_cast<u32>(component_type)); | ||
| 355 | UNREACHABLE(); | ||
| 345 | case Tegra::Texture::TextureFormat::R16_G16_B16_A16: | 356 | case Tegra::Texture::TextureFormat::R16_G16_B16_A16: |
| 346 | return PixelFormat::RGBA16F; | 357 | return PixelFormat::RGBA16F; |
| 347 | case Tegra::Texture::TextureFormat::BF10GF11RF11: | 358 | case Tegra::Texture::TextureFormat::BF10GF11RF11: |