summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Hexagon122018-10-13 17:10:26 +0300
committerGravatar Hexagon122018-10-13 17:10:26 +0300
commitcbf723896f221c782edef9feb6428c29c69fa2fc (patch)
tree9fa847296aedbc3c1cd5b52cee30aff029d496bf /src
parentMerge pull request #1458 from FernandoS27/fix-render-target-block-settings (diff)
downloadyuzu-cbf723896f221c782edef9feb6428c29c69fa2fc.tar.gz
yuzu-cbf723896f221c782edef9feb6428c29c69fa2fc.tar.xz
yuzu-cbf723896f221c782edef9feb6428c29c69fa2fc.zip
Added ASTC 5x4; 8x5
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp16
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h20
-rw-r--r--src/video_core/textures/decoders.cpp2
3 files changed, 32 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 65a220c41..ae7152bd3 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -231,6 +231,8 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
231 {GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // RG32UI 231 {GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // RG32UI
232 {GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // R32UI 232 {GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // R32UI
233 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_8X8 233 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_8X8
234 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_8X5
235 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_5X4
234 236
235 // Depth formats 237 // Depth formats
236 {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F 238 {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F
@@ -277,7 +279,9 @@ static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType
277static bool IsPixelFormatASTC(PixelFormat format) { 279static bool IsPixelFormatASTC(PixelFormat format) {
278 switch (format) { 280 switch (format) {
279 case PixelFormat::ASTC_2D_4X4: 281 case PixelFormat::ASTC_2D_4X4:
282 case PixelFormat::ASTC_2D_5X4:
280 case PixelFormat::ASTC_2D_8X8: 283 case PixelFormat::ASTC_2D_8X8:
284 case PixelFormat::ASTC_2D_8X5:
281 return true; 285 return true;
282 default: 286 default:
283 return false; 287 return false;
@@ -288,8 +292,12 @@ static std::pair<u32, u32> GetASTCBlockSize(PixelFormat format) {
288 switch (format) { 292 switch (format) {
289 case PixelFormat::ASTC_2D_4X4: 293 case PixelFormat::ASTC_2D_4X4:
290 return {4, 4}; 294 return {4, 4};
295 case PixelFormat::ASTC_2D_5X4:
296 return {5, 4};
291 case PixelFormat::ASTC_2D_8X8: 297 case PixelFormat::ASTC_2D_8X8:
292 return {8, 8}; 298 return {8, 8};
299 case PixelFormat::ASTC_2D_8X5:
300 return {8, 5};
293 default: 301 default:
294 LOG_CRITICAL(HW_GPU, "Unhandled format: {}", static_cast<u32>(format)); 302 LOG_CRITICAL(HW_GPU, "Unhandled format: {}", static_cast<u32>(format));
295 UNREACHABLE(); 303 UNREACHABLE();
@@ -395,6 +403,8 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, std::size_t, VAddr),
395 MortonCopy<true, PixelFormat::RG32UI>, 403 MortonCopy<true, PixelFormat::RG32UI>,
396 MortonCopy<true, PixelFormat::R32UI>, 404 MortonCopy<true, PixelFormat::R32UI>,
397 MortonCopy<true, PixelFormat::ASTC_2D_8X8>, 405 MortonCopy<true, PixelFormat::ASTC_2D_8X8>,
406 MortonCopy<true, PixelFormat::ASTC_2D_8X5>,
407 MortonCopy<true, PixelFormat::ASTC_2D_5X4>,
398 MortonCopy<true, PixelFormat::Z32F>, 408 MortonCopy<true, PixelFormat::Z32F>,
399 MortonCopy<true, PixelFormat::Z16>, 409 MortonCopy<true, PixelFormat::Z16>,
400 MortonCopy<true, PixelFormat::Z24S8>, 410 MortonCopy<true, PixelFormat::Z24S8>,
@@ -455,6 +465,8 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, std::size_t, VAddr),
455 MortonCopy<false, PixelFormat::RG32UI>, 465 MortonCopy<false, PixelFormat::RG32UI>,
456 MortonCopy<false, PixelFormat::R32UI>, 466 MortonCopy<false, PixelFormat::R32UI>,
457 nullptr, 467 nullptr,
468 nullptr,
469 nullptr,
458 MortonCopy<false, PixelFormat::Z32F>, 470 MortonCopy<false, PixelFormat::Z32F>,
459 MortonCopy<false, PixelFormat::Z16>, 471 MortonCopy<false, PixelFormat::Z16>,
460 MortonCopy<false, PixelFormat::Z24S8>, 472 MortonCopy<false, PixelFormat::Z24S8>,
@@ -790,7 +802,9 @@ static void ConvertFormatAsNeeded_LoadGLBuffer(std::vector<u8>& data, PixelForma
790 u32 width, u32 height) { 802 u32 width, u32 height) {
791 switch (pixel_format) { 803 switch (pixel_format) {
792 case PixelFormat::ASTC_2D_4X4: 804 case PixelFormat::ASTC_2D_4X4:
793 case PixelFormat::ASTC_2D_8X8: { 805 case PixelFormat::ASTC_2D_8X8:
806 case PixelFormat::ASTC_2D_8X5:
807 case PixelFormat::ASTC_2D_5X4: {
794 // Convert ASTC pixel formats to RGBA8, as most desktop GPUs do not support ASTC. 808 // Convert ASTC pixel formats to RGBA8, as most desktop GPUs do not support ASTC.
795 u32 block_width{}; 809 u32 block_width{};
796 u32 block_height{}; 810 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 66d98ad4e..0b8ae3eb4 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -74,19 +74,21 @@ struct SurfaceParams {
74 RG32UI = 43, 74 RG32UI = 43,
75 R32UI = 44, 75 R32UI = 44,
76 ASTC_2D_8X8 = 45, 76 ASTC_2D_8X8 = 45,
77 ASTC_2D_8X5 = 46,
78 ASTC_2D_5X4 = 47,
77 79
78 MaxColorFormat, 80 MaxColorFormat,
79 81
80 // Depth formats 82 // Depth formats
81 Z32F = 46, 83 Z32F = 48,
82 Z16 = 47, 84 Z16 = 49,
83 85
84 MaxDepthFormat, 86 MaxDepthFormat,
85 87
86 // DepthStencil formats 88 // DepthStencil formats
87 Z24S8 = 48, 89 Z24S8 = 50,
88 S8Z24 = 49, 90 S8Z24 = 51,
89 Z32FS8 = 50, 91 Z32FS8 = 52,
90 92
91 MaxDepthStencilFormat, 93 MaxDepthStencilFormat,
92 94
@@ -220,6 +222,8 @@ struct SurfaceParams {
220 1, // RG32UI 222 1, // RG32UI
221 1, // R32UI 223 1, // R32UI
222 4, // ASTC_2D_8X8 224 4, // ASTC_2D_8X8
225 4, // ASTC_2D_8X5
226 4, // ASTC_2D_5X4
223 1, // Z32F 227 1, // Z32F
224 1, // Z16 228 1, // Z16
225 1, // Z24S8 229 1, // Z24S8
@@ -282,6 +286,8 @@ struct SurfaceParams {
282 64, // RG32UI 286 64, // RG32UI
283 32, // R32UI 287 32, // R32UI
284 16, // ASTC_2D_8X8 288 16, // ASTC_2D_8X8
289 32, // ASTC_2D_8X5
290 32, // ASTC_2D_5X4
285 32, // Z32F 291 32, // Z32F
286 16, // Z16 292 16, // Z16
287 32, // Z24S8 293 32, // Z24S8
@@ -553,8 +559,12 @@ struct SurfaceParams {
553 return PixelFormat::BC6H_SF16; 559 return PixelFormat::BC6H_SF16;
554 case Tegra::Texture::TextureFormat::ASTC_2D_4X4: 560 case Tegra::Texture::TextureFormat::ASTC_2D_4X4:
555 return PixelFormat::ASTC_2D_4X4; 561 return PixelFormat::ASTC_2D_4X4;
562 case Tegra::Texture::TextureFormat::ASTC_2D_5X4:
563 return PixelFormat::ASTC_2D_5X4;
556 case Tegra::Texture::TextureFormat::ASTC_2D_8X8: 564 case Tegra::Texture::TextureFormat::ASTC_2D_8X8:
557 return PixelFormat::ASTC_2D_8X8; 565 return PixelFormat::ASTC_2D_8X8;
566 case Tegra::Texture::TextureFormat::ASTC_2D_8X5:
567 return PixelFormat::ASTC_2D_8X5;
558 case Tegra::Texture::TextureFormat::R16_G16: 568 case Tegra::Texture::TextureFormat::R16_G16:
559 switch (component_type) { 569 switch (component_type) {
560 case Tegra::Texture::ComponentType::FLOAT: 570 case Tegra::Texture::ComponentType::FLOAT:
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index 3d5476e5d..8d2daa284 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -125,7 +125,9 @@ u32 BytesPerPixel(TextureFormat format) {
125 case TextureFormat::R32_G32_B32: 125 case TextureFormat::R32_G32_B32:
126 return 12; 126 return 12;
127 case TextureFormat::ASTC_2D_4X4: 127 case TextureFormat::ASTC_2D_4X4:
128 case TextureFormat::ASTC_2D_5X4:
128 case TextureFormat::ASTC_2D_8X8: 129 case TextureFormat::ASTC_2D_8X8:
130 case TextureFormat::ASTC_2D_8X5:
129 case TextureFormat::A8R8G8B8: 131 case TextureFormat::A8R8G8B8:
130 case TextureFormat::A2B10G10R10: 132 case TextureFormat::A2B10G10R10:
131 case TextureFormat::BF10GF11RF11: 133 case TextureFormat::BF10GF11RF11: