diff options
| -rw-r--r-- | src/video_core/buffer_cache/buffer_base.h | 26 | ||||
| -rw-r--r-- | src/video_core/buffer_cache/buffer_cache.h | 4 | ||||
| -rw-r--r-- | src/video_core/buffer_cache/buffer_cache_base.h | 32 | ||||
| -rw-r--r-- | src/video_core/buffer_cache/memory_tracker_base.h | 82 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_buffer_cache.h | 2 |
5 files changed, 78 insertions, 68 deletions
diff --git a/src/video_core/buffer_cache/buffer_base.h b/src/video_core/buffer_cache/buffer_base.h index 66d8bb43c..095f79387 100644 --- a/src/video_core/buffer_cache/buffer_base.h +++ b/src/video_core/buffer_cache/buffer_base.h | |||
| @@ -55,53 +55,53 @@ public: | |||
| 55 | [[nodiscard]] std::pair<u64, u64> ModifiedCpuRegion(VAddr query_cpu_addr, | 55 | [[nodiscard]] std::pair<u64, u64> ModifiedCpuRegion(VAddr query_cpu_addr, |
| 56 | u64 query_size) const noexcept { | 56 | u64 query_size) const noexcept { |
| 57 | const u64 offset = query_cpu_addr - cpu_addr; | 57 | const u64 offset = query_cpu_addr - cpu_addr; |
| 58 | return word_manager.ModifiedRegion<Type::CPU>(offset, query_size); | 58 | return word_manager.template ModifiedRegion<Type::CPU>(offset, query_size); |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | /// Returns the inclusive GPU modified range in a begin end pair | 61 | /// Returns the inclusive GPU modified range in a begin end pair |
| 62 | [[nodiscard]] std::pair<u64, u64> ModifiedGpuRegion(VAddr query_cpu_addr, | 62 | [[nodiscard]] std::pair<u64, u64> ModifiedGpuRegion(VAddr query_cpu_addr, |
| 63 | u64 query_size) const noexcept { | 63 | u64 query_size) const noexcept { |
| 64 | const u64 offset = query_cpu_addr - cpu_addr; | 64 | const u64 offset = query_cpu_addr - cpu_addr; |
| 65 | return word_manager.ModifiedRegion<Type::GPU>(offset, query_size); | 65 | return word_manager.template ModifiedRegion<Type::GPU>(offset, query_size); |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | /// Returns true if a region has been modified from the CPU | 68 | /// Returns true if a region has been modified from the CPU |
| 69 | [[nodiscard]] bool IsRegionCpuModified(VAddr query_cpu_addr, u64 query_size) const noexcept { | 69 | [[nodiscard]] bool IsRegionCpuModified(VAddr query_cpu_addr, u64 query_size) const noexcept { |
| 70 | const u64 offset = query_cpu_addr - cpu_addr; | 70 | const u64 offset = query_cpu_addr - cpu_addr; |
| 71 | return word_manager.IsRegionModified<Type::CPU>(offset, query_size); | 71 | return word_manager.template IsRegionModified<Type::CPU>(offset, query_size); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | /// Returns true if a region has been modified from the GPU | 74 | /// Returns true if a region has been modified from the GPU |
| 75 | [[nodiscard]] bool IsRegionGpuModified(VAddr query_cpu_addr, u64 query_size) const noexcept { | 75 | [[nodiscard]] bool IsRegionGpuModified(VAddr query_cpu_addr, u64 query_size) const noexcept { |
| 76 | const u64 offset = query_cpu_addr - cpu_addr; | 76 | const u64 offset = query_cpu_addr - cpu_addr; |
| 77 | return word_manager.IsRegionModified<Type::GPU>(offset, query_size); | 77 | return word_manager.template IsRegionModified<Type::GPU>(offset, query_size); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | /// Mark region as CPU modified, notifying the rasterizer about this change | 80 | /// Mark region as CPU modified, notifying the rasterizer about this change |
| 81 | void MarkRegionAsCpuModified(VAddr dirty_cpu_addr, u64 size) { | 81 | void MarkRegionAsCpuModified(VAddr dirty_cpu_addr, u64 size) { |
| 82 | word_manager.ChangeRegionState<Type::CPU, true>(dirty_cpu_addr, size); | 82 | word_manager.template ChangeRegionState<Type::CPU, true>(dirty_cpu_addr, size); |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | /// Unmark region as CPU modified, notifying the rasterizer about this change | 85 | /// Unmark region as CPU modified, notifying the rasterizer about this change |
| 86 | void UnmarkRegionAsCpuModified(VAddr dirty_cpu_addr, u64 size) { | 86 | void UnmarkRegionAsCpuModified(VAddr dirty_cpu_addr, u64 size) { |
| 87 | word_manager.ChangeRegionState<Type::CPU, false>(dirty_cpu_addr, size); | 87 | word_manager.template ChangeRegionState<Type::CPU, false>(dirty_cpu_addr, size); |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | /// Mark region as modified from the host GPU | 90 | /// Mark region as modified from the host GPU |
| 91 | void MarkRegionAsGpuModified(VAddr dirty_cpu_addr, u64 size) noexcept { | 91 | void MarkRegionAsGpuModified(VAddr dirty_cpu_addr, u64 size) noexcept { |
| 92 | word_manager.ChangeRegionState<Type::GPU, true>(dirty_cpu_addr, size); | 92 | word_manager.template ChangeRegionState<Type::GPU, true>(dirty_cpu_addr, size); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | /// Unmark region as modified from the host GPU | 95 | /// Unmark region as modified from the host GPU |
| 96 | void UnmarkRegionAsGpuModified(VAddr dirty_cpu_addr, u64 size) noexcept { | 96 | void UnmarkRegionAsGpuModified(VAddr dirty_cpu_addr, u64 size) noexcept { |
| 97 | word_manager.ChangeRegionState<Type::GPU, false>(dirty_cpu_addr, size); | 97 | word_manager.template ChangeRegionState<Type::GPU, false>(dirty_cpu_addr, size); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | /// Mark region as modified from the CPU | 100 | /// Mark region as modified from the CPU |
| 101 | /// but don't mark it as modified until FlusHCachedWrites is called. | 101 | /// but don't mark it as modified until FlusHCachedWrites is called. |
| 102 | void CachedCpuWrite(VAddr dirty_cpu_addr, u64 size) { | 102 | void CachedCpuWrite(VAddr dirty_cpu_addr, u64 size) { |
| 103 | flags |= BufferFlagBits::CachedWrites; | 103 | flags |= BufferFlagBits::CachedWrites; |
| 104 | word_manager.ChangeRegionState<Type::CachedCPU, true>(dirty_cpu_addr, size); | 104 | word_manager.template ChangeRegionState<Type::CachedCPU, true>(dirty_cpu_addr, size); |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | /// Flushes cached CPU writes, and notify the rasterizer about the deltas | 107 | /// Flushes cached CPU writes, and notify the rasterizer about the deltas |
| @@ -113,24 +113,24 @@ public: | |||
| 113 | /// Call 'func' for each CPU modified range and unmark those pages as CPU modified | 113 | /// Call 'func' for each CPU modified range and unmark those pages as CPU modified |
| 114 | template <typename Func> | 114 | template <typename Func> |
| 115 | void ForEachUploadRange(VAddr query_cpu_range, u64 size, Func&& func) { | 115 | void ForEachUploadRange(VAddr query_cpu_range, u64 size, Func&& func) { |
| 116 | word_manager.ForEachModifiedRange<Type::CPU>(query_cpu_range, size, true, func); | 116 | word_manager.template ForEachModifiedRange<Type::CPU>(query_cpu_range, size, true, func); |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | /// Call 'func' for each GPU modified range and unmark those pages as GPU modified | 119 | /// Call 'func' for each GPU modified range and unmark those pages as GPU modified |
| 120 | template <typename Func> | 120 | template <typename Func> |
| 121 | void ForEachDownloadRange(VAddr query_cpu_range, u64 size, bool clear, Func&& func) { | 121 | void ForEachDownloadRange(VAddr query_cpu_range, u64 size, bool clear, Func&& func) { |
| 122 | word_manager.ForEachModifiedRange<Type::GPU>(query_cpu_range, size, clear, func); | 122 | word_manager.template ForEachModifiedRange<Type::GPU>(query_cpu_range, size, clear, func); |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | template <typename Func> | 125 | template <typename Func> |
| 126 | void ForEachDownloadRangeAndClear(VAddr query_cpu_range, u64 size, Func&& func) { | 126 | void ForEachDownloadRangeAndClear(VAddr query_cpu_range, u64 size, Func&& func) { |
| 127 | word_manager.ForEachModifiedRange<Type::GPU>(query_cpu_range, size, true, func); | 127 | word_manager.template ForEachModifiedRange<Type::GPU>(query_cpu_range, size, true, func); |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | /// Call 'func' for each GPU modified range and unmark those pages as GPU modified | 130 | /// Call 'func' for each GPU modified range and unmark those pages as GPU modified |
| 131 | template <typename Func> | 131 | template <typename Func> |
| 132 | void ForEachDownloadRange(Func&& func) { | 132 | void ForEachDownloadRange(Func&& func) { |
| 133 | word_manager.ForEachModifiedRange<Type::GPU>(cpu_addr, SizeBytes(), true, func); | 133 | word_manager.template ForEachModifiedRange<Type::GPU>(cpu_addr, SizeBytes(), true, func); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | /// Mark buffer as picked | 136 | /// Mark buffer as picked |
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index faa48a678..8fed08dab 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h | |||
| @@ -1395,10 +1395,10 @@ bool BufferCache<P>::SynchronizeBufferNoModified(Buffer& buffer, VAddr cpu_addr, | |||
| 1395 | auto make_copies = [&] { | 1395 | auto make_copies = [&] { |
| 1396 | for (auto& interval : found_sets) { | 1396 | for (auto& interval : found_sets) { |
| 1397 | const std::size_t sub_size = interval.upper() - interval.lower(); | 1397 | const std::size_t sub_size = interval.upper() - interval.lower(); |
| 1398 | const VAddr cpu_addr = interval.lower(); | 1398 | const VAddr cpu_addr_ = interval.lower(); |
| 1399 | copies.push_back(BufferCopy{ | 1399 | copies.push_back(BufferCopy{ |
| 1400 | .src_offset = total_size_bytes, | 1400 | .src_offset = total_size_bytes, |
| 1401 | .dst_offset = cpu_addr - buffer.CpuAddr(), | 1401 | .dst_offset = cpu_addr_ - buffer.CpuAddr(), |
| 1402 | .size = sub_size, | 1402 | .size = sub_size, |
| 1403 | }); | 1403 | }); |
| 1404 | total_size_bytes += sub_size; | 1404 | total_size_bytes += sub_size; |
diff --git a/src/video_core/buffer_cache/buffer_cache_base.h b/src/video_core/buffer_cache/buffer_cache_base.h index d4914a8f5..acff22d4f 100644 --- a/src/video_core/buffer_cache/buffer_cache_base.h +++ b/src/video_core/buffer_cache/buffer_cache_base.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | #include <algorithm> | 6 | #include <algorithm> |
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <functional> | ||
| 8 | #include <memory> | 9 | #include <memory> |
| 9 | #include <mutex> | 10 | #include <mutex> |
| 10 | #include <numeric> | 11 | #include <numeric> |
| @@ -16,10 +17,13 @@ | |||
| 16 | #define BOOST_NO_MT | 17 | #define BOOST_NO_MT |
| 17 | #include <boost/pool/detail/mutex.hpp> | 18 | #include <boost/pool/detail/mutex.hpp> |
| 18 | #undef BOOST_NO_MT | 19 | #undef BOOST_NO_MT |
| 20 | #include <boost/icl/interval.hpp> | ||
| 21 | #include <boost/icl/interval_base_set.hpp> | ||
| 19 | #include <boost/icl/interval_set.hpp> | 22 | #include <boost/icl/interval_set.hpp> |
| 20 | #include <boost/icl/split_interval_map.hpp> | 23 | #include <boost/icl/split_interval_map.hpp> |
| 21 | #include <boost/pool/pool.hpp> | 24 | #include <boost/pool/pool.hpp> |
| 22 | #include <boost/pool/pool_alloc.hpp> | 25 | #include <boost/pool/pool_alloc.hpp> |
| 26 | #include <boost/pool/poolfwd.hpp> | ||
| 23 | 27 | ||
| 24 | #include "common/common_types.h" | 28 | #include "common/common_types.h" |
| 25 | #include "common/div_ceil.h" | 29 | #include "common/div_ceil.h" |
| @@ -42,7 +46,6 @@ | |||
| 42 | #include "video_core/texture_cache/slot_vector.h" | 46 | #include "video_core/texture_cache/slot_vector.h" |
| 43 | #include "video_core/texture_cache/types.h" | 47 | #include "video_core/texture_cache/types.h" |
| 44 | 48 | ||
| 45 | |||
| 46 | namespace boost { | 49 | namespace boost { |
| 47 | template <typename T> | 50 | template <typename T> |
| 48 | class fast_pool_allocator<T, default_user_allocator_new_delete, details::pool::null_mutex, 4096, 0>; | 51 | class fast_pool_allocator<T, default_user_allocator_new_delete, details::pool::null_mutex, 4096, 0>; |
| @@ -116,11 +119,10 @@ class BufferCache : public VideoCommon::ChannelSetupCaches<VideoCommon::ChannelI | |||
| 116 | using Async_Buffer = typename P::Async_Buffer; | 119 | using Async_Buffer = typename P::Async_Buffer; |
| 117 | using MemoryTracker = typename P::MemoryTracker; | 120 | using MemoryTracker = typename P::MemoryTracker; |
| 118 | 121 | ||
| 119 | using IntervalCompare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, VAddr); | 122 | using IntervalCompare = std::less<VAddr>; |
| 120 | using IntervalInstance = ICL_INTERVAL_INSTANCE(ICL_INTERVAL_DEFAULT, VAddr, IntervalCompare); | 123 | using IntervalInstance = boost::icl::interval_type_default<VAddr, std::less>; |
| 121 | using IntervalAllocator = boost::fast_pool_allocator; | 124 | using IntervalAllocator = boost::fast_pool_allocator<VAddr>; |
| 122 | using IntervalSet = | 125 | using IntervalSet = boost::icl::interval_set<VAddr>; |
| 123 | boost::icl::interval_set<VAddr, IntervalCompare, IntervalInstance, IntervalAllocator>; | ||
| 124 | using IntervalType = typename IntervalSet::interval_type; | 126 | using IntervalType = typename IntervalSet::interval_type; |
| 125 | 127 | ||
| 126 | template <typename Type> | 128 | template <typename Type> |
| @@ -141,12 +143,9 @@ class BufferCache : public VideoCommon::ChannelSetupCaches<VideoCommon::ChannelI | |||
| 141 | static void version(Type&){}; | 143 | static void version(Type&){}; |
| 142 | }; | 144 | }; |
| 143 | 145 | ||
| 144 | using OverlapCombine = ICL_COMBINE_INSTANCE(counter_add_functor, int); | 146 | using OverlapCombine = counter_add_functor<int>; |
| 145 | using OverlapSection = ICL_SECTION_INSTANCE(boost::icl::inter_section, int); | 147 | using OverlapSection = boost::icl::inter_section<int>; |
| 146 | using OverlapCounter = | 148 | using OverlapCounter = boost::icl::split_interval_map<VAddr, int>; |
| 147 | boost::icl::split_interval_map<VAddr, int, boost::icl::partial_absorber, IntervalCompare, | ||
| 148 | OverlapCombine, OverlapSection, IntervalInstance, | ||
| 149 | IntervalAllocator>; | ||
| 150 | 149 | ||
| 151 | struct Empty {}; | 150 | struct Empty {}; |
| 152 | 151 | ||
| @@ -262,7 +261,8 @@ public: | |||
| 262 | /// Return true when a CPU region is modified from the CPU | 261 | /// Return true when a CPU region is modified from the CPU |
| 263 | [[nodiscard]] bool IsRegionCpuModified(VAddr addr, size_t size); | 262 | [[nodiscard]] bool IsRegionCpuModified(VAddr addr, size_t size); |
| 264 | 263 | ||
| 265 | void SetDrawIndirect(const Tegra::Engines::DrawManager::IndirectParams* current_draw_indirect_) { | 264 | void SetDrawIndirect( |
| 265 | const Tegra::Engines::DrawManager::IndirectParams* current_draw_indirect_) { | ||
| 266 | current_draw_indirect = current_draw_indirect_; | 266 | current_draw_indirect = current_draw_indirect_; |
| 267 | } | 267 | } |
| 268 | 268 | ||
| @@ -349,7 +349,8 @@ private: | |||
| 349 | } | 349 | } |
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | void RemoveEachInOverlapCounter(OverlapCounter& current_range, const IntervalType search_interval, int subtract_value) { | 352 | void RemoveEachInOverlapCounter(OverlapCounter& current_range, |
| 353 | const IntervalType search_interval, int subtract_value) { | ||
| 353 | bool any_removals = false; | 354 | bool any_removals = false; |
| 354 | current_range.add(std::make_pair(search_interval, subtract_value)); | 355 | current_range.add(std::make_pair(search_interval, subtract_value)); |
| 355 | do { | 356 | do { |
| @@ -469,7 +470,8 @@ private: | |||
| 469 | 470 | ||
| 470 | void NotifyBufferDeletion(); | 471 | void NotifyBufferDeletion(); |
| 471 | 472 | ||
| 472 | [[nodiscard]] Binding StorageBufferBinding(GPUVAddr ssbo_addr, u32 cbuf_index, bool is_written) const; | 473 | [[nodiscard]] Binding StorageBufferBinding(GPUVAddr ssbo_addr, u32 cbuf_index, |
| 474 | bool is_written) const; | ||
| 473 | 475 | ||
| 474 | [[nodiscard]] TextureBufferBinding GetTextureBufferBinding(GPUVAddr gpu_addr, u32 size, | 476 | [[nodiscard]] TextureBufferBinding GetTextureBufferBinding(GPUVAddr gpu_addr, u32 size, |
| 475 | PixelFormat format); | 477 | PixelFormat format); |
diff --git a/src/video_core/buffer_cache/memory_tracker_base.h b/src/video_core/buffer_cache/memory_tracker_base.h index 93bd779c9..016d8430f 100644 --- a/src/video_core/buffer_cache/memory_tracker_base.h +++ b/src/video_core/buffer_cache/memory_tracker_base.h | |||
| @@ -35,67 +35,71 @@ public: | |||
| 35 | /// Returns the inclusive CPU modified range in a begin end pair | 35 | /// Returns the inclusive CPU modified range in a begin end pair |
| 36 | [[nodiscard]] std::pair<u64, u64> ModifiedCpuRegion(VAddr query_cpu_addr, | 36 | [[nodiscard]] std::pair<u64, u64> ModifiedCpuRegion(VAddr query_cpu_addr, |
| 37 | u64 query_size) noexcept { | 37 | u64 query_size) noexcept { |
| 38 | return IteratePairs<true>(query_cpu_addr, query_size, | 38 | return IteratePairs<true>( |
| 39 | [](Manager* manager, u64 offset, size_t size) { | 39 | query_cpu_addr, query_size, [](Manager* manager, u64 offset, size_t size) { |
| 40 | return manager->ModifiedRegion<Type::CPU>(offset, size); | 40 | return manager->template ModifiedRegion<Type::CPU>(offset, size); |
| 41 | }); | 41 | }); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | /// Returns the inclusive GPU modified range in a begin end pair | 44 | /// Returns the inclusive GPU modified range in a begin end pair |
| 45 | [[nodiscard]] std::pair<u64, u64> ModifiedGpuRegion(VAddr query_cpu_addr, | 45 | [[nodiscard]] std::pair<u64, u64> ModifiedGpuRegion(VAddr query_cpu_addr, |
| 46 | u64 query_size) noexcept { | 46 | u64 query_size) noexcept { |
| 47 | return IteratePairs<false>(query_cpu_addr, query_size, | 47 | return IteratePairs<false>( |
| 48 | [](Manager* manager, u64 offset, size_t size) { | 48 | query_cpu_addr, query_size, [](Manager* manager, u64 offset, size_t size) { |
| 49 | return manager->ModifiedRegion<Type::GPU>(offset, size); | 49 | return manager->template ModifiedRegion<Type::GPU>(offset, size); |
| 50 | }); | 50 | }); |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | /// Returns true if a region has been modified from the CPU | 53 | /// Returns true if a region has been modified from the CPU |
| 54 | [[nodiscard]] bool IsRegionCpuModified(VAddr query_cpu_addr, u64 query_size) noexcept { | 54 | [[nodiscard]] bool IsRegionCpuModified(VAddr query_cpu_addr, u64 query_size) noexcept { |
| 55 | return IteratePages<true>(query_cpu_addr, query_size, | 55 | return IteratePages<true>( |
| 56 | [](Manager* manager, u64 offset, size_t size) { | 56 | query_cpu_addr, query_size, [](Manager* manager, u64 offset, size_t size) { |
| 57 | return manager->IsRegionModified<Type::CPU>(offset, size); | 57 | return manager->template IsRegionModified<Type::CPU>(offset, size); |
| 58 | }); | 58 | }); |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | /// Returns true if a region has been modified from the GPU | 61 | /// Returns true if a region has been modified from the GPU |
| 62 | [[nodiscard]] bool IsRegionGpuModified(VAddr query_cpu_addr, u64 query_size) noexcept { | 62 | [[nodiscard]] bool IsRegionGpuModified(VAddr query_cpu_addr, u64 query_size) noexcept { |
| 63 | return IteratePages<false>(query_cpu_addr, query_size, | 63 | return IteratePages<false>( |
| 64 | [](Manager* manager, u64 offset, size_t size) { | 64 | query_cpu_addr, query_size, [](Manager* manager, u64 offset, size_t size) { |
| 65 | return manager->IsRegionModified<Type::GPU>(offset, size); | 65 | return manager->template IsRegionModified<Type::GPU>(offset, size); |
| 66 | }); | 66 | }); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | /// Mark region as CPU modified, notifying the rasterizer about this change | 69 | /// Mark region as CPU modified, notifying the rasterizer about this change |
| 70 | void MarkRegionAsCpuModified(VAddr dirty_cpu_addr, u64 query_size) { | 70 | void MarkRegionAsCpuModified(VAddr dirty_cpu_addr, u64 query_size) { |
| 71 | IteratePages<true>( | 71 | IteratePages<true>(dirty_cpu_addr, query_size, |
| 72 | dirty_cpu_addr, query_size, [](Manager* manager, u64 offset, size_t size) { | 72 | [](Manager* manager, u64 offset, size_t size) { |
| 73 | manager->ChangeRegionState<Type::CPU, true>(manager->GetCpuAddr() + offset, size); | 73 | manager->template ChangeRegionState<Type::CPU, true>( |
| 74 | }); | 74 | manager->GetCpuAddr() + offset, size); |
| 75 | }); | ||
| 75 | } | 76 | } |
| 76 | 77 | ||
| 77 | /// Unmark region as CPU modified, notifying the rasterizer about this change | 78 | /// Unmark region as CPU modified, notifying the rasterizer about this change |
| 78 | void UnmarkRegionAsCpuModified(VAddr dirty_cpu_addr, u64 query_size) { | 79 | void UnmarkRegionAsCpuModified(VAddr dirty_cpu_addr, u64 query_size) { |
| 79 | IteratePages<true>( | 80 | IteratePages<true>(dirty_cpu_addr, query_size, |
| 80 | dirty_cpu_addr, query_size, [](Manager* manager, u64 offset, size_t size) { | 81 | [](Manager* manager, u64 offset, size_t size) { |
| 81 | manager->ChangeRegionState<Type::CPU, false>(manager->GetCpuAddr() + offset, size); | 82 | manager->template ChangeRegionState<Type::CPU, false>( |
| 82 | }); | 83 | manager->GetCpuAddr() + offset, size); |
| 84 | }); | ||
| 83 | } | 85 | } |
| 84 | 86 | ||
| 85 | /// Mark region as modified from the host GPU | 87 | /// Mark region as modified from the host GPU |
| 86 | void MarkRegionAsGpuModified(VAddr dirty_cpu_addr, u64 query_size) noexcept { | 88 | void MarkRegionAsGpuModified(VAddr dirty_cpu_addr, u64 query_size) noexcept { |
| 87 | IteratePages<true>( | 89 | IteratePages<true>(dirty_cpu_addr, query_size, |
| 88 | dirty_cpu_addr, query_size, [](Manager* manager, u64 offset, size_t size) { | 90 | [](Manager* manager, u64 offset, size_t size) { |
| 89 | manager->ChangeRegionState<Type::GPU, true>(manager->GetCpuAddr() + offset, size); | 91 | manager->template ChangeRegionState<Type::GPU, true>( |
| 90 | }); | 92 | manager->GetCpuAddr() + offset, size); |
| 93 | }); | ||
| 91 | } | 94 | } |
| 92 | 95 | ||
| 93 | /// Unmark region as modified from the host GPU | 96 | /// Unmark region as modified from the host GPU |
| 94 | void UnmarkRegionAsGpuModified(VAddr dirty_cpu_addr, u64 query_size) noexcept { | 97 | void UnmarkRegionAsGpuModified(VAddr dirty_cpu_addr, u64 query_size) noexcept { |
| 95 | IteratePages<true>( | 98 | IteratePages<true>(dirty_cpu_addr, query_size, |
| 96 | dirty_cpu_addr, query_size, [](Manager* manager, u64 offset, size_t size) { | 99 | [](Manager* manager, u64 offset, size_t size) { |
| 97 | manager->ChangeRegionState<Type::GPU, false>(manager->GetCpuAddr() + offset, size); | 100 | manager->template ChangeRegionState<Type::GPU, false>( |
| 98 | }); | 101 | manager->GetCpuAddr() + offset, size); |
| 102 | }); | ||
| 99 | } | 103 | } |
| 100 | 104 | ||
| 101 | /// Mark region as modified from the CPU | 105 | /// Mark region as modified from the CPU |
| @@ -104,7 +108,7 @@ public: | |||
| 104 | IteratePages<true>( | 108 | IteratePages<true>( |
| 105 | dirty_cpu_addr, query_size, [this](Manager* manager, u64 offset, size_t size) { | 109 | dirty_cpu_addr, query_size, [this](Manager* manager, u64 offset, size_t size) { |
| 106 | const VAddr cpu_address = manager->GetCpuAddr() + offset; | 110 | const VAddr cpu_address = manager->GetCpuAddr() + offset; |
| 107 | manager->ChangeRegionState<Type::CachedCPU, true>(cpu_address, size); | 111 | manager->template ChangeRegionState<Type::CachedCPU, true>(cpu_address, size); |
| 108 | cached_pages.insert(static_cast<u32>(cpu_address >> HIGHER_PAGE_BITS)); | 112 | cached_pages.insert(static_cast<u32>(cpu_address >> HIGHER_PAGE_BITS)); |
| 109 | }); | 113 | }); |
| 110 | } | 114 | } |
| @@ -128,7 +132,7 @@ public: | |||
| 128 | void ForEachUploadRange(VAddr query_cpu_range, u64 query_size, Func&& func) { | 132 | void ForEachUploadRange(VAddr query_cpu_range, u64 query_size, Func&& func) { |
| 129 | IteratePages<true>(query_cpu_range, query_size, | 133 | IteratePages<true>(query_cpu_range, query_size, |
| 130 | [&func](Manager* manager, u64 offset, size_t size) { | 134 | [&func](Manager* manager, u64 offset, size_t size) { |
| 131 | manager->ForEachModifiedRange<Type::CPU>( | 135 | manager->template ForEachModifiedRange<Type::CPU>( |
| 132 | manager->GetCpuAddr() + offset, size, true, func); | 136 | manager->GetCpuAddr() + offset, size, true, func); |
| 133 | }); | 137 | }); |
| 134 | } | 138 | } |
| @@ -138,7 +142,7 @@ public: | |||
| 138 | void ForEachDownloadRange(VAddr query_cpu_range, u64 query_size, bool clear, Func&& func) { | 142 | void ForEachDownloadRange(VAddr query_cpu_range, u64 query_size, bool clear, Func&& func) { |
| 139 | IteratePages<false>(query_cpu_range, query_size, | 143 | IteratePages<false>(query_cpu_range, query_size, |
| 140 | [&func, clear](Manager* manager, u64 offset, size_t size) { | 144 | [&func, clear](Manager* manager, u64 offset, size_t size) { |
| 141 | manager->ForEachModifiedRange<Type::GPU>( | 145 | manager->template ForEachModifiedRange<Type::GPU>( |
| 142 | manager->GetCpuAddr() + offset, size, clear, func); | 146 | manager->GetCpuAddr() + offset, size, clear, func); |
| 143 | }); | 147 | }); |
| 144 | } | 148 | } |
| @@ -147,7 +151,7 @@ public: | |||
| 147 | void ForEachDownloadRangeAndClear(VAddr query_cpu_range, u64 query_size, Func&& func) { | 151 | void ForEachDownloadRangeAndClear(VAddr query_cpu_range, u64 query_size, Func&& func) { |
| 148 | IteratePages<false>(query_cpu_range, query_size, | 152 | IteratePages<false>(query_cpu_range, query_size, |
| 149 | [&func](Manager* manager, u64 offset, size_t size) { | 153 | [&func](Manager* manager, u64 offset, size_t size) { |
| 150 | manager->ForEachModifiedRange<Type::GPU>( | 154 | manager->template ForEachModifiedRange<Type::GPU>( |
| 151 | manager->GetCpuAddr() + offset, size, true, func); | 155 | manager->GetCpuAddr() + offset, size, true, func); |
| 152 | }); | 156 | }); |
| 153 | } | 157 | } |
| @@ -218,7 +222,11 @@ private: | |||
| 218 | page_offset = 0; | 222 | page_offset = 0; |
| 219 | remaining_size -= copy_amount; | 223 | remaining_size -= copy_amount; |
| 220 | } | 224 | } |
| 221 | return begin < end ? std::make_pair(begin, end) : std::make_pair(0ULL, 0ULL); | 225 | if (begin < end) { |
| 226 | return std::make_pair(begin, end); | ||
| 227 | } else { | ||
| 228 | return std::make_pair(0ULL, 0ULL); | ||
| 229 | } | ||
| 222 | } | 230 | } |
| 223 | 231 | ||
| 224 | void CreateRegion(std::size_t page_index) { | 232 | void CreateRegion(std::size_t page_index) { |
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.h b/src/video_core/renderer_vulkan/vk_buffer_cache.h index 05968e6a6..879f1ed94 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.h +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include "video_core/buffer_cache/buffer_cache.h" | 6 | #include "video_core/buffer_cache/buffer_cache_base.h" |
| 7 | #include "video_core/buffer_cache/memory_tracker_base.h" | 7 | #include "video_core/buffer_cache/memory_tracker_base.h" |
| 8 | #include "video_core/engines/maxwell_3d.h" | 8 | #include "video_core/engines/maxwell_3d.h" |
| 9 | #include "video_core/renderer_vulkan/vk_compute_pass.h" | 9 | #include "video_core/renderer_vulkan/vk_compute_pass.h" |