summaryrefslogtreecommitdiff
path: root/src/video_core/textures/decoders.cpp
diff options
context:
space:
mode:
authorGravatar Subv2018-04-18 20:48:53 -0500
committerGravatar Subv2018-04-18 20:48:53 -0500
commit057170928ce71fb262d4d9969b7889971dc7232a (patch)
tree13c219cf533d215e6f20ce47a3ea92465974fd98 /src/video_core/textures/decoders.cpp
parentMerge pull request #351 from Subv/tex_formats (diff)
downloadyuzu-057170928ce71fb262d4d9969b7889971dc7232a.tar.gz
yuzu-057170928ce71fb262d4d9969b7889971dc7232a.tar.xz
yuzu-057170928ce71fb262d4d9969b7889971dc7232a.zip
GPU: Add support for the DXT23 and DXT45 compressed texture formats.
Diffstat (limited to 'src/video_core/textures/decoders.cpp')
-rw-r--r--src/video_core/textures/decoders.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index f4c7e40df..4df687786 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -48,6 +48,10 @@ u32 BytesPerPixel(TextureFormat format) {
48 case TextureFormat::DXT1: 48 case TextureFormat::DXT1:
49 // In this case a 'pixel' actually refers to a 4x4 tile. 49 // In this case a 'pixel' actually refers to a 4x4 tile.
50 return 8; 50 return 8;
51 case TextureFormat::DXT23:
52 case TextureFormat::DXT45:
53 // In this case a 'pixel' actually refers to a 4x4 tile.
54 return 16;
51 case TextureFormat::A8R8G8B8: 55 case TextureFormat::A8R8G8B8:
52 return 4; 56 return 4;
53 case TextureFormat::B5G6R5: 57 case TextureFormat::B5G6R5:
@@ -67,7 +71,9 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width,
67 71
68 switch (format) { 72 switch (format) {
69 case TextureFormat::DXT1: 73 case TextureFormat::DXT1:
70 // In the DXT1 format, each 4x4 tile is swizzled instead of just individual pixel values. 74 case TextureFormat::DXT23:
75 case TextureFormat::DXT45:
76 // In the DXT formats, each 4x4 tile is swizzled instead of just individual pixel values.
71 CopySwizzledData(width / 4, height / 4, bytes_per_pixel, bytes_per_pixel, data, 77 CopySwizzledData(width / 4, height / 4, bytes_per_pixel, bytes_per_pixel, data,
72 unswizzled_data.data(), true, block_height); 78 unswizzled_data.data(), true, block_height);
73 break; 79 break;
@@ -91,6 +97,8 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat
91 // TODO(Subv): Implement. 97 // TODO(Subv): Implement.
92 switch (format) { 98 switch (format) {
93 case TextureFormat::DXT1: 99 case TextureFormat::DXT1:
100 case TextureFormat::DXT23:
101 case TextureFormat::DXT45:
94 case TextureFormat::A8R8G8B8: 102 case TextureFormat::A8R8G8B8:
95 case TextureFormat::B5G6R5: 103 case TextureFormat::B5G6R5:
96 // TODO(Subv): For the time being just forward the same data without any decoding. 104 // TODO(Subv): For the time being just forward the same data without any decoding.