diff options
| author | 2019-04-16 12:00:46 -0400 | |
|---|---|---|
| committer | 2019-04-16 12:00:46 -0400 | |
| commit | da91e6e4b6aabe13f7b748930de8afa28d10aa6c (patch) | |
| tree | 8993c0ad56415b7e8a2df007d30db67fff12fa9f /src/video_core/textures/decoders.cpp | |
| parent | Use WriteBlock and ReadBlock. (diff) | |
| download | yuzu-da91e6e4b6aabe13f7b748930de8afa28d10aa6c.tar.gz yuzu-da91e6e4b6aabe13f7b748930de8afa28d10aa6c.tar.xz yuzu-da91e6e4b6aabe13f7b748930de8afa28d10aa6c.zip | |
Apply Const correctness to SwizzleKepler and replace u32 for size_t on iterators.
Diffstat (limited to 'src/video_core/textures/decoders.cpp')
| -rw-r--r-- | src/video_core/textures/decoders.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index 6e02a6407..217805386 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -288,18 +288,20 @@ void UnswizzleSubrect(u32 subrect_width, u32 subrect_height, u32 dest_pitch, u32 | |||
| 288 | } | 288 | } |
| 289 | } | 289 | } |
| 290 | 290 | ||
| 291 | void SwizzleKepler(u32 width, u32 height, u32 dst_x, u32 dst_y, u32 block_height, | 291 | void SwizzleKepler(const u32 width, const u32 height, const u32 dst_x, const u32 dst_y, |
| 292 | std::size_t copy_size, u8* source_data, u8* swizzle_data) { | 292 | const u32 block_height, const std::size_t copy_size, const u8* source_data, |
| 293 | u8* swizzle_data) { | ||
| 293 | const u32 image_width_in_gobs{(width + gob_size_x - 1) / gob_size_x}; | 294 | const u32 image_width_in_gobs{(width + gob_size_x - 1) / gob_size_x}; |
| 294 | std::size_t count = 0; | 295 | std::size_t count = 0; |
| 295 | for (u32 y = dst_y; y < height && count < copy_size; ++y) { | 296 | for (std::size_t y = dst_y; y < height && count < copy_size; ++y) { |
| 296 | const u32 gob_address_y = | 297 | const std::size_t gob_address_y = |
| 297 | (y / (gob_size_y * block_height)) * gob_size * block_height * image_width_in_gobs + | 298 | (y / (gob_size_y * block_height)) * gob_size * block_height * image_width_in_gobs + |
| 298 | ((y % (gob_size_y * block_height)) / gob_size_y) * gob_size; | 299 | ((y % (gob_size_y * block_height)) / gob_size_y) * gob_size; |
| 299 | const auto& table = legacy_swizzle_table[y % gob_size_y]; | 300 | const auto& table = legacy_swizzle_table[y % gob_size_y]; |
| 300 | for (u32 x = dst_x; x < width && count < copy_size; ++x) { | 301 | for (std::size_t x = dst_x; x < width && count < copy_size; ++x) { |
| 301 | const u32 gob_address = gob_address_y + (x / gob_size_x) * gob_size * block_height; | 302 | const std::size_t gob_address = |
| 302 | const u32 swizzled_offset = gob_address + table[x % gob_size_x]; | 303 | gob_address_y + (x / gob_size_x) * gob_size * block_height; |
| 304 | const std::size_t swizzled_offset = gob_address + table[x % gob_size_x]; | ||
| 303 | const u8* source_line = source_data + count; | 305 | const u8* source_line = source_data + count; |
| 304 | u8* dest_addr = swizzle_data + swizzled_offset; | 306 | u8* dest_addr = swizzle_data + swizzled_offset; |
| 305 | count++; | 307 | count++; |