diff options
| -rw-r--r-- | src/core/file_sys/card_image.cpp | 4 | ||||
| -rw-r--r-- | src/core/memory.cpp | 37 | ||||
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 8 | ||||
| -rw-r--r-- | src/video_core/textures/astc.cpp | 4 |
4 files changed, 24 insertions, 29 deletions
diff --git a/src/core/file_sys/card_image.cpp b/src/core/file_sys/card_image.cpp index f23d9373b..5d02865f4 100644 --- a/src/core/file_sys/card_image.cpp +++ b/src/core/file_sys/card_image.cpp | |||
| @@ -232,8 +232,8 @@ const std::vector<std::shared_ptr<NCA>>& XCI::GetNCAs() const { | |||
| 232 | 232 | ||
| 233 | std::shared_ptr<NCA> XCI::GetNCAByType(NCAContentType type) const { | 233 | std::shared_ptr<NCA> XCI::GetNCAByType(NCAContentType type) const { |
| 234 | const auto program_id = secure_partition->GetProgramTitleID(); | 234 | const auto program_id = secure_partition->GetProgramTitleID(); |
| 235 | const auto iter = std::find_if( | 235 | const auto iter = |
| 236 | ncas.begin(), ncas.end(), [this, type, program_id](const std::shared_ptr<NCA>& nca) { | 236 | std::find_if(ncas.begin(), ncas.end(), [type, program_id](const std::shared_ptr<NCA>& nca) { |
| 237 | return nca->GetType() == type && nca->GetTitleId() == program_id; | 237 | return nca->GetType() == type && nca->GetTitleId() == program_id; |
| 238 | }); | 238 | }); |
| 239 | return iter == ncas.end() ? nullptr : *iter; | 239 | return iter == ncas.end() ? nullptr : *iter; |
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 9637cb5b1..3ca80c8ff 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp | |||
| @@ -233,18 +233,17 @@ struct Memory::Impl { | |||
| 233 | current_vaddr, src_addr, size); | 233 | current_vaddr, src_addr, size); |
| 234 | std::memset(dest_buffer, 0, copy_amount); | 234 | std::memset(dest_buffer, 0, copy_amount); |
| 235 | }, | 235 | }, |
| 236 | [&dest_buffer](const std::size_t copy_amount, const u8* const src_ptr) { | 236 | [&](const std::size_t copy_amount, const u8* const src_ptr) { |
| 237 | std::memcpy(dest_buffer, src_ptr, copy_amount); | 237 | std::memcpy(dest_buffer, src_ptr, copy_amount); |
| 238 | }, | 238 | }, |
| 239 | [&system = system, &dest_buffer](const VAddr current_vaddr, | 239 | [&](const VAddr current_vaddr, const std::size_t copy_amount, |
| 240 | const std::size_t copy_amount, | 240 | const u8* const host_ptr) { |
| 241 | const u8* const host_ptr) { | ||
| 242 | if constexpr (!UNSAFE) { | 241 | if constexpr (!UNSAFE) { |
| 243 | system.GPU().FlushRegion(current_vaddr, copy_amount); | 242 | system.GPU().FlushRegion(current_vaddr, copy_amount); |
| 244 | } | 243 | } |
| 245 | std::memcpy(dest_buffer, host_ptr, copy_amount); | 244 | std::memcpy(dest_buffer, host_ptr, copy_amount); |
| 246 | }, | 245 | }, |
| 247 | [&dest_buffer](const std::size_t copy_amount) { | 246 | [&](const std::size_t copy_amount) { |
| 248 | dest_buffer = static_cast<u8*>(dest_buffer) + copy_amount; | 247 | dest_buffer = static_cast<u8*>(dest_buffer) + copy_amount; |
| 249 | }); | 248 | }); |
| 250 | } | 249 | } |
| @@ -267,17 +266,16 @@ struct Memory::Impl { | |||
| 267 | "Unmapped WriteBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})", | 266 | "Unmapped WriteBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})", |
| 268 | current_vaddr, dest_addr, size); | 267 | current_vaddr, dest_addr, size); |
| 269 | }, | 268 | }, |
| 270 | [&src_buffer](const std::size_t copy_amount, u8* const dest_ptr) { | 269 | [&](const std::size_t copy_amount, u8* const dest_ptr) { |
| 271 | std::memcpy(dest_ptr, src_buffer, copy_amount); | 270 | std::memcpy(dest_ptr, src_buffer, copy_amount); |
| 272 | }, | 271 | }, |
| 273 | [&system = system, &src_buffer](const VAddr current_vaddr, | 272 | [&](const VAddr current_vaddr, const std::size_t copy_amount, u8* const host_ptr) { |
| 274 | const std::size_t copy_amount, u8* const host_ptr) { | ||
| 275 | if constexpr (!UNSAFE) { | 273 | if constexpr (!UNSAFE) { |
| 276 | system.GPU().InvalidateRegion(current_vaddr, copy_amount); | 274 | system.GPU().InvalidateRegion(current_vaddr, copy_amount); |
| 277 | } | 275 | } |
| 278 | std::memcpy(host_ptr, src_buffer, copy_amount); | 276 | std::memcpy(host_ptr, src_buffer, copy_amount); |
| 279 | }, | 277 | }, |
| 280 | [&src_buffer](const std::size_t copy_amount) { | 278 | [&](const std::size_t copy_amount) { |
| 281 | src_buffer = static_cast<const u8*>(src_buffer) + copy_amount; | 279 | src_buffer = static_cast<const u8*>(src_buffer) + copy_amount; |
| 282 | }); | 280 | }); |
| 283 | } | 281 | } |
| @@ -301,8 +299,7 @@ struct Memory::Impl { | |||
| 301 | [](const std::size_t copy_amount, u8* const dest_ptr) { | 299 | [](const std::size_t copy_amount, u8* const dest_ptr) { |
| 302 | std::memset(dest_ptr, 0, copy_amount); | 300 | std::memset(dest_ptr, 0, copy_amount); |
| 303 | }, | 301 | }, |
| 304 | [&system = system](const VAddr current_vaddr, const std::size_t copy_amount, | 302 | [&](const VAddr current_vaddr, const std::size_t copy_amount, u8* const host_ptr) { |
| 305 | u8* const host_ptr) { | ||
| 306 | system.GPU().InvalidateRegion(current_vaddr, copy_amount); | 303 | system.GPU().InvalidateRegion(current_vaddr, copy_amount); |
| 307 | std::memset(host_ptr, 0, copy_amount); | 304 | std::memset(host_ptr, 0, copy_amount); |
| 308 | }, | 305 | }, |
| @@ -313,22 +310,20 @@ struct Memory::Impl { | |||
| 313 | const std::size_t size) { | 310 | const std::size_t size) { |
| 314 | WalkBlock( | 311 | WalkBlock( |
| 315 | process, dest_addr, size, | 312 | process, dest_addr, size, |
| 316 | [this, &process, &dest_addr, &src_addr, size](const std::size_t copy_amount, | 313 | [&](const std::size_t copy_amount, const VAddr current_vaddr) { |
| 317 | const VAddr current_vaddr) { | ||
| 318 | LOG_ERROR(HW_Memory, | 314 | LOG_ERROR(HW_Memory, |
| 319 | "Unmapped CopyBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})", | 315 | "Unmapped CopyBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})", |
| 320 | current_vaddr, src_addr, size); | 316 | current_vaddr, src_addr, size); |
| 321 | ZeroBlock(process, dest_addr, copy_amount); | 317 | ZeroBlock(process, dest_addr, copy_amount); |
| 322 | }, | 318 | }, |
| 323 | [this, &process, &dest_addr](const std::size_t copy_amount, const u8* const src_ptr) { | 319 | [&](const std::size_t copy_amount, const u8* const src_ptr) { |
| 324 | WriteBlockImpl<false>(process, dest_addr, src_ptr, copy_amount); | 320 | WriteBlockImpl<false>(process, dest_addr, src_ptr, copy_amount); |
| 325 | }, | 321 | }, |
| 326 | [this, &system = system, &process, &dest_addr]( | 322 | [&](const VAddr current_vaddr, const std::size_t copy_amount, u8* const host_ptr) { |
| 327 | const VAddr current_vaddr, const std::size_t copy_amount, u8* const host_ptr) { | ||
| 328 | system.GPU().FlushRegion(current_vaddr, copy_amount); | 323 | system.GPU().FlushRegion(current_vaddr, copy_amount); |
| 329 | WriteBlockImpl<false>(process, dest_addr, host_ptr, copy_amount); | 324 | WriteBlockImpl<false>(process, dest_addr, host_ptr, copy_amount); |
| 330 | }, | 325 | }, |
| 331 | [&dest_addr, &src_addr](const std::size_t copy_amount) { | 326 | [&](const std::size_t copy_amount) { |
| 332 | dest_addr += static_cast<VAddr>(copy_amount); | 327 | dest_addr += static_cast<VAddr>(copy_amount); |
| 333 | src_addr += static_cast<VAddr>(copy_amount); | 328 | src_addr += static_cast<VAddr>(copy_amount); |
| 334 | }); | 329 | }); |
| @@ -575,7 +570,7 @@ struct Memory::Impl { | |||
| 575 | [vaddr]() { | 570 | [vaddr]() { |
| 576 | LOG_ERROR(HW_Memory, "Unmapped Read{} @ 0x{:016X}", sizeof(T) * 8, vaddr); | 571 | LOG_ERROR(HW_Memory, "Unmapped Read{} @ 0x{:016X}", sizeof(T) * 8, vaddr); |
| 577 | }, | 572 | }, |
| 578 | [&system = system, vaddr]() { system.GPU().FlushRegion(vaddr, sizeof(T)); }); | 573 | [&]() { system.GPU().FlushRegion(vaddr, sizeof(T)); }); |
| 579 | if (ptr) { | 574 | if (ptr) { |
| 580 | std::memcpy(&result, ptr, sizeof(T)); | 575 | std::memcpy(&result, ptr, sizeof(T)); |
| 581 | } | 576 | } |
| @@ -599,7 +594,7 @@ struct Memory::Impl { | |||
| 599 | LOG_ERROR(HW_Memory, "Unmapped Write{} @ 0x{:016X} = 0x{:016X}", sizeof(T) * 8, | 594 | LOG_ERROR(HW_Memory, "Unmapped Write{} @ 0x{:016X} = 0x{:016X}", sizeof(T) * 8, |
| 600 | vaddr, static_cast<u64>(data)); | 595 | vaddr, static_cast<u64>(data)); |
| 601 | }, | 596 | }, |
| 602 | [&system = system, vaddr]() { system.GPU().InvalidateRegion(vaddr, sizeof(T)); }); | 597 | [&]() { system.GPU().InvalidateRegion(vaddr, sizeof(T)); }); |
| 603 | if (ptr) { | 598 | if (ptr) { |
| 604 | std::memcpy(ptr, &data, sizeof(T)); | 599 | std::memcpy(ptr, &data, sizeof(T)); |
| 605 | } | 600 | } |
| @@ -613,7 +608,7 @@ struct Memory::Impl { | |||
| 613 | LOG_ERROR(HW_Memory, "Unmapped WriteExclusive{} @ 0x{:016X} = 0x{:016X}", | 608 | LOG_ERROR(HW_Memory, "Unmapped WriteExclusive{} @ 0x{:016X} = 0x{:016X}", |
| 614 | sizeof(T) * 8, vaddr, static_cast<u64>(data)); | 609 | sizeof(T) * 8, vaddr, static_cast<u64>(data)); |
| 615 | }, | 610 | }, |
| 616 | [&system = system, vaddr]() { system.GPU().InvalidateRegion(vaddr, sizeof(T)); }); | 611 | [&]() { system.GPU().InvalidateRegion(vaddr, sizeof(T)); }); |
| 617 | if (ptr) { | 612 | if (ptr) { |
| 618 | const auto volatile_pointer = reinterpret_cast<volatile T*>(ptr); | 613 | const auto volatile_pointer = reinterpret_cast<volatile T*>(ptr); |
| 619 | return Common::AtomicCompareAndSwap(volatile_pointer, data, expected); | 614 | return Common::AtomicCompareAndSwap(volatile_pointer, data, expected); |
| @@ -628,7 +623,7 @@ struct Memory::Impl { | |||
| 628 | LOG_ERROR(HW_Memory, "Unmapped WriteExclusive128 @ 0x{:016X} = 0x{:016X}{:016X}", | 623 | LOG_ERROR(HW_Memory, "Unmapped WriteExclusive128 @ 0x{:016X} = 0x{:016X}{:016X}", |
| 629 | vaddr, static_cast<u64>(data[1]), static_cast<u64>(data[0])); | 624 | vaddr, static_cast<u64>(data[1]), static_cast<u64>(data[0])); |
| 630 | }, | 625 | }, |
| 631 | [&system = system, vaddr]() { system.GPU().InvalidateRegion(vaddr, sizeof(u128)); }); | 626 | [&]() { system.GPU().InvalidateRegion(vaddr, sizeof(u128)); }); |
| 632 | if (ptr) { | 627 | if (ptr) { |
| 633 | const auto volatile_pointer = reinterpret_cast<volatile u64*>(ptr); | 628 | const auto volatile_pointer = reinterpret_cast<volatile u64*>(ptr); |
| 634 | return Common::AtomicCompareAndSwap(volatile_pointer, data, expected); | 629 | return Common::AtomicCompareAndSwap(volatile_pointer, data, expected); |
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 0e0fd410f..8ef75fe73 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -442,7 +442,7 @@ void TextureCache<P>::WriteMemory(VAddr cpu_addr, size_t size) { | |||
| 442 | template <class P> | 442 | template <class P> |
| 443 | void TextureCache<P>::DownloadMemory(VAddr cpu_addr, size_t size) { | 443 | void TextureCache<P>::DownloadMemory(VAddr cpu_addr, size_t size) { |
| 444 | std::vector<ImageId> images; | 444 | std::vector<ImageId> images; |
| 445 | ForEachImageInRegion(cpu_addr, size, [this, &images](ImageId image_id, ImageBase& image) { | 445 | ForEachImageInRegion(cpu_addr, size, [&images](ImageId image_id, ImageBase& image) { |
| 446 | if (!image.IsSafeDownload()) { | 446 | if (!image.IsSafeDownload()) { |
| 447 | return; | 447 | return; |
| 448 | } | 448 | } |
| @@ -1502,9 +1502,9 @@ void TextureCache<P>::UnregisterImage(ImageId image_id) { | |||
| 1502 | image.flags &= ~ImageFlagBits::BadOverlap; | 1502 | image.flags &= ~ImageFlagBits::BadOverlap; |
| 1503 | lru_cache.Free(image.lru_index); | 1503 | lru_cache.Free(image.lru_index); |
| 1504 | const auto& clear_page_table = | 1504 | const auto& clear_page_table = |
| 1505 | [this, image_id](u64 page, | 1505 | [image_id](u64 page, |
| 1506 | std::unordered_map<u64, std::vector<ImageId>, Common::IdentityHash<u64>>& | 1506 | std::unordered_map<u64, std::vector<ImageId>, Common::IdentityHash<u64>>& |
| 1507 | selected_page_table) { | 1507 | selected_page_table) { |
| 1508 | const auto page_it = selected_page_table.find(page); | 1508 | const auto page_it = selected_page_table.find(page); |
| 1509 | if (page_it == selected_page_table.end()) { | 1509 | if (page_it == selected_page_table.end()) { |
| 1510 | ASSERT_MSG(false, "Unregistering unregistered page=0x{:x}", page << YUZU_PAGEBITS); | 1510 | ASSERT_MSG(false, "Unregistering unregistered page=0x{:x}", page << YUZU_PAGEBITS); |
diff --git a/src/video_core/textures/astc.cpp b/src/video_core/textures/astc.cpp index 15b9d4182..69a32819a 100644 --- a/src/video_core/textures/astc.cpp +++ b/src/video_core/textures/astc.cpp | |||
| @@ -1661,8 +1661,8 @@ void Decompress(std::span<const uint8_t> data, uint32_t width, uint32_t height, | |||
| 1661 | for (u32 z = 0; z < depth; ++z) { | 1661 | for (u32 z = 0; z < depth; ++z) { |
| 1662 | const u32 depth_offset = z * height * width * 4; | 1662 | const u32 depth_offset = z * height * width * 4; |
| 1663 | for (u32 y_index = 0; y_index < rows; ++y_index) { | 1663 | for (u32 y_index = 0; y_index < rows; ++y_index) { |
| 1664 | auto decompress_stride = [data, width, height, depth, block_width, block_height, output, | 1664 | auto decompress_stride = [data, width, height, block_width, block_height, output, rows, |
| 1665 | rows, cols, z, depth_offset, y_index] { | 1665 | cols, z, depth_offset, y_index] { |
| 1666 | const u32 y = y_index * block_height; | 1666 | const u32 y = y_index * block_height; |
| 1667 | for (u32 x_index = 0; x_index < cols; ++x_index) { | 1667 | for (u32 x_index = 0; x_index < cols; ++x_index) { |
| 1668 | const u32 block_index = (z * rows * cols) + (y_index * cols) + x_index; | 1668 | const u32 block_index = (z * rows * cols) + (y_index * cols) + x_index; |