diff options
Diffstat (limited to '')
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 9 | ||||
| -rw-r--r-- | src/video_core/texture_cache/util.cpp | 11 | ||||
| -rw-r--r-- | src/video_core/texture_cache/util.h | 3 |
3 files changed, 14 insertions, 9 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index fccf4316d..6d7d8226f 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -96,7 +96,8 @@ void TextureCache<P>::RunGarbageCollector() { | |||
| 96 | const auto copies = FullDownloadCopies(image.info); | 96 | const auto copies = FullDownloadCopies(image.info); |
| 97 | image.DownloadMemory(map, copies); | 97 | image.DownloadMemory(map, copies); |
| 98 | runtime.Finish(); | 98 | runtime.Finish(); |
| 99 | SwizzleImage(*gpu_memory, image.gpu_addr, image.info, copies, map.mapped_span); | 99 | SwizzleImage(*gpu_memory, image.gpu_addr, image.info, copies, map.mapped_span, |
| 100 | swizzle_data_buffer); | ||
| 100 | } | 101 | } |
| 101 | if (True(image.flags & ImageFlagBits::Tracked)) { | 102 | if (True(image.flags & ImageFlagBits::Tracked)) { |
| 102 | UntrackImage(image, image_id); | 103 | UntrackImage(image, image_id); |
| @@ -467,7 +468,8 @@ void TextureCache<P>::DownloadMemory(VAddr cpu_addr, size_t size) { | |||
| 467 | const auto copies = FullDownloadCopies(image.info); | 468 | const auto copies = FullDownloadCopies(image.info); |
| 468 | image.DownloadMemory(map, copies); | 469 | image.DownloadMemory(map, copies); |
| 469 | runtime.Finish(); | 470 | runtime.Finish(); |
| 470 | SwizzleImage(*gpu_memory, image.gpu_addr, image.info, copies, map.mapped_span); | 471 | SwizzleImage(*gpu_memory, image.gpu_addr, image.info, copies, map.mapped_span, |
| 472 | swizzle_data_buffer); | ||
| 471 | } | 473 | } |
| 472 | } | 474 | } |
| 473 | 475 | ||
| @@ -678,7 +680,8 @@ void TextureCache<P>::PopAsyncFlushes() { | |||
| 678 | for (const ImageId image_id : download_ids) { | 680 | for (const ImageId image_id : download_ids) { |
| 679 | const ImageBase& image = slot_images[image_id]; | 681 | const ImageBase& image = slot_images[image_id]; |
| 680 | const auto copies = FullDownloadCopies(image.info); | 682 | const auto copies = FullDownloadCopies(image.info); |
| 681 | SwizzleImage(*gpu_memory, image.gpu_addr, image.info, copies, download_span); | 683 | SwizzleImage(*gpu_memory, image.gpu_addr, image.info, copies, download_span, |
| 684 | swizzle_data_buffer); | ||
| 682 | download_map.offset += image.unswizzled_size_bytes; | 685 | download_map.offset += image.unswizzled_size_bytes; |
| 683 | download_span = download_span.subspan(image.unswizzled_size_bytes); | 686 | download_span = download_span.subspan(image.unswizzled_size_bytes); |
| 684 | } | 687 | } |
diff --git a/src/video_core/texture_cache/util.cpp b/src/video_core/texture_cache/util.cpp index 4488fa9da..7999a7f06 100644 --- a/src/video_core/texture_cache/util.cpp +++ b/src/video_core/texture_cache/util.cpp | |||
| @@ -505,7 +505,7 @@ void SwizzlePitchLinearImage(Tegra::MemoryManager& gpu_memory, GPUVAddr gpu_addr | |||
| 505 | 505 | ||
| 506 | void SwizzleBlockLinearImage(Tegra::MemoryManager& gpu_memory, GPUVAddr gpu_addr, | 506 | void SwizzleBlockLinearImage(Tegra::MemoryManager& gpu_memory, GPUVAddr gpu_addr, |
| 507 | const ImageInfo& info, const BufferImageCopy& copy, | 507 | const ImageInfo& info, const BufferImageCopy& copy, |
| 508 | std::span<const u8> input) { | 508 | std::span<const u8> input, std::vector<u8>& tmp_buffer) { |
| 509 | const Extent3D size = info.size; | 509 | const Extent3D size = info.size; |
| 510 | const LevelInfo level_info = MakeLevelInfo(info); | 510 | const LevelInfo level_info = MakeLevelInfo(info); |
| 511 | const Extent2D tile_size = DefaultBlockSize(info.format); | 511 | const Extent2D tile_size = DefaultBlockSize(info.format); |
| @@ -534,8 +534,8 @@ void SwizzleBlockLinearImage(Tegra::MemoryManager& gpu_memory, GPUVAddr gpu_addr | |||
| 534 | tile_size.height, info.tile_width_spacing); | 534 | tile_size.height, info.tile_width_spacing); |
| 535 | const size_t subresource_size = sizes[level]; | 535 | const size_t subresource_size = sizes[level]; |
| 536 | 536 | ||
| 537 | const auto dst_data = std::make_unique<u8[]>(subresource_size); | 537 | tmp_buffer.resize(subresource_size); |
| 538 | const std::span<u8> dst(dst_data.get(), subresource_size); | 538 | const std::span<u8> dst(tmp_buffer); |
| 539 | 539 | ||
| 540 | for (s32 layer = 0; layer < info.resources.layers; ++layer) { | 540 | for (s32 layer = 0; layer < info.resources.layers; ++layer) { |
| 541 | const std::span<const u8> src = input.subspan(host_offset); | 541 | const std::span<const u8> src = input.subspan(host_offset); |
| @@ -977,13 +977,14 @@ std::vector<SwizzleParameters> FullUploadSwizzles(const ImageInfo& info) { | |||
| 977 | } | 977 | } |
| 978 | 978 | ||
| 979 | void SwizzleImage(Tegra::MemoryManager& gpu_memory, GPUVAddr gpu_addr, const ImageInfo& info, | 979 | void SwizzleImage(Tegra::MemoryManager& gpu_memory, GPUVAddr gpu_addr, const ImageInfo& info, |
| 980 | std::span<const BufferImageCopy> copies, std::span<const u8> memory) { | 980 | std::span<const BufferImageCopy> copies, std::span<const u8> memory, |
| 981 | std::vector<u8>& tmp_buffer) { | ||
| 981 | const bool is_pitch_linear = info.type == ImageType::Linear; | 982 | const bool is_pitch_linear = info.type == ImageType::Linear; |
| 982 | for (const BufferImageCopy& copy : copies) { | 983 | for (const BufferImageCopy& copy : copies) { |
| 983 | if (is_pitch_linear) { | 984 | if (is_pitch_linear) { |
| 984 | SwizzlePitchLinearImage(gpu_memory, gpu_addr, info, copy, memory); | 985 | SwizzlePitchLinearImage(gpu_memory, gpu_addr, info, copy, memory); |
| 985 | } else { | 986 | } else { |
| 986 | SwizzleBlockLinearImage(gpu_memory, gpu_addr, info, copy, memory); | 987 | SwizzleBlockLinearImage(gpu_memory, gpu_addr, info, copy, memory, tmp_buffer); |
| 987 | } | 988 | } |
| 988 | } | 989 | } |
| 989 | } | 990 | } |
diff --git a/src/video_core/texture_cache/util.h b/src/video_core/texture_cache/util.h index ddf0b3b06..2c991b4d2 100644 --- a/src/video_core/texture_cache/util.h +++ b/src/video_core/texture_cache/util.h | |||
| @@ -77,7 +77,8 @@ void ConvertImage(std::span<const u8> input, const ImageInfo& info, std::span<u8 | |||
| 77 | [[nodiscard]] std::vector<SwizzleParameters> FullUploadSwizzles(const ImageInfo& info); | 77 | [[nodiscard]] std::vector<SwizzleParameters> FullUploadSwizzles(const ImageInfo& info); |
| 78 | 78 | ||
| 79 | void SwizzleImage(Tegra::MemoryManager& gpu_memory, GPUVAddr gpu_addr, const ImageInfo& info, | 79 | void SwizzleImage(Tegra::MemoryManager& gpu_memory, GPUVAddr gpu_addr, const ImageInfo& info, |
| 80 | std::span<const BufferImageCopy> copies, std::span<const u8> memory); | 80 | std::span<const BufferImageCopy> copies, std::span<const u8> memory, |
| 81 | std::vector<u8>& tmp_buffer); | ||
| 81 | 82 | ||
| 82 | [[nodiscard]] bool IsBlockLinearSizeCompatible(const ImageInfo& new_info, | 83 | [[nodiscard]] bool IsBlockLinearSizeCompatible(const ImageInfo& new_info, |
| 83 | const ImageInfo& overlap_info, u32 new_level, | 84 | const ImageInfo& overlap_info, u32 new_level, |