summaryrefslogtreecommitdiff
path: root/src/video_core/surface.cpp
diff options
context:
space:
mode:
authorGravatar Rodrigo Locatti2019-10-17 19:24:11 -0300
committerGravatar GitHub2019-10-17 19:24:11 -0300
commit219fdcb9d967af3bef6aafa1dc351b824725bbe0 (patch)
tree231e7949840d075a0aeb156b7bdcb119037b8ad2 /src/video_core/surface.cpp
parentMerge pull request #2979 from lioncash/macro (diff)
parentSurfaces: Implement R4G4B4A4U format. (diff)
downloadyuzu-219fdcb9d967af3bef6aafa1dc351b824725bbe0.tar.gz
yuzu-219fdcb9d967af3bef6aafa1dc351b824725bbe0.tar.xz
yuzu-219fdcb9d967af3bef6aafa1dc351b824725bbe0.zip
Merge pull request #2966 from FernandoS27/astc-formats
Implement a series of ASTC formats and R4G4B4A4 format
Diffstat (limited to 'src/video_core/surface.cpp')
-rw-r--r--src/video_core/surface.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp
index ef6b3592e..9a3c05288 100644
--- a/src/video_core/surface.cpp
+++ b/src/video_core/surface.cpp
@@ -212,6 +212,14 @@ PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format,
212 break; 212 break;
213 } 213 }
214 break; 214 break;
215 case Tegra::Texture::TextureFormat::A4B4G4R4:
216 switch (component_type) {
217 case Tegra::Texture::ComponentType::UNORM:
218 return PixelFormat::R4G4B4A4U;
219 default:
220 break;
221 }
222 break;
215 case Tegra::Texture::TextureFormat::R8: 223 case Tegra::Texture::TextureFormat::R8:
216 switch (component_type) { 224 switch (component_type) {
217 case Tegra::Texture::ComponentType::UNORM: 225 case Tegra::Texture::ComponentType::UNORM:
@@ -351,6 +359,16 @@ PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format,
351 return is_srgb ? PixelFormat::ASTC_2D_8X5_SRGB : PixelFormat::ASTC_2D_8X5; 359 return is_srgb ? PixelFormat::ASTC_2D_8X5_SRGB : PixelFormat::ASTC_2D_8X5;
352 case Tegra::Texture::TextureFormat::ASTC_2D_10X8: 360 case Tegra::Texture::TextureFormat::ASTC_2D_10X8:
353 return is_srgb ? PixelFormat::ASTC_2D_10X8_SRGB : PixelFormat::ASTC_2D_10X8; 361 return is_srgb ? PixelFormat::ASTC_2D_10X8_SRGB : PixelFormat::ASTC_2D_10X8;
362 case Tegra::Texture::TextureFormat::ASTC_2D_6X6:
363 return is_srgb ? PixelFormat::ASTC_2D_6X6_SRGB : PixelFormat::ASTC_2D_6X6;
364 case Tegra::Texture::TextureFormat::ASTC_2D_10X10:
365 return is_srgb ? PixelFormat::ASTC_2D_10X10_SRGB : PixelFormat::ASTC_2D_10X10;
366 case Tegra::Texture::TextureFormat::ASTC_2D_12X12:
367 return is_srgb ? PixelFormat::ASTC_2D_12X12_SRGB : PixelFormat::ASTC_2D_12X12;
368 case Tegra::Texture::TextureFormat::ASTC_2D_8X6:
369 return is_srgb ? PixelFormat::ASTC_2D_8X6_SRGB : PixelFormat::ASTC_2D_8X6;
370 case Tegra::Texture::TextureFormat::ASTC_2D_6X5:
371 return is_srgb ? PixelFormat::ASTC_2D_6X5_SRGB : PixelFormat::ASTC_2D_6X5;
354 case Tegra::Texture::TextureFormat::R16_G16: 372 case Tegra::Texture::TextureFormat::R16_G16:
355 switch (component_type) { 373 switch (component_type) {
356 case Tegra::Texture::ComponentType::FLOAT: 374 case Tegra::Texture::ComponentType::FLOAT:
@@ -511,6 +529,16 @@ bool IsPixelFormatASTC(PixelFormat format) {
511 case PixelFormat::ASTC_2D_8X5_SRGB: 529 case PixelFormat::ASTC_2D_8X5_SRGB:
512 case PixelFormat::ASTC_2D_10X8: 530 case PixelFormat::ASTC_2D_10X8:
513 case PixelFormat::ASTC_2D_10X8_SRGB: 531 case PixelFormat::ASTC_2D_10X8_SRGB:
532 case PixelFormat::ASTC_2D_6X6:
533 case PixelFormat::ASTC_2D_6X6_SRGB:
534 case PixelFormat::ASTC_2D_10X10:
535 case PixelFormat::ASTC_2D_10X10_SRGB:
536 case PixelFormat::ASTC_2D_12X12:
537 case PixelFormat::ASTC_2D_12X12_SRGB:
538 case PixelFormat::ASTC_2D_8X6:
539 case PixelFormat::ASTC_2D_8X6_SRGB:
540 case PixelFormat::ASTC_2D_6X5:
541 case PixelFormat::ASTC_2D_6X5_SRGB:
514 return true; 542 return true;
515 default: 543 default:
516 return false; 544 return false;
@@ -531,6 +559,11 @@ bool IsPixelFormatSRGB(PixelFormat format) {
531 case PixelFormat::ASTC_2D_5X4_SRGB: 559 case PixelFormat::ASTC_2D_5X4_SRGB:
532 case PixelFormat::ASTC_2D_5X5_SRGB: 560 case PixelFormat::ASTC_2D_5X5_SRGB:
533 case PixelFormat::ASTC_2D_10X8_SRGB: 561 case PixelFormat::ASTC_2D_10X8_SRGB:
562 case PixelFormat::ASTC_2D_6X6_SRGB:
563 case PixelFormat::ASTC_2D_10X10_SRGB:
564 case PixelFormat::ASTC_2D_12X12_SRGB:
565 case PixelFormat::ASTC_2D_8X6_SRGB:
566 case PixelFormat::ASTC_2D_6X5_SRGB:
534 return true; 567 return true;
535 default: 568 default:
536 return false; 569 return false;