diff options
| author | 2019-04-22 16:47:05 -0400 | |
|---|---|---|
| committer | 2019-04-22 16:47:05 -0400 | |
| commit | 01100f8afdc22cfcc0b94b86b7e352a41120b8d9 (patch) | |
| tree | 40dc11e843f60d886ff7d4ddecab694cc4ce6451 /src/video_core/textures/decoders.cpp | |
| parent | Merge pull request #2407 from FernandoS27/f2f (diff) | |
| parent | Apply Const correctness to SwizzleKepler and replace u32 for size_t on iterat... (diff) | |
| download | yuzu-01100f8afdc22cfcc0b94b86b7e352a41120b8d9.tar.gz yuzu-01100f8afdc22cfcc0b94b86b7e352a41120b8d9.tar.xz yuzu-01100f8afdc22cfcc0b94b86b7e352a41120b8d9.zip | |
Merge pull request #2400 from FernandoS27/corret-kepler-mem
Implement Kepler Memory on both Linear and BlockLinear.
Diffstat (limited to 'src/video_core/textures/decoders.cpp')
| -rw-r--r-- | src/video_core/textures/decoders.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index 995d0e068..217805386 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -288,6 +288,29 @@ void UnswizzleSubrect(u32 subrect_width, u32 subrect_height, u32 dest_pitch, u32 | |||
| 288 | } | 288 | } |
| 289 | } | 289 | } |
| 290 | 290 | ||
| 291 | void SwizzleKepler(const u32 width, const u32 height, const u32 dst_x, const u32 dst_y, | ||
| 292 | const u32 block_height, const std::size_t copy_size, const u8* source_data, | ||
| 293 | u8* swizzle_data) { | ||
| 294 | const u32 image_width_in_gobs{(width + gob_size_x - 1) / gob_size_x}; | ||
| 295 | std::size_t count = 0; | ||
| 296 | for (std::size_t y = dst_y; y < height && count < copy_size; ++y) { | ||
| 297 | const std::size_t gob_address_y = | ||
| 298 | (y / (gob_size_y * block_height)) * gob_size * block_height * image_width_in_gobs + | ||
| 299 | ((y % (gob_size_y * block_height)) / gob_size_y) * gob_size; | ||
| 300 | const auto& table = legacy_swizzle_table[y % gob_size_y]; | ||
| 301 | for (std::size_t x = dst_x; x < width && count < copy_size; ++x) { | ||
| 302 | const std::size_t gob_address = | ||
| 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]; | ||
| 305 | const u8* source_line = source_data + count; | ||
| 306 | u8* dest_addr = swizzle_data + swizzled_offset; | ||
| 307 | count++; | ||
| 308 | |||
| 309 | std::memcpy(dest_addr, source_line, 1); | ||
| 310 | } | ||
| 311 | } | ||
| 312 | } | ||
| 313 | |||
| 291 | std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat format, u32 width, | 314 | std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat format, u32 width, |
| 292 | u32 height) { | 315 | u32 height) { |
| 293 | std::vector<u8> rgba_data; | 316 | std::vector<u8> rgba_data; |