summaryrefslogtreecommitdiff
path: root/src/video_core/surface.cpp
diff options
context:
space:
mode:
authorGravatar FernandoS272018-10-29 22:46:09 -0400
committerGravatar FernandoS272018-11-01 19:22:12 -0400
commit60a184455c5aef7cce7e6232cab738f66cb0aac0 (patch)
tree7421f8289ad911124dd68ad5c8059ebc8ba3a017 /src/video_core/surface.cpp
parentFix ASTC formats (diff)
downloadyuzu-60a184455c5aef7cce7e6232cab738f66cb0aac0.tar.gz
yuzu-60a184455c5aef7cce7e6232cab738f66cb0aac0.tar.xz
yuzu-60a184455c5aef7cce7e6232cab738f66cb0aac0.zip
Fix ASTC Decompressor to support depth parameter
Diffstat (limited to 'src/video_core/surface.cpp')
-rw-r--r--src/video_core/surface.cpp26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp
index d9a97e30b..e284a4604 100644
--- a/src/video_core/surface.cpp
+++ b/src/video_core/surface.cpp
@@ -297,6 +297,8 @@ PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format,
297 return is_srgb ? PixelFormat::ASTC_2D_4X4_SRGB : PixelFormat::ASTC_2D_4X4; 297 return is_srgb ? PixelFormat::ASTC_2D_4X4_SRGB : PixelFormat::ASTC_2D_4X4;
298 case Tegra::Texture::TextureFormat::ASTC_2D_5X4: 298 case Tegra::Texture::TextureFormat::ASTC_2D_5X4:
299 return is_srgb ? PixelFormat::ASTC_2D_5X4_SRGB : PixelFormat::ASTC_2D_5X4; 299 return is_srgb ? PixelFormat::ASTC_2D_5X4_SRGB : PixelFormat::ASTC_2D_5X4;
300 case Tegra::Texture::TextureFormat::ASTC_2D_5X5:
301 return is_srgb ? PixelFormat::ASTC_2D_5X5_SRGB : PixelFormat::ASTC_2D_5X5;
300 case Tegra::Texture::TextureFormat::ASTC_2D_8X8: 302 case Tegra::Texture::TextureFormat::ASTC_2D_8X8:
301 return is_srgb ? PixelFormat::ASTC_2D_8X8_SRGB : PixelFormat::ASTC_2D_8X8; 303 return is_srgb ? PixelFormat::ASTC_2D_8X8_SRGB : PixelFormat::ASTC_2D_8X8;
302 case Tegra::Texture::TextureFormat::ASTC_2D_8X5: 304 case Tegra::Texture::TextureFormat::ASTC_2D_8X5:
@@ -440,10 +442,12 @@ bool IsPixelFormatASTC(PixelFormat format) {
440 switch (format) { 442 switch (format) {
441 case PixelFormat::ASTC_2D_4X4: 443 case PixelFormat::ASTC_2D_4X4:
442 case PixelFormat::ASTC_2D_5X4: 444 case PixelFormat::ASTC_2D_5X4:
445 case PixelFormat::ASTC_2D_5X5:
443 case PixelFormat::ASTC_2D_8X8: 446 case PixelFormat::ASTC_2D_8X8:
444 case PixelFormat::ASTC_2D_8X5: 447 case PixelFormat::ASTC_2D_8X5:
445 case PixelFormat::ASTC_2D_4X4_SRGB: 448 case PixelFormat::ASTC_2D_4X4_SRGB:
446 case PixelFormat::ASTC_2D_5X4_SRGB: 449 case PixelFormat::ASTC_2D_5X4_SRGB:
450 case PixelFormat::ASTC_2D_5X5_SRGB:
447 case PixelFormat::ASTC_2D_8X8_SRGB: 451 case PixelFormat::ASTC_2D_8X8_SRGB:
448 case PixelFormat::ASTC_2D_8X5_SRGB: 452 case PixelFormat::ASTC_2D_8X5_SRGB:
449 return true; 453 return true;
@@ -453,27 +457,7 @@ bool IsPixelFormatASTC(PixelFormat format) {
453} 457}
454 458
455std::pair<u32, u32> GetASTCBlockSize(PixelFormat format) { 459std::pair<u32, u32> GetASTCBlockSize(PixelFormat format) {
456 switch (format) { 460 return {GetDefaultBlockWidth(format), GetDefaultBlockHeight(format)};
457 case PixelFormat::ASTC_2D_4X4:
458 return {4, 4};
459 case PixelFormat::ASTC_2D_5X4:
460 return {5, 4};
461 case PixelFormat::ASTC_2D_8X8:
462 return {8, 8};
463 case PixelFormat::ASTC_2D_8X5:
464 return {8, 5};
465 case PixelFormat::ASTC_2D_4X4_SRGB:
466 return {4, 4};
467 case PixelFormat::ASTC_2D_5X4_SRGB:
468 return {5, 4};
469 case PixelFormat::ASTC_2D_8X8_SRGB:
470 return {8, 8};
471 case PixelFormat::ASTC_2D_8X5_SRGB:
472 return {8, 5};
473 default:
474 LOG_CRITICAL(HW_GPU, "Unhandled format: {}", static_cast<u32>(format));
475 UNREACHABLE();
476 }
477} 461}
478 462
479bool IsFormatBCn(PixelFormat format) { 463bool IsFormatBCn(PixelFormat format) {