diff options
| -rw-r--r-- | src/tests/video_core/buffer_base.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/buffer_cache/buffer_base.h | 14 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_dma.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/invalidation_accumulator.h | 13 | ||||
| -rw-r--r-- | src/video_core/memory_manager.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/memory_manager.h | 2 | ||||
| -rw-r--r-- | src/video_core/rasterizer_interface.h | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 6 |
8 files changed, 22 insertions, 23 deletions
diff --git a/src/tests/video_core/buffer_base.cpp b/src/tests/video_core/buffer_base.cpp index f7236afab..5cd0628f2 100644 --- a/src/tests/video_core/buffer_base.cpp +++ b/src/tests/video_core/buffer_base.cpp | |||
| @@ -538,7 +538,7 @@ TEST_CASE("BufferBase: Cached write downloads") { | |||
| 538 | int num = 0; | 538 | int num = 0; |
| 539 | buffer.ForEachDownloadRangeAndClear(c, WORD, [&](u64 offset, u64 size) { ++num; }); | 539 | buffer.ForEachDownloadRangeAndClear(c, WORD, [&](u64 offset, u64 size) { ++num; }); |
| 540 | buffer.ForEachUploadRange(c, WORD, [&](u64 offset, u64 size) { ++num; }); | 540 | buffer.ForEachUploadRange(c, WORD, [&](u64 offset, u64 size) { ++num; }); |
| 541 | REQUIRE(num == 0); | 541 | REQUIRE(num == 1); |
| 542 | REQUIRE(!buffer.IsRegionCpuModified(c + PAGE, PAGE)); | 542 | REQUIRE(!buffer.IsRegionCpuModified(c + PAGE, PAGE)); |
| 543 | REQUIRE(!buffer.IsRegionGpuModified(c + PAGE, PAGE)); | 543 | REQUIRE(!buffer.IsRegionGpuModified(c + PAGE, PAGE)); |
| 544 | buffer.FlushCachedWrites(); | 544 | buffer.FlushCachedWrites(); |
diff --git a/src/video_core/buffer_cache/buffer_base.h b/src/video_core/buffer_cache/buffer_base.h index 92d77eef2..c47b7d866 100644 --- a/src/video_core/buffer_cache/buffer_base.h +++ b/src/video_core/buffer_cache/buffer_base.h | |||
| @@ -430,7 +430,7 @@ private: | |||
| 430 | if (query_begin >= SizeBytes() || size < 0) { | 430 | if (query_begin >= SizeBytes() || size < 0) { |
| 431 | return; | 431 | return; |
| 432 | } | 432 | } |
| 433 | u64* const untracked_words = Array<Type::Untracked>(); | 433 | [[maybe_unused]] u64* const untracked_words = Array<Type::Untracked>(); |
| 434 | u64* const state_words = Array<type>(); | 434 | u64* const state_words = Array<type>(); |
| 435 | const u64 query_end = query_begin + std::min(static_cast<u64>(size), SizeBytes()); | 435 | const u64 query_end = query_begin + std::min(static_cast<u64>(size), SizeBytes()); |
| 436 | u64* const words_begin = state_words + query_begin / BYTES_PER_WORD; | 436 | u64* const words_begin = state_words + query_begin / BYTES_PER_WORD; |
| @@ -483,7 +483,7 @@ private: | |||
| 483 | NotifyRasterizer<true>(word_index, current_bits, ~u64{0}); | 483 | NotifyRasterizer<true>(word_index, current_bits, ~u64{0}); |
| 484 | } | 484 | } |
| 485 | // Exclude CPU modified pages when visiting GPU pages | 485 | // Exclude CPU modified pages when visiting GPU pages |
| 486 | const u64 word = current_word & ~(type == Type::GPU ? untracked_words[word_index] : 0); | 486 | const u64 word = current_word; |
| 487 | u64 page = page_begin; | 487 | u64 page = page_begin; |
| 488 | page_begin = 0; | 488 | page_begin = 0; |
| 489 | 489 | ||
| @@ -531,7 +531,7 @@ private: | |||
| 531 | [[nodiscard]] bool IsRegionModified(u64 offset, u64 size) const noexcept { | 531 | [[nodiscard]] bool IsRegionModified(u64 offset, u64 size) const noexcept { |
| 532 | static_assert(type != Type::Untracked); | 532 | static_assert(type != Type::Untracked); |
| 533 | 533 | ||
| 534 | const u64* const untracked_words = Array<Type::Untracked>(); | 534 | [[maybe_unused]] const u64* const untracked_words = Array<Type::Untracked>(); |
| 535 | const u64* const state_words = Array<type>(); | 535 | const u64* const state_words = Array<type>(); |
| 536 | const u64 num_query_words = size / BYTES_PER_WORD + 1; | 536 | const u64 num_query_words = size / BYTES_PER_WORD + 1; |
| 537 | const u64 word_begin = offset / BYTES_PER_WORD; | 537 | const u64 word_begin = offset / BYTES_PER_WORD; |
| @@ -539,8 +539,7 @@ private: | |||
| 539 | const u64 page_limit = Common::DivCeil(offset + size, BYTES_PER_PAGE); | 539 | const u64 page_limit = Common::DivCeil(offset + size, BYTES_PER_PAGE); |
| 540 | u64 page_index = (offset / BYTES_PER_PAGE) % PAGES_PER_WORD; | 540 | u64 page_index = (offset / BYTES_PER_PAGE) % PAGES_PER_WORD; |
| 541 | for (u64 word_index = word_begin; word_index < word_end; ++word_index, page_index = 0) { | 541 | for (u64 word_index = word_begin; word_index < word_end; ++word_index, page_index = 0) { |
| 542 | const u64 off_word = type == Type::GPU ? untracked_words[word_index] : 0; | 542 | const u64 word = state_words[word_index]; |
| 543 | const u64 word = state_words[word_index] & ~off_word; | ||
| 544 | if (word == 0) { | 543 | if (word == 0) { |
| 545 | continue; | 544 | continue; |
| 546 | } | 545 | } |
| @@ -564,7 +563,7 @@ private: | |||
| 564 | [[nodiscard]] std::pair<u64, u64> ModifiedRegion(u64 offset, u64 size) const noexcept { | 563 | [[nodiscard]] std::pair<u64, u64> ModifiedRegion(u64 offset, u64 size) const noexcept { |
| 565 | static_assert(type != Type::Untracked); | 564 | static_assert(type != Type::Untracked); |
| 566 | 565 | ||
| 567 | const u64* const untracked_words = Array<Type::Untracked>(); | 566 | [[maybe_unused]] const u64* const untracked_words = Array<Type::Untracked>(); |
| 568 | const u64* const state_words = Array<type>(); | 567 | const u64* const state_words = Array<type>(); |
| 569 | const u64 num_query_words = size / BYTES_PER_WORD + 1; | 568 | const u64 num_query_words = size / BYTES_PER_WORD + 1; |
| 570 | const u64 word_begin = offset / BYTES_PER_WORD; | 569 | const u64 word_begin = offset / BYTES_PER_WORD; |
| @@ -574,8 +573,7 @@ private: | |||
| 574 | u64 begin = std::numeric_limits<u64>::max(); | 573 | u64 begin = std::numeric_limits<u64>::max(); |
| 575 | u64 end = 0; | 574 | u64 end = 0; |
| 576 | for (u64 word_index = word_begin; word_index < word_end; ++word_index) { | 575 | for (u64 word_index = word_begin; word_index < word_end; ++word_index) { |
| 577 | const u64 off_word = type == Type::GPU ? untracked_words[word_index] : 0; | 576 | const u64 word = state_words[word_index]; |
| 578 | const u64 word = state_words[word_index] & ~off_word; | ||
| 579 | if (word == 0) { | 577 | if (word == 0) { |
| 580 | continue; | 578 | continue; |
| 581 | } | 579 | } |
diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp index 7bf08e3e0..7762c7d96 100644 --- a/src/video_core/engines/maxwell_dma.cpp +++ b/src/video_core/engines/maxwell_dma.cpp | |||
| @@ -123,7 +123,7 @@ void MaxwellDMA::Launch() { | |||
| 123 | convert_linear_2_blocklinear_addr(regs.offset_in + offset), | 123 | convert_linear_2_blocklinear_addr(regs.offset_in + offset), |
| 124 | tmp_buffer.data(), tmp_buffer.size()); | 124 | tmp_buffer.data(), tmp_buffer.size()); |
| 125 | memory_manager.WriteBlockCached(regs.offset_out + offset, tmp_buffer.data(), | 125 | memory_manager.WriteBlockCached(regs.offset_out + offset, tmp_buffer.data(), |
| 126 | tmp_buffer.size()); | 126 | tmp_buffer.size()); |
| 127 | } | 127 | } |
| 128 | } else if (is_src_pitch && !is_dst_pitch) { | 128 | } else if (is_src_pitch && !is_dst_pitch) { |
| 129 | UNIMPLEMENTED_IF(regs.line_length_in % 16 != 0); | 129 | UNIMPLEMENTED_IF(regs.line_length_in % 16 != 0); |
| @@ -143,7 +143,7 @@ void MaxwellDMA::Launch() { | |||
| 143 | memory_manager.ReadBlockUnsafe(regs.offset_in, tmp_buffer.data(), | 143 | memory_manager.ReadBlockUnsafe(regs.offset_in, tmp_buffer.data(), |
| 144 | regs.line_length_in); | 144 | regs.line_length_in); |
| 145 | memory_manager.WriteBlockCached(regs.offset_out, tmp_buffer.data(), | 145 | memory_manager.WriteBlockCached(regs.offset_out, tmp_buffer.data(), |
| 146 | regs.line_length_in); | 146 | regs.line_length_in); |
| 147 | } | 147 | } |
| 148 | } | 148 | } |
| 149 | } | 149 | } |
diff --git a/src/video_core/invalidation_accumulator.h b/src/video_core/invalidation_accumulator.h index 42420e31c..2c2aaf7bb 100644 --- a/src/video_core/invalidation_accumulator.h +++ b/src/video_core/invalidation_accumulator.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <utility> | ||
| 6 | #include <vector> | 7 | #include <vector> |
| 7 | 8 | ||
| 8 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| @@ -26,8 +27,8 @@ public: | |||
| 26 | if (address >= start_address && address + size <= last_collection) [[likely]] { | 27 | if (address >= start_address && address + size <= last_collection) [[likely]] { |
| 27 | return; | 28 | return; |
| 28 | } | 29 | } |
| 29 | size = (address + size + atomicy_side_mask) & atomicy_mask - address; | 30 | size = ((address + size + atomicity_size_mask) & atomicity_mask) - address; |
| 30 | address = address & atomicy_mask; | 31 | address = address & atomicity_mask; |
| 31 | if (!has_collected) [[unlikely]] { | 32 | if (!has_collected) [[unlikely]] { |
| 32 | reset_values(); | 33 | reset_values(); |
| 33 | has_collected = true; | 34 | has_collected = true; |
| @@ -64,10 +65,10 @@ public: | |||
| 64 | } | 65 | } |
| 65 | 66 | ||
| 66 | private: | 67 | private: |
| 67 | static constexpr size_t atomicy_bits = 5; | 68 | static constexpr size_t atomicity_bits = 5; |
| 68 | static constexpr size_t atomicy_size = 1ULL << atomicy_bits; | 69 | static constexpr size_t atomicity_size = 1ULL << atomicity_bits; |
| 69 | static constexpr size_t atomicy_side_mask = atomicy_size - 1; | 70 | static constexpr size_t atomicity_size_mask = atomicity_size - 1; |
| 70 | static constexpr size_t atomicy_mask = ~atomicy_side_mask; | 71 | static constexpr size_t atomicity_mask = ~atomicity_size_mask; |
| 71 | GPUVAddr start_address{}; | 72 | GPUVAddr start_address{}; |
| 72 | GPUVAddr last_collection{}; | 73 | GPUVAddr last_collection{}; |
| 73 | size_t accumulated_size{}; | 74 | size_t accumulated_size{}; |
diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp index 0a6390054..3bcae3503 100644 --- a/src/video_core/memory_manager.cpp +++ b/src/video_core/memory_manager.cpp | |||
| @@ -46,7 +46,7 @@ MemoryManager::MemoryManager(Core::System& system_, u64 address_space_bits_, u64 | |||
| 46 | big_page_table_cpu.resize(big_page_table_size); | 46 | big_page_table_cpu.resize(big_page_table_size); |
| 47 | big_page_continous.resize(big_page_table_size / continous_bits, 0); | 47 | big_page_continous.resize(big_page_table_size / continous_bits, 0); |
| 48 | entries.resize(page_table_size / 32, 0); | 48 | entries.resize(page_table_size / 32, 0); |
| 49 | if (!Settings::IsGPULevelExtreme()) { | 49 | if (!Settings::IsGPULevelExtreme() && Settings::IsFastmemEnabled()) { |
| 50 | fastmem_arena = system.DeviceMemory().buffer.VirtualBasePointer(); | 50 | fastmem_arena = system.DeviceMemory().buffer.VirtualBasePointer(); |
| 51 | } else { | 51 | } else { |
| 52 | fastmem_arena = nullptr; | 52 | fastmem_arena = nullptr; |
diff --git a/src/video_core/memory_manager.h b/src/video_core/memory_manager.h index ff9e3c0b3..2936364f0 100644 --- a/src/video_core/memory_manager.h +++ b/src/video_core/memory_manager.h | |||
| @@ -107,7 +107,7 @@ public: | |||
| 107 | * will be returned; | 107 | * will be returned; |
| 108 | */ | 108 | */ |
| 109 | std::vector<std::pair<GPUVAddr, std::size_t>> GetSubmappedRange(GPUVAddr gpu_addr, | 109 | std::vector<std::pair<GPUVAddr, std::size_t>> GetSubmappedRange(GPUVAddr gpu_addr, |
| 110 | std::size_t size) const; | 110 | std::size_t size) const; |
| 111 | 111 | ||
| 112 | GPUVAddr Map(GPUVAddr gpu_addr, VAddr cpu_addr, std::size_t size, | 112 | GPUVAddr Map(GPUVAddr gpu_addr, VAddr cpu_addr, std::size_t size, |
| 113 | PTEKind kind = PTEKind::INVALID, bool is_big_pages = true); | 113 | PTEKind kind = PTEKind::INVALID, bool is_big_pages = true); |
diff --git a/src/video_core/rasterizer_interface.h b/src/video_core/rasterizer_interface.h index 6b66ad7b6..1735b6164 100644 --- a/src/video_core/rasterizer_interface.h +++ b/src/video_core/rasterizer_interface.h | |||
| @@ -97,7 +97,7 @@ public: | |||
| 97 | VideoCommon::CacheType which = VideoCommon::CacheType::All) = 0; | 97 | VideoCommon::CacheType which = VideoCommon::CacheType::All) = 0; |
| 98 | 98 | ||
| 99 | virtual void InnerInvalidation(std::span<const std::pair<VAddr, std::size_t>> sequences) { | 99 | virtual void InnerInvalidation(std::span<const std::pair<VAddr, std::size_t>> sequences) { |
| 100 | for (const auto [cpu_addr, size] : sequences) { | 100 | for (const auto& [cpu_addr, size] : sequences) { |
| 101 | InvalidateRegion(cpu_addr, size); | 101 | InvalidateRegion(cpu_addr, size); |
| 102 | } | 102 | } |
| 103 | } | 103 | } |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 6c4d74564..ed4a72166 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -486,18 +486,18 @@ void RasterizerVulkan::InvalidateRegion(VAddr addr, u64 size, VideoCommon::Cache | |||
| 486 | void RasterizerVulkan::InnerInvalidation(std::span<const std::pair<VAddr, std::size_t>> sequences) { | 486 | void RasterizerVulkan::InnerInvalidation(std::span<const std::pair<VAddr, std::size_t>> sequences) { |
| 487 | { | 487 | { |
| 488 | std::scoped_lock lock{texture_cache.mutex}; | 488 | std::scoped_lock lock{texture_cache.mutex}; |
| 489 | for (const auto [addr, size] : sequences) { | 489 | for (const auto& [addr, size] : sequences) { |
| 490 | texture_cache.WriteMemory(addr, size); | 490 | texture_cache.WriteMemory(addr, size); |
| 491 | } | 491 | } |
| 492 | } | 492 | } |
| 493 | { | 493 | { |
| 494 | std::scoped_lock lock{buffer_cache.mutex}; | 494 | std::scoped_lock lock{buffer_cache.mutex}; |
| 495 | for (const auto [addr, size] : sequences) { | 495 | for (const auto& [addr, size] : sequences) { |
| 496 | buffer_cache.WriteMemory(addr, size); | 496 | buffer_cache.WriteMemory(addr, size); |
| 497 | } | 497 | } |
| 498 | } | 498 | } |
| 499 | { | 499 | { |
| 500 | for (const auto [addr, size] : sequences) { | 500 | for (const auto& [addr, size] : sequences) { |
| 501 | query_cache.InvalidateRegion(addr, size); | 501 | query_cache.InvalidateRegion(addr, size); |
| 502 | pipeline_cache.InvalidateRegion(addr, size); | 502 | pipeline_cache.InvalidateRegion(addr, size); |
| 503 | } | 503 | } |