diff options
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 7 | ||||
| -rw-r--r-- | src/video_core/textures/decoders.cpp | 15 | ||||
| -rw-r--r-- | src/video_core/textures/decoders.h | 7 |
3 files changed, 20 insertions, 9 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index b44ecfa1c..9ca82c06c 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -381,11 +381,8 @@ void MortonCopy(u32 stride, u32 block_height, u32 height, u32 block_depth, u32 d | |||
| 381 | const u32 tile_size_y{GetDefaultBlockHeight(format)}; | 381 | const u32 tile_size_y{GetDefaultBlockHeight(format)}; |
| 382 | 382 | ||
| 383 | if (morton_to_gl) { | 383 | if (morton_to_gl) { |
| 384 | const std::vector<u8> data = | 384 | Tegra::Texture::UnswizzleTexture(gl_buffer, addr, tile_size_x, tile_size_y, bytes_per_pixel, |
| 385 | Tegra::Texture::UnswizzleTexture(addr, tile_size_x, tile_size_y, bytes_per_pixel, | 385 | stride, height, depth, block_height, block_depth); |
| 386 | stride, height, depth, block_height, block_depth); | ||
| 387 | const std::size_t size_to_copy{std::min(gl_buffer_size, data.size())}; | ||
| 388 | memcpy(gl_buffer, data.data(), size_to_copy); | ||
| 389 | } else { | 386 | } else { |
| 390 | Tegra::Texture::CopySwizzledData((stride + tile_size_x - 1) / tile_size_x, | 387 | Tegra::Texture::CopySwizzledData((stride + tile_size_x - 1) / tile_size_x, |
| 391 | (height + tile_size_y - 1) / tile_size_y, depth, | 388 | (height + tile_size_y - 1) / tile_size_y, depth, |
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 | ||
diff --git a/src/video_core/textures/decoders.h b/src/video_core/textures/decoders.h index ba065510b..f4ef7c73e 100644 --- a/src/video_core/textures/decoders.h +++ b/src/video_core/textures/decoders.h | |||
| @@ -19,6 +19,13 @@ inline std::size_t GetGOBSize() { | |||
| 19 | /** | 19 | /** |
| 20 | * Unswizzles a swizzled texture without changing its format. | 20 | * Unswizzles a swizzled texture without changing its format. |
| 21 | */ | 21 | */ |
| 22 | void UnswizzleTexture(u8* unswizzled_data, VAddr address, u32 tile_size_x, u32 tile_size_y, | ||
| 23 | u32 bytes_per_pixel, u32 width, u32 height, u32 depth, | ||
| 24 | u32 block_height = TICEntry::DefaultBlockHeight, | ||
| 25 | u32 block_depth = TICEntry::DefaultBlockHeight); | ||
| 26 | /** | ||
| 27 | * Unswizzles a swizzled texture without changing its format. | ||
| 28 | */ | ||
| 22 | std::vector<u8> UnswizzleTexture(VAddr address, u32 tile_size_x, u32 tile_size_y, | 29 | std::vector<u8> UnswizzleTexture(VAddr address, u32 tile_size_x, u32 tile_size_y, |
| 23 | u32 bytes_per_pixel, u32 width, u32 height, u32 depth, | 30 | u32 bytes_per_pixel, u32 width, u32 height, u32 depth, |
| 24 | u32 block_height = TICEntry::DefaultBlockHeight, | 31 | u32 block_height = TICEntry::DefaultBlockHeight, |