diff options
Diffstat (limited to 'src/video_core/textures/decoders.h')
| -rw-r--r-- | src/video_core/textures/decoders.h | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/src/video_core/textures/decoders.h b/src/video_core/textures/decoders.h index 01e156bc8..d7cdc81e8 100644 --- a/src/video_core/textures/decoders.h +++ b/src/video_core/textures/decoders.h | |||
| @@ -4,7 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <vector> | 7 | #include <span> |
| 8 | |||
| 8 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 9 | #include "video_core/textures/texture.h" | 10 | #include "video_core/textures/texture.h" |
| 10 | 11 | ||
| @@ -15,28 +16,25 @@ constexpr u32 GOB_SIZE_Y = 8; | |||
| 15 | constexpr u32 GOB_SIZE_Z = 1; | 16 | constexpr u32 GOB_SIZE_Z = 1; |
| 16 | constexpr u32 GOB_SIZE = GOB_SIZE_X * GOB_SIZE_Y * GOB_SIZE_Z; | 17 | constexpr u32 GOB_SIZE = GOB_SIZE_X * GOB_SIZE_Y * GOB_SIZE_Z; |
| 17 | 18 | ||
| 18 | constexpr std::size_t GOB_SIZE_X_SHIFT = 6; | 19 | constexpr u32 GOB_SIZE_X_SHIFT = 6; |
| 19 | constexpr std::size_t GOB_SIZE_Y_SHIFT = 3; | 20 | constexpr u32 GOB_SIZE_Y_SHIFT = 3; |
| 20 | constexpr std::size_t GOB_SIZE_Z_SHIFT = 0; | 21 | constexpr u32 GOB_SIZE_Z_SHIFT = 0; |
| 21 | constexpr std::size_t GOB_SIZE_SHIFT = GOB_SIZE_X_SHIFT + GOB_SIZE_Y_SHIFT + GOB_SIZE_Z_SHIFT; | 22 | constexpr u32 GOB_SIZE_SHIFT = GOB_SIZE_X_SHIFT + GOB_SIZE_Y_SHIFT + GOB_SIZE_Z_SHIFT; |
| 22 | 23 | ||
| 23 | /// Unswizzles a swizzled texture without changing its format. | 24 | using SwizzleTable = std::array<std::array<u32, GOB_SIZE_X>, GOB_SIZE_Y>; |
| 24 | void UnswizzleTexture(u8* unswizzled_data, u8* address, u32 tile_size_x, u32 tile_size_y, | 25 | |
| 25 | u32 bytes_per_pixel, u32 width, u32 height, u32 depth, | 26 | /// Returns a z-order swizzle table |
| 26 | u32 block_height = TICEntry::DefaultBlockHeight, | 27 | SwizzleTable MakeSwizzleTable(); |
| 27 | u32 block_depth = TICEntry::DefaultBlockHeight, u32 width_spacing = 0); | 28 | |
| 28 | 29 | /// Unswizzles a block linear texture into linear memory. | |
| 29 | /// Unswizzles a swizzled texture without changing its format. | 30 | void UnswizzleTexture(std::span<u8> output, std::span<const u8> input, u32 bytes_per_pixel, |
| 30 | std::vector<u8> UnswizzleTexture(u8* address, u32 tile_size_x, u32 tile_size_y, u32 bytes_per_pixel, | 31 | u32 width, u32 height, u32 depth, u32 block_height, u32 block_depth, |
| 31 | u32 width, u32 height, u32 depth, | 32 | u32 stride_alignment = 1); |
| 32 | u32 block_height = TICEntry::DefaultBlockHeight, | 33 | |
| 33 | u32 block_depth = TICEntry::DefaultBlockHeight, | 34 | /// Swizzles linear memory into a block linear texture. |
| 34 | u32 width_spacing = 0); | 35 | void SwizzleTexture(std::span<u8> output, std::span<const u8> input, u32 bytes_per_pixel, u32 width, |
| 35 | 36 | u32 height, u32 depth, u32 block_height, u32 block_depth, | |
| 36 | /// Copies texture data from a buffer and performs swizzling/unswizzling as necessary. | 37 | u32 stride_alignment = 1); |
| 37 | void CopySwizzledData(u32 width, u32 height, u32 depth, u32 bytes_per_pixel, | ||
| 38 | u32 out_bytes_per_pixel, u8* swizzled_data, u8* unswizzled_data, | ||
| 39 | bool unswizzle, u32 block_height, u32 block_depth, u32 width_spacing); | ||
| 40 | 38 | ||
| 41 | /// This function calculates the correct size of a texture depending if it's tiled or not. | 39 | /// This function calculates the correct size of a texture depending if it's tiled or not. |
| 42 | std::size_t CalculateSize(bool tiled, u32 bytes_per_pixel, u32 width, u32 height, u32 depth, | 40 | std::size_t CalculateSize(bool tiled, u32 bytes_per_pixel, u32 width, u32 height, u32 depth, |