diff options
| author | 2018-11-19 04:53:03 +0100 | |
|---|---|---|
| committer | 2018-11-18 19:53:03 -0800 | |
| commit | 11a1442229e097ddeb092afd4f0bf444c5042b10 (patch) | |
| tree | f65d63b6f02fa637279f320aba69b2eaee087b89 /src/video_core/textures/decoders.cpp | |
| parent | Merge pull request #1640 from DarkLordZach/game-list-reload (diff) | |
| download | yuzu-11a1442229e097ddeb092afd4f0bf444c5042b10.tar.gz yuzu-11a1442229e097ddeb092afd4f0bf444c5042b10.tar.xz yuzu-11a1442229e097ddeb092afd4f0bf444c5042b10.zip | |
Eliminated unnessessary memory allocation and copy (#1702)
Diffstat (limited to 'src/video_core/textures/decoders.cpp')
| -rw-r--r-- | src/video_core/textures/decoders.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index 19f30b1b5..c9160b467 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -229,14 +229,21 @@ u32 BytesPerPixel(TextureFormat format) { | |||
| 229 | } | 229 | } |
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | void UnswizzleTexture(u8* const unswizzled_data, VAddr address, u32 tile_size_x, u32 tile_size_y, | ||
| 233 | u32 bytes_per_pixel, u32 width, u32 height, u32 depth, u32 block_height, | ||
| 234 | u32 block_depth) { | ||
| 235 | CopySwizzledData((width + tile_size_x - 1) / tile_size_x, | ||
| 236 | (height + tile_size_y - 1) / tile_size_y, depth, bytes_per_pixel, | ||
| 237 | bytes_per_pixel, Memory::GetPointer(address), unswizzled_data, true, | ||
| 238 | block_height, block_depth); | ||
| 239 | } | ||
| 240 | |||
| 232 | std::vector<u8> UnswizzleTexture(VAddr address, u32 tile_size_x, u32 tile_size_y, | 241 | std::vector<u8> UnswizzleTexture(VAddr address, u32 tile_size_x, u32 tile_size_y, |
| 233 | u32 bytes_per_pixel, u32 width, u32 height, u32 depth, | 242 | u32 bytes_per_pixel, u32 width, u32 height, u32 depth, |
| 234 | u32 block_height, u32 block_depth) { | 243 | u32 block_height, u32 block_depth) { |
| 235 | std::vector<u8> unswizzled_data(width * height * depth * bytes_per_pixel); | 244 | std::vector<u8> unswizzled_data(width * height * depth * bytes_per_pixel); |
| 236 | CopySwizzledData((width + tile_size_x - 1) / tile_size_x, | 245 | UnswizzleTexture(unswizzled_data.data(), address, tile_size_x, tile_size_y, bytes_per_pixel, |
| 237 | (height + tile_size_y - 1) / tile_size_y, depth, bytes_per_pixel, | 246 | width, height, depth, block_height, block_depth); |
| 238 | bytes_per_pixel, Memory::GetPointer(address), unswizzled_data.data(), true, | ||
| 239 | block_height, block_depth); | ||
| 240 | return unswizzled_data; | 247 | return unswizzled_data; |
| 241 | } | 248 | } |
| 242 | 249 | ||