diff options
| author | 2018-08-09 19:15:32 -0400 | |
|---|---|---|
| committer | 2018-08-09 19:15:32 -0400 | |
| commit | 75e12a33ae0479fed08d4f7dfe0ec95bf222084a (patch) | |
| tree | 37eedf5b45dff9ce26c2cea134acc13cd2c78c9b /src | |
| parent | Merge pull request #999 from lioncash/map (diff) | |
| download | yuzu-75e12a33ae0479fed08d4f7dfe0ec95bf222084a.tar.gz yuzu-75e12a33ae0479fed08d4f7dfe0ec95bf222084a.tar.xz yuzu-75e12a33ae0479fed08d4f7dfe0ec95bf222084a.zip | |
Implement SNORM for BC5/DXN2 (#998)
* Implement BC5/DXN2 (#996)
- Used by Kirby Star Allies.
* Implement BC5/DXN2 SNORM
UNORM for Kirby Star Allies
SNORM for Super Mario Odyssey
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 29 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 64 |
2 files changed, 55 insertions, 38 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index c447e999c..f6efce818 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -109,7 +109,9 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form | |||
| 109 | {GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, | 109 | {GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, |
| 110 | true}, // DXT45 | 110 | true}, // DXT45 |
| 111 | {GL_COMPRESSED_RED_RGTC1, GL_RED, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, true}, // DXN1 | 111 | {GL_COMPRESSED_RED_RGTC1, GL_RED, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, true}, // DXN1 |
| 112 | {GL_COMPRESSED_RG_RGTC2, GL_RG, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, true}, // DXN2 | 112 | {GL_COMPRESSED_RG_RGTC2, GL_RG, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, |
| 113 | true}, // DXN2UNORM | ||
| 114 | {GL_COMPRESSED_SIGNED_RG_RGTC2, GL_RG, GL_INT, ComponentType::SNorm, true}, // DXN2SNORM | ||
| 113 | {GL_COMPRESSED_RGBA_BPTC_UNORM_ARB, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, | 115 | {GL_COMPRESSED_RGBA_BPTC_UNORM_ARB, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, |
| 114 | true}, // BC7U | 116 | true}, // BC7U |
| 115 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4 | 117 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4 |
| @@ -219,17 +221,18 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | |||
| 219 | MortonCopy<true, PixelFormat::R11FG11FB10F>, MortonCopy<true, PixelFormat::RGBA32UI>, | 221 | MortonCopy<true, PixelFormat::R11FG11FB10F>, MortonCopy<true, PixelFormat::RGBA32UI>, |
| 220 | MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>, | 222 | MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>, |
| 221 | MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>, | 223 | MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>, |
| 222 | MortonCopy<true, PixelFormat::DXN2>, MortonCopy<true, PixelFormat::BC7U>, | 224 | MortonCopy<true, PixelFormat::DXN2UNORM>, MortonCopy<true, PixelFormat::DXN2SNORM>, |
| 223 | MortonCopy<true, PixelFormat::ASTC_2D_4X4>, MortonCopy<true, PixelFormat::G8R8>, | 225 | MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, |
| 224 | MortonCopy<true, PixelFormat::BGRA8>, MortonCopy<true, PixelFormat::RGBA32F>, | 226 | MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, |
| 225 | MortonCopy<true, PixelFormat::RG32F>, MortonCopy<true, PixelFormat::R32F>, | 227 | MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>, |
| 226 | MortonCopy<true, PixelFormat::R16F>, MortonCopy<true, PixelFormat::R16UNORM>, | 228 | MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>, |
| 227 | MortonCopy<true, PixelFormat::RG16>, MortonCopy<true, PixelFormat::RG16F>, | 229 | MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::RG16>, |
| 228 | MortonCopy<true, PixelFormat::RG16UI>, MortonCopy<true, PixelFormat::RG16I>, | 230 | MortonCopy<true, PixelFormat::RG16F>, MortonCopy<true, PixelFormat::RG16UI>, |
| 229 | MortonCopy<true, PixelFormat::RG16S>, MortonCopy<true, PixelFormat::RGB32F>, | 231 | MortonCopy<true, PixelFormat::RG16I>, MortonCopy<true, PixelFormat::RG16S>, |
| 230 | MortonCopy<true, PixelFormat::SRGBA8>, MortonCopy<true, PixelFormat::Z24S8>, | 232 | MortonCopy<true, PixelFormat::RGB32F>, MortonCopy<true, PixelFormat::SRGBA8>, |
| 231 | MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, | 233 | MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>, |
| 232 | MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>, | 234 | MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>, |
| 235 | MortonCopy<true, PixelFormat::Z32FS8>, | ||
| 233 | }; | 236 | }; |
| 234 | 237 | ||
| 235 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | 238 | static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), |
| @@ -251,6 +254,8 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), | |||
| 251 | nullptr, | 254 | nullptr, |
| 252 | nullptr, | 255 | nullptr, |
| 253 | nullptr, | 256 | nullptr, |
| 257 | nullptr, | ||
| 258 | nullptr, | ||
| 254 | MortonCopy<false, PixelFormat::G8R8>, | 259 | MortonCopy<false, PixelFormat::G8R8>, |
| 255 | MortonCopy<false, PixelFormat::BGRA8>, | 260 | MortonCopy<false, PixelFormat::BGRA8>, |
| 256 | MortonCopy<false, PixelFormat::RGBA32F>, | 261 | MortonCopy<false, PixelFormat::RGBA32F>, |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 6f01b2bf0..26e2ee203 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -35,32 +35,33 @@ struct SurfaceParams { | |||
| 35 | DXT23 = 9, | 35 | DXT23 = 9, |
| 36 | DXT45 = 10, | 36 | DXT45 = 10, |
| 37 | DXN1 = 11, // This is also known as BC4 | 37 | DXN1 = 11, // This is also known as BC4 |
| 38 | DXN2 = 12, // This is also known as BC5 | 38 | DXN2UNORM = 12, |
| 39 | BC7U = 13, | 39 | DXN2SNORM = 13, |
| 40 | ASTC_2D_4X4 = 14, | 40 | BC7U = 14, |
| 41 | G8R8 = 15, | 41 | ASTC_2D_4X4 = 15, |
| 42 | BGRA8 = 16, | 42 | G8R8 = 16, |
| 43 | RGBA32F = 17, | 43 | BGRA8 = 17, |
| 44 | RG32F = 18, | 44 | RGBA32F = 18, |
| 45 | R32F = 19, | 45 | RG32F = 19, |
| 46 | R16F = 20, | 46 | R32F = 20, |
| 47 | R16UNORM = 21, | 47 | R16F = 21, |
| 48 | RG16 = 22, | 48 | R16UNORM = 22, |
| 49 | RG16F = 23, | 49 | RG16 = 23, |
| 50 | RG16UI = 24, | 50 | RG16F = 24, |
| 51 | RG16I = 25, | 51 | RG16UI = 25, |
| 52 | RG16S = 26, | 52 | RG16I = 26, |
| 53 | RGB32F = 27, | 53 | RG16S = 27, |
| 54 | SRGBA8 = 28, | 54 | RGB32F = 28, |
| 55 | SRGBA8 = 29, | ||
| 55 | 56 | ||
| 56 | MaxColorFormat, | 57 | MaxColorFormat, |
| 57 | 58 | ||
| 58 | // DepthStencil formats | 59 | // DepthStencil formats |
| 59 | Z24S8 = 29, | 60 | Z24S8 = 30, |
| 60 | S8Z24 = 30, | 61 | S8Z24 = 31, |
| 61 | Z32F = 31, | 62 | Z32F = 32, |
| 62 | Z16 = 32, | 63 | Z16 = 33, |
| 63 | Z32FS8 = 33, | 64 | Z32FS8 = 34, |
| 64 | 65 | ||
| 65 | MaxDepthStencilFormat, | 66 | MaxDepthStencilFormat, |
| 66 | 67 | ||
| @@ -110,7 +111,8 @@ struct SurfaceParams { | |||
| 110 | 4, // DXT23 | 111 | 4, // DXT23 |
| 111 | 4, // DXT45 | 112 | 4, // DXT45 |
| 112 | 4, // DXN1 | 113 | 4, // DXN1 |
| 113 | 4, // DXN2 | 114 | 4, // DXN2UNORM |
| 115 | 4, // DXN2SNORM | ||
| 114 | 4, // BC7U | 116 | 4, // BC7U |
| 115 | 4, // ASTC_2D_4X4 | 117 | 4, // ASTC_2D_4X4 |
| 116 | 1, // G8R8 | 118 | 1, // G8R8 |
| @@ -155,7 +157,8 @@ struct SurfaceParams { | |||
| 155 | 128, // DXT23 | 157 | 128, // DXT23 |
| 156 | 128, // DXT45 | 158 | 128, // DXT45 |
| 157 | 64, // DXN1 | 159 | 64, // DXN1 |
| 158 | 128, // DXN2 | 160 | 128, // DXN2UNORM |
| 161 | 128, // DXN2SNORM | ||
| 159 | 128, // BC7U | 162 | 128, // BC7U |
| 160 | 32, // ASTC_2D_4X4 | 163 | 32, // ASTC_2D_4X4 |
| 161 | 16, // G8R8 | 164 | 16, // G8R8 |
| @@ -309,7 +312,15 @@ struct SurfaceParams { | |||
| 309 | case Tegra::Texture::TextureFormat::DXN1: | 312 | case Tegra::Texture::TextureFormat::DXN1: |
| 310 | return PixelFormat::DXN1; | 313 | return PixelFormat::DXN1; |
| 311 | case Tegra::Texture::TextureFormat::DXN2: | 314 | case Tegra::Texture::TextureFormat::DXN2: |
| 312 | return PixelFormat::DXN2; | 315 | switch (component_type) { |
| 316 | case Tegra::Texture::ComponentType::UNORM: | ||
| 317 | return PixelFormat::DXN2UNORM; | ||
| 318 | case Tegra::Texture::ComponentType::SNORM: | ||
| 319 | return PixelFormat::DXN2SNORM; | ||
| 320 | } | ||
| 321 | LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", | ||
| 322 | static_cast<u32>(component_type)); | ||
| 323 | UNREACHABLE(); | ||
| 313 | case Tegra::Texture::TextureFormat::BC7U: | 324 | case Tegra::Texture::TextureFormat::BC7U: |
| 314 | return PixelFormat::BC7U; | 325 | return PixelFormat::BC7U; |
| 315 | case Tegra::Texture::TextureFormat::ASTC_2D_4X4: | 326 | case Tegra::Texture::TextureFormat::ASTC_2D_4X4: |
| @@ -367,7 +378,8 @@ struct SurfaceParams { | |||
| 367 | return Tegra::Texture::TextureFormat::DXT45; | 378 | return Tegra::Texture::TextureFormat::DXT45; |
| 368 | case PixelFormat::DXN1: | 379 | case PixelFormat::DXN1: |
| 369 | return Tegra::Texture::TextureFormat::DXN1; | 380 | return Tegra::Texture::TextureFormat::DXN1; |
| 370 | case PixelFormat::DXN2: | 381 | case PixelFormat::DXN2UNORM: |
| 382 | case PixelFormat::DXN2SNORM: | ||
| 371 | return Tegra::Texture::TextureFormat::DXN2; | 383 | return Tegra::Texture::TextureFormat::DXN2; |
| 372 | case PixelFormat::BC7U: | 384 | case PixelFormat::BC7U: |
| 373 | return Tegra::Texture::TextureFormat::BC7U; | 385 | return Tegra::Texture::TextureFormat::BC7U; |