summaryrefslogtreecommitdiff
path: root/src/video_core/textures/decoders.cpp
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2020-07-01 02:28:53 -0300
committerGravatar ReinUsesLisp2020-07-13 01:44:23 -0300
commitfbc232426d8ff739b0028fb5b41fb5124f7e1792 (patch)
treef3e99246a2b398151b409a1d331f27780a9a28ef /src/video_core/textures/decoders.cpp
parentvideo_core: Fix DXT4 and RGB565 (diff)
downloadyuzu-fbc232426d8ff739b0028fb5b41fb5124f7e1792.tar.gz
yuzu-fbc232426d8ff739b0028fb5b41fb5124f7e1792.tar.xz
yuzu-fbc232426d8ff739b0028fb5b41fb5124f7e1792.zip
video_core: Rearrange pixel format names
Normalizes pixel format names to match Vulkan names. Previous to this commit pixel formats had no convention, leading to confusion and potential bugs.
Diffstat (limited to 'src/video_core/textures/decoders.cpp')
-rw-r--r--src/video_core/textures/decoders.cpp89
1 files changed, 0 insertions, 89 deletions
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index 548e4c3fe..0cd17cb89 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -193,53 +193,6 @@ void CopySwizzledData(u32 width, u32 height, u32 depth, u32 bytes_per_pixel,
193 } 193 }
194} 194}
195 195
196u32 BytesPerPixel(TextureFormat format) {
197 switch (format) {
198 case TextureFormat::DXT1:
199 case TextureFormat::DXN1:
200 // In this case a 'pixel' actually refers to a 4x4 tile.
201 return 8;
202 case TextureFormat::DXT23:
203 case TextureFormat::DXT45:
204 case TextureFormat::DXN2:
205 case TextureFormat::BC7U:
206 case TextureFormat::BC6H_UF16:
207 case TextureFormat::BC6H_SF16:
208 // In this case a 'pixel' actually refers to a 4x4 tile.
209 return 16;
210 case TextureFormat::R32_G32_B32:
211 return 12;
212 case TextureFormat::ASTC_2D_4X4:
213 case TextureFormat::ASTC_2D_5X4:
214 case TextureFormat::ASTC_2D_8X8:
215 case TextureFormat::ASTC_2D_8X5:
216 case TextureFormat::ASTC_2D_10X8:
217 case TextureFormat::ASTC_2D_5X5:
218 case TextureFormat::A8R8G8B8:
219 case TextureFormat::A2B10G10R10:
220 case TextureFormat::BF10GF11RF11:
221 case TextureFormat::R32:
222 case TextureFormat::R16_G16:
223 return 4;
224 case TextureFormat::A1B5G5R5:
225 case TextureFormat::B5G6R5:
226 case TextureFormat::G8R8:
227 case TextureFormat::R16:
228 return 2;
229 case TextureFormat::R8:
230 return 1;
231 case TextureFormat::R16_G16_B16_A16:
232 return 8;
233 case TextureFormat::R32_G32_B32_A32:
234 return 16;
235 case TextureFormat::R32_G32:
236 return 8;
237 default:
238 UNIMPLEMENTED_MSG("Format not implemented");
239 return 1;
240 }
241}
242
243void UnswizzleTexture(u8* const unswizzled_data, u8* address, u32 tile_size_x, u32 tile_size_y, 196void UnswizzleTexture(u8* const unswizzled_data, u8* address, u32 tile_size_x, u32 tile_size_y,
244 u32 bytes_per_pixel, u32 width, u32 height, u32 depth, u32 block_height, 197 u32 bytes_per_pixel, u32 width, u32 height, u32 depth, u32 block_height,
245 u32 block_depth, u32 width_spacing) { 198 u32 block_depth, u32 width_spacing) {
@@ -328,48 +281,6 @@ void SwizzleKepler(const u32 width, const u32 height, const u32 dst_x, const u32
328 } 281 }
329} 282}
330 283
331std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat format, u32 width,
332 u32 height) {
333 std::vector<u8> rgba_data;
334
335 // TODO(Subv): Implement.
336 switch (format) {
337 case TextureFormat::DXT1:
338 case TextureFormat::DXT23:
339 case TextureFormat::DXT45:
340 case TextureFormat::DXN1:
341 case TextureFormat::DXN2:
342 case TextureFormat::BC7U:
343 case TextureFormat::BC6H_UF16:
344 case TextureFormat::BC6H_SF16:
345 case TextureFormat::ASTC_2D_4X4:
346 case TextureFormat::ASTC_2D_8X8:
347 case TextureFormat::ASTC_2D_5X5:
348 case TextureFormat::ASTC_2D_10X8:
349 case TextureFormat::A8R8G8B8:
350 case TextureFormat::A2B10G10R10:
351 case TextureFormat::A1B5G5R5:
352 case TextureFormat::B5G6R5:
353 case TextureFormat::R8:
354 case TextureFormat::G8R8:
355 case TextureFormat::BF10GF11RF11:
356 case TextureFormat::R32_G32_B32_A32:
357 case TextureFormat::R32_G32:
358 case TextureFormat::R32:
359 case TextureFormat::R16:
360 case TextureFormat::R16_G16:
361 case TextureFormat::R32_G32_B32:
362 // TODO(Subv): For the time being just forward the same data without any decoding.
363 rgba_data = texture_data;
364 break;
365 default:
366 UNIMPLEMENTED_MSG("Format not implemented");
367 break;
368 }
369
370 return rgba_data;
371}
372
373std::size_t CalculateSize(bool tiled, u32 bytes_per_pixel, u32 width, u32 height, u32 depth, 284std::size_t CalculateSize(bool tiled, u32 bytes_per_pixel, u32 width, u32 height, u32 depth,
374 u32 block_height, u32 block_depth) { 285 u32 block_height, u32 block_depth) {
375 if (tiled) { 286 if (tiled) {