diff options
| author | 2018-09-17 09:46:21 -0400 | |
|---|---|---|
| committer | 2018-09-17 09:46:21 -0400 | |
| commit | 240e756962aa29e46916775df3c44431af8b4e76 (patch) | |
| tree | 939d05956e81fbebb7bb7b2afd1258fcf3050c4d /src | |
| parent | Merge pull request #1273 from Subv/ld_sizes (diff) | |
| parent | Implement ASTC_2D_8X8 (Bayonetta 2) (diff) | |
| download | yuzu-240e756962aa29e46916775df3c44431af8b4e76.tar.gz yuzu-240e756962aa29e46916775df3c44431af8b4e76.tar.xz yuzu-240e756962aa29e46916775df3c44431af8b4e76.zip | |
Merge pull request #1331 from raven02/astc_8_8
Implement ASTC_2D_8X8
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 9 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 15 | ||||
| -rw-r--r-- | src/video_core/textures/decoders.cpp | 2 |
3 files changed, 20 insertions, 6 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 32001e44b..63bbcb666 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -167,6 +167,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form | |||
| 167 | {GL_RG8, GL_RG, GL_BYTE, ComponentType::SNorm, false}, // RG8S | 167 | {GL_RG8, GL_RG, GL_BYTE, ComponentType::SNorm, false}, // RG8S |
| 168 | {GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // RG32UI | 168 | {GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // RG32UI |
| 169 | {GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // R32UI | 169 | {GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // R32UI |
| 170 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_8X8 | ||
| 170 | 171 | ||
| 171 | // Depth formats | 172 | // Depth formats |
| 172 | {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F | 173 | {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F |
| @@ -213,6 +214,7 @@ static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType | |||
| 213 | static bool IsPixelFormatASTC(PixelFormat format) { | 214 | static bool IsPixelFormatASTC(PixelFormat format) { |
| 214 | switch (format) { | 215 | switch (format) { |
| 215 | case PixelFormat::ASTC_2D_4X4: | 216 | case PixelFormat::ASTC_2D_4X4: |
| 217 | case PixelFormat::ASTC_2D_8X8: | ||
| 216 | return true; | 218 | return true; |
| 217 | default: | 219 | default: |
| 218 | return false; | 220 | return false; |
| @@ -223,6 +225,8 @@ static std::pair<u32, u32> GetASTCBlockSize(PixelFormat format) { | |||
| 223 | switch (format) { | 225 | switch (format) { |
| 224 | case PixelFormat::ASTC_2D_4X4: | 226 | case PixelFormat::ASTC_2D_4X4: |
| 225 | return {4, 4}; | 227 | return {4, 4}; |
| 228 | case PixelFormat::ASTC_2D_8X8: | ||
| 229 | return {8, 8}; | ||
| 226 | default: | 230 | default: |
| 227 | LOG_CRITICAL(HW_GPU, "Unhandled format: {}", static_cast<u32>(format)); | 231 | LOG_CRITICAL(HW_GPU, "Unhandled format: {}", static_cast<u32>(format)); |
| 228 | UNREACHABLE(); | 232 | UNREACHABLE(); |
| @@ -327,6 +331,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, size_t, VAddr), | |||
| 327 | MortonCopy<true, PixelFormat::RG8S>, | 331 | MortonCopy<true, PixelFormat::RG8S>, |
| 328 | MortonCopy<true, PixelFormat::RG32UI>, | 332 | MortonCopy<true, PixelFormat::RG32UI>, |
| 329 | MortonCopy<true, PixelFormat::R32UI>, | 333 | MortonCopy<true, PixelFormat::R32UI>, |
| 334 | MortonCopy<true, PixelFormat::ASTC_2D_8X8>, | ||
| 330 | MortonCopy<true, PixelFormat::Z32F>, | 335 | MortonCopy<true, PixelFormat::Z32F>, |
| 331 | MortonCopy<true, PixelFormat::Z16>, | 336 | MortonCopy<true, PixelFormat::Z16>, |
| 332 | MortonCopy<true, PixelFormat::Z24S8>, | 337 | MortonCopy<true, PixelFormat::Z24S8>, |
| @@ -386,6 +391,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, size_t, VAddr), | |||
| 386 | MortonCopy<false, PixelFormat::RG8S>, | 391 | MortonCopy<false, PixelFormat::RG8S>, |
| 387 | MortonCopy<false, PixelFormat::RG32UI>, | 392 | MortonCopy<false, PixelFormat::RG32UI>, |
| 388 | MortonCopy<false, PixelFormat::R32UI>, | 393 | MortonCopy<false, PixelFormat::R32UI>, |
| 394 | nullptr, | ||
| 389 | MortonCopy<false, PixelFormat::Z32F>, | 395 | MortonCopy<false, PixelFormat::Z32F>, |
| 390 | MortonCopy<false, PixelFormat::Z16>, | 396 | MortonCopy<false, PixelFormat::Z16>, |
| 391 | MortonCopy<false, PixelFormat::Z24S8>, | 397 | MortonCopy<false, PixelFormat::Z24S8>, |
| @@ -544,7 +550,8 @@ static void ConvertG8R8ToR8G8(std::vector<u8>& data, u32 width, u32 height) { | |||
| 544 | static void ConvertFormatAsNeeded_LoadGLBuffer(std::vector<u8>& data, PixelFormat pixel_format, | 550 | static void ConvertFormatAsNeeded_LoadGLBuffer(std::vector<u8>& data, PixelFormat pixel_format, |
| 545 | u32 width, u32 height) { | 551 | u32 width, u32 height) { |
| 546 | switch (pixel_format) { | 552 | switch (pixel_format) { |
| 547 | case PixelFormat::ASTC_2D_4X4: { | 553 | case PixelFormat::ASTC_2D_4X4: |
| 554 | case PixelFormat::ASTC_2D_8X8: { | ||
| 548 | // Convert ASTC pixel formats to RGBA8, as most desktop GPUs do not support ASTC. | 555 | // Convert ASTC pixel formats to RGBA8, as most desktop GPUs do not support ASTC. |
| 549 | u32 block_width{}; | 556 | u32 block_width{}; |
| 550 | u32 block_height{}; | 557 | u32 block_height{}; |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 57ea8593b..0525e9a94 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -70,19 +70,20 @@ struct SurfaceParams { | |||
| 70 | RG8S = 42, | 70 | RG8S = 42, |
| 71 | RG32UI = 43, | 71 | RG32UI = 43, |
| 72 | R32UI = 44, | 72 | R32UI = 44, |
| 73 | ASTC_2D_8X8 = 45, | ||
| 73 | 74 | ||
| 74 | MaxColorFormat, | 75 | MaxColorFormat, |
| 75 | 76 | ||
| 76 | // Depth formats | 77 | // Depth formats |
| 77 | Z32F = 45, | 78 | Z32F = 46, |
| 78 | Z16 = 46, | 79 | Z16 = 47, |
| 79 | 80 | ||
| 80 | MaxDepthFormat, | 81 | MaxDepthFormat, |
| 81 | 82 | ||
| 82 | // DepthStencil formats | 83 | // DepthStencil formats |
| 83 | Z24S8 = 47, | 84 | Z24S8 = 48, |
| 84 | S8Z24 = 48, | 85 | S8Z24 = 49, |
| 85 | Z32FS8 = 49, | 86 | Z32FS8 = 50, |
| 86 | 87 | ||
| 87 | MaxDepthStencilFormat, | 88 | MaxDepthStencilFormat, |
| 88 | 89 | ||
| @@ -192,6 +193,7 @@ struct SurfaceParams { | |||
| 192 | 1, // RG8S | 193 | 1, // RG8S |
| 193 | 1, // RG32UI | 194 | 1, // RG32UI |
| 194 | 1, // R32UI | 195 | 1, // R32UI |
| 196 | 4, // ASTC_2D_8X8 | ||
| 195 | 1, // Z32F | 197 | 1, // Z32F |
| 196 | 1, // Z16 | 198 | 1, // Z16 |
| 197 | 1, // Z24S8 | 199 | 1, // Z24S8 |
| @@ -253,6 +255,7 @@ struct SurfaceParams { | |||
| 253 | 16, // RG8S | 255 | 16, // RG8S |
| 254 | 64, // RG32UI | 256 | 64, // RG32UI |
| 255 | 32, // R32UI | 257 | 32, // R32UI |
| 258 | 16, // ASTC_2D_8X8 | ||
| 256 | 32, // Z32F | 259 | 32, // Z32F |
| 257 | 16, // Z16 | 260 | 16, // Z16 |
| 258 | 32, // Z24S8 | 261 | 32, // Z24S8 |
| @@ -522,6 +525,8 @@ struct SurfaceParams { | |||
| 522 | return PixelFormat::BC6H_SF16; | 525 | return PixelFormat::BC6H_SF16; |
| 523 | case Tegra::Texture::TextureFormat::ASTC_2D_4X4: | 526 | case Tegra::Texture::TextureFormat::ASTC_2D_4X4: |
| 524 | return PixelFormat::ASTC_2D_4X4; | 527 | return PixelFormat::ASTC_2D_4X4; |
| 528 | case Tegra::Texture::TextureFormat::ASTC_2D_8X8: | ||
| 529 | return PixelFormat::ASTC_2D_8X8; | ||
| 525 | case Tegra::Texture::TextureFormat::R16_G16: | 530 | case Tegra::Texture::TextureFormat::R16_G16: |
| 526 | switch (component_type) { | 531 | switch (component_type) { |
| 527 | case Tegra::Texture::ComponentType::FLOAT: | 532 | case Tegra::Texture::ComponentType::FLOAT: |
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index 272294c62..58b65de1a 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -63,6 +63,7 @@ u32 BytesPerPixel(TextureFormat format) { | |||
| 63 | case TextureFormat::R32_G32_B32: | 63 | case TextureFormat::R32_G32_B32: |
| 64 | return 12; | 64 | return 12; |
| 65 | case TextureFormat::ASTC_2D_4X4: | 65 | case TextureFormat::ASTC_2D_4X4: |
| 66 | case TextureFormat::ASTC_2D_8X8: | ||
| 66 | case TextureFormat::A8R8G8B8: | 67 | case TextureFormat::A8R8G8B8: |
| 67 | case TextureFormat::A2B10G10R10: | 68 | case TextureFormat::A2B10G10R10: |
| 68 | case TextureFormat::BF10GF11RF11: | 69 | case TextureFormat::BF10GF11RF11: |
| @@ -111,6 +112,7 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat | |||
| 111 | case TextureFormat::BC6H_UF16: | 112 | case TextureFormat::BC6H_UF16: |
| 112 | case TextureFormat::BC6H_SF16: | 113 | case TextureFormat::BC6H_SF16: |
| 113 | case TextureFormat::ASTC_2D_4X4: | 114 | case TextureFormat::ASTC_2D_4X4: |
| 115 | case TextureFormat::ASTC_2D_8X8: | ||
| 114 | case TextureFormat::A8R8G8B8: | 116 | case TextureFormat::A8R8G8B8: |
| 115 | case TextureFormat::A2B10G10R10: | 117 | case TextureFormat::A2B10G10R10: |
| 116 | case TextureFormat::A1B5G5R5: | 118 | case TextureFormat::A1B5G5R5: |