diff options
| author | 2019-04-15 21:06:04 -0400 | |
|---|---|---|
| committer | 2019-04-15 21:22:16 -0400 | |
| commit | bec28d692d21a42f17ae26f0ab6271aca1c233cd (patch) | |
| tree | c776ad716389b6113b76cd058e0c236c6697f7a2 /src/video_core/textures/decoders.cpp | |
| parent | Correct Kepler Memory on Linear Pushes. (diff) | |
| download | yuzu-bec28d692d21a42f17ae26f0ab6271aca1c233cd.tar.gz yuzu-bec28d692d21a42f17ae26f0ab6271aca1c233cd.tar.xz yuzu-bec28d692d21a42f17ae26f0ab6271aca1c233cd.zip | |
Implement Block Linear copies in Kepler Memory.
Diffstat (limited to 'src/video_core/textures/decoders.cpp')
| -rw-r--r-- | src/video_core/textures/decoders.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index 995d0e068..6e02a6407 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -288,6 +288,27 @@ 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, | ||
| 292 | std::size_t copy_size, u8* source_data, u8* swizzle_data) { | ||
| 293 | const u32 image_width_in_gobs{(width + gob_size_x - 1) / gob_size_x}; | ||
| 294 | std::size_t count = 0; | ||
| 295 | for (u32 y = dst_y; y < height && count < copy_size; ++y) { | ||
| 296 | const u32 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_y) * gob_size; | ||
| 299 | const auto& table = legacy_swizzle_table[y % gob_size_y]; | ||
| 300 | for (u32 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 u32 swizzled_offset = gob_address + table[x % gob_size_x]; | ||
| 303 | const u8* source_line = source_data + count; | ||
| 304 | u8* dest_addr = swizzle_data + swizzled_offset; | ||
| 305 | count++; | ||
| 306 | |||
| 307 | std::memcpy(dest_addr, source_line, 1); | ||
| 308 | } | ||
| 309 | } | ||
| 310 | } | ||
| 311 | |||
| 291 | std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat format, u32 width, | 312 | std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat format, u32 width, |
| 292 | u32 height) { | 313 | u32 height) { |
| 293 | std::vector<u8> rgba_data; | 314 | std::vector<u8> rgba_data; |