2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Clang: format and ficx compile errors.

This commit is contained in:
Fernando Sahmkow 2023-04-23 03:58:16 +02:00
parent ed4553806a
commit 80480fe3f7
5 changed files with 78 additions and 68 deletions

View file

@ -55,53 +55,53 @@ public:
[[nodiscard]] std::pair<u64, u64> ModifiedCpuRegion(VAddr query_cpu_addr, [[nodiscard]] std::pair<u64, u64> ModifiedCpuRegion(VAddr query_cpu_addr,
u64 query_size) const noexcept { u64 query_size) const noexcept {
const u64 offset = query_cpu_addr - cpu_addr; const u64 offset = query_cpu_addr - cpu_addr;
return word_manager.ModifiedRegion<Type::CPU>(offset, query_size); return word_manager.template ModifiedRegion<Type::CPU>(offset, query_size);
} }
/// Returns the inclusive GPU modified range in a begin end pair /// Returns the inclusive GPU modified range in a begin end pair
[[nodiscard]] std::pair<u64, u64> ModifiedGpuRegion(VAddr query_cpu_addr, [[nodiscard]] std::pair<u64, u64> ModifiedGpuRegion(VAddr query_cpu_addr,
u64 query_size) const noexcept { u64 query_size) const noexcept {
const u64 offset = query_cpu_addr - cpu_addr; const u64 offset = query_cpu_addr - cpu_addr;
return word_manager.ModifiedRegion<Type::GPU>(offset, query_size); return word_manager.template ModifiedRegion<Type::GPU>(offset, query_size);
} }
/// Returns true if a region has been modified from the CPU /// Returns true if a region has been modified from the CPU
[[nodiscard]] bool IsRegionCpuModified(VAddr query_cpu_addr, u64 query_size) const noexcept { [[nodiscard]] bool IsRegionCpuModified(VAddr query_cpu_addr, u64 query_size) const noexcept {
const u64 offset = query_cpu_addr - cpu_addr; const u64 offset = query_cpu_addr - cpu_addr;
return word_manager.IsRegionModified<Type::CPU>(offset, query_size); return word_manager.template IsRegionModified<Type::CPU>(offset, query_size);
} }
/// Returns true if a region has been modified from the GPU /// Returns true if a region has been modified from the GPU
[[nodiscard]] bool IsRegionGpuModified(VAddr query_cpu_addr, u64 query_size) const noexcept { [[nodiscard]] bool IsRegionGpuModified(VAddr query_cpu_addr, u64 query_size) const noexcept {
const u64 offset = query_cpu_addr - cpu_addr; const u64 offset = query_cpu_addr - cpu_addr;
return word_manager.IsRegionModified<Type::GPU>(offset, query_size); return word_manager.template IsRegionModified<Type::GPU>(offset, query_size);
} }
/// Mark region as CPU modified, notifying the rasterizer about this change /// Mark region as CPU modified, notifying the rasterizer about this change
void MarkRegionAsCpuModified(VAddr dirty_cpu_addr, u64 size) { void MarkRegionAsCpuModified(VAddr dirty_cpu_addr, u64 size) {
word_manager.ChangeRegionState<Type::CPU, true>(dirty_cpu_addr, size); word_manager.template ChangeRegionState<Type::CPU, true>(dirty_cpu_addr, size);
} }
/// Unmark region as CPU modified, notifying the rasterizer about this change /// Unmark region as CPU modified, notifying the rasterizer about this change
void UnmarkRegionAsCpuModified(VAddr dirty_cpu_addr, u64 size) { void UnmarkRegionAsCpuModified(VAddr dirty_cpu_addr, u64 size) {
word_manager.ChangeRegionState<Type::CPU, false>(dirty_cpu_addr, size); word_manager.template ChangeRegionState<Type::CPU, false>(dirty_cpu_addr, size);
} }
/// Mark region as modified from the host GPU /// Mark region as modified from the host GPU
void MarkRegionAsGpuModified(VAddr dirty_cpu_addr, u64 size) noexcept { void MarkRegionAsGpuModified(VAddr dirty_cpu_addr, u64 size) noexcept {
word_manager.ChangeRegionState<Type::GPU, true>(dirty_cpu_addr, size); word_manager.template ChangeRegionState<Type::GPU, true>(dirty_cpu_addr, size);
} }
/// Unmark region as modified from the host GPU /// Unmark region as modified from the host GPU
void UnmarkRegionAsGpuModified(VAddr dirty_cpu_addr, u64 size) noexcept { void UnmarkRegionAsGpuModified(VAddr dirty_cpu_addr, u64 size) noexcept {
word_manager.ChangeRegionState<Type::GPU, false>(dirty_cpu_addr, size); word_manager.template ChangeRegionState<Type::GPU, false>(dirty_cpu_addr, size);
} }
/// Mark region as modified from the CPU /// Mark region as modified from the CPU
/// but don't mark it as modified until FlusHCachedWrites is called. /// but don't mark it as modified until FlusHCachedWrites is called.
void CachedCpuWrite(VAddr dirty_cpu_addr, u64 size) { void CachedCpuWrite(VAddr dirty_cpu_addr, u64 size) {
flags |= BufferFlagBits::CachedWrites; flags |= BufferFlagBits::CachedWrites;
word_manager.ChangeRegionState<Type::CachedCPU, true>(dirty_cpu_addr, size); word_manager.template ChangeRegionState<Type::CachedCPU, true>(dirty_cpu_addr, size);
} }
/// Flushes cached CPU writes, and notify the rasterizer about the deltas /// Flushes cached CPU writes, and notify the rasterizer about the deltas
@ -113,24 +113,24 @@ public:
/// Call 'func' for each CPU modified range and unmark those pages as CPU modified /// Call 'func' for each CPU modified range and unmark those pages as CPU modified
template <typename Func> template <typename Func>
void ForEachUploadRange(VAddr query_cpu_range, u64 size, Func&& func) { void ForEachUploadRange(VAddr query_cpu_range, u64 size, Func&& func) {
word_manager.ForEachModifiedRange<Type::CPU>(query_cpu_range, size, true, func); word_manager.template ForEachModifiedRange<Type::CPU>(query_cpu_range, size, true, func);
} }
/// Call 'func' for each GPU modified range and unmark those pages as GPU modified /// Call 'func' for each GPU modified range and unmark those pages as GPU modified
template <typename Func> template <typename Func>
void ForEachDownloadRange(VAddr query_cpu_range, u64 size, bool clear, Func&& func) { void ForEachDownloadRange(VAddr query_cpu_range, u64 size, bool clear, Func&& func) {
word_manager.ForEachModifiedRange<Type::GPU>(query_cpu_range, size, clear, func); word_manager.template ForEachModifiedRange<Type::GPU>(query_cpu_range, size, clear, func);
} }
template <typename Func> template <typename Func>
void ForEachDownloadRangeAndClear(VAddr query_cpu_range, u64 size, Func&& func) { void ForEachDownloadRangeAndClear(VAddr query_cpu_range, u64 size, Func&& func) {
word_manager.ForEachModifiedRange<Type::GPU>(query_cpu_range, size, true, func); word_manager.template ForEachModifiedRange<Type::GPU>(query_cpu_range, size, true, func);
} }
/// Call 'func' for each GPU modified range and unmark those pages as GPU modified /// Call 'func' for each GPU modified range and unmark those pages as GPU modified
template <typename Func> template <typename Func>
void ForEachDownloadRange(Func&& func) { void ForEachDownloadRange(Func&& func) {
word_manager.ForEachModifiedRange<Type::GPU>(cpu_addr, SizeBytes(), true, func); word_manager.template ForEachModifiedRange<Type::GPU>(cpu_addr, SizeBytes(), true, func);
} }
/// Mark buffer as picked /// Mark buffer as picked

View file

@ -1395,10 +1395,10 @@ bool BufferCache<P>::SynchronizeBufferNoModified(Buffer& buffer, VAddr cpu_addr,
auto make_copies = [&] { auto make_copies = [&] {
for (auto& interval : found_sets) { for (auto& interval : found_sets) {
const std::size_t sub_size = interval.upper() - interval.lower(); const std::size_t sub_size = interval.upper() - interval.lower();
const VAddr cpu_addr = interval.lower(); const VAddr cpu_addr_ = interval.lower();
copies.push_back(BufferCopy{ copies.push_back(BufferCopy{
.src_offset = total_size_bytes, .src_offset = total_size_bytes,
.dst_offset = cpu_addr - buffer.CpuAddr(), .dst_offset = cpu_addr_ - buffer.CpuAddr(),
.size = sub_size, .size = sub_size,
}); });
total_size_bytes += sub_size; total_size_bytes += sub_size;

View file

@ -5,6 +5,7 @@
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <functional>
#include <memory> #include <memory>
#include <mutex> #include <mutex>
#include <numeric> #include <numeric>
@ -16,10 +17,13 @@
#define BOOST_NO_MT #define BOOST_NO_MT
#include <boost/pool/detail/mutex.hpp> #include <boost/pool/detail/mutex.hpp>
#undef BOOST_NO_MT #undef BOOST_NO_MT
#include <boost/icl/interval.hpp>
#include <boost/icl/interval_base_set.hpp>
#include <boost/icl/interval_set.hpp> #include <boost/icl/interval_set.hpp>
#include <boost/icl/split_interval_map.hpp> #include <boost/icl/split_interval_map.hpp>
#include <boost/pool/pool.hpp> #include <boost/pool/pool.hpp>
#include <boost/pool/pool_alloc.hpp> #include <boost/pool/pool_alloc.hpp>
#include <boost/pool/poolfwd.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/div_ceil.h" #include "common/div_ceil.h"
@ -42,7 +46,6 @@
#include "video_core/texture_cache/slot_vector.h" #include "video_core/texture_cache/slot_vector.h"
#include "video_core/texture_cache/types.h" #include "video_core/texture_cache/types.h"
namespace boost { namespace boost {
template <typename T> template <typename T>
class fast_pool_allocator<T, default_user_allocator_new_delete, details::pool::null_mutex, 4096, 0>; 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
using Async_Buffer = typename P::Async_Buffer; using Async_Buffer = typename P::Async_Buffer;
using MemoryTracker = typename P::MemoryTracker; using MemoryTracker = typename P::MemoryTracker;
using IntervalCompare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, VAddr); using IntervalCompare = std::less<VAddr>;
using IntervalInstance = ICL_INTERVAL_INSTANCE(ICL_INTERVAL_DEFAULT, VAddr, IntervalCompare); using IntervalInstance = boost::icl::interval_type_default<VAddr, std::less>;
using IntervalAllocator = boost::fast_pool_allocator; using IntervalAllocator = boost::fast_pool_allocator<VAddr>;
using IntervalSet = using IntervalSet = boost::icl::interval_set<VAddr>;
boost::icl::interval_set<VAddr, IntervalCompare, IntervalInstance, IntervalAllocator>;
using IntervalType = typename IntervalSet::interval_type; using IntervalType = typename IntervalSet::interval_type;
template <typename Type> template <typename Type>
@ -141,12 +143,9 @@ class BufferCache : public VideoCommon::ChannelSetupCaches<VideoCommon::ChannelI
static void version(Type&){}; static void version(Type&){};
}; };
using OverlapCombine = ICL_COMBINE_INSTANCE(counter_add_functor, int); using OverlapCombine = counter_add_functor<int>;
using OverlapSection = ICL_SECTION_INSTANCE(boost::icl::inter_section, int); using OverlapSection = boost::icl::inter_section<int>;
using OverlapCounter = using OverlapCounter = boost::icl::split_interval_map<VAddr, int>;
boost::icl::split_interval_map<VAddr, int, boost::icl::partial_absorber, IntervalCompare,
OverlapCombine, OverlapSection, IntervalInstance,
IntervalAllocator>;
struct Empty {}; struct Empty {};
@ -262,7 +261,8 @@ public:
/// Return true when a CPU region is modified from the CPU /// Return true when a CPU region is modified from the CPU
[[nodiscard]] bool IsRegionCpuModified(VAddr addr, size_t size); [[nodiscard]] bool IsRegionCpuModified(VAddr addr, size_t size);
void SetDrawIndirect(const Tegra::Engines::DrawManager::IndirectParams* current_draw_indirect_) { void SetDrawIndirect(
const Tegra::Engines::DrawManager::IndirectParams* current_draw_indirect_) {
current_draw_indirect = current_draw_indirect_; current_draw_indirect = current_draw_indirect_;
} }
@ -349,7 +349,8 @@ private:
} }
} }
void RemoveEachInOverlapCounter(OverlapCounter& current_range, const IntervalType search_interval, int subtract_value) { void RemoveEachInOverlapCounter(OverlapCounter& current_range,
const IntervalType search_interval, int subtract_value) {
bool any_removals = false; bool any_removals = false;
current_range.add(std::make_pair(search_interval, subtract_value)); current_range.add(std::make_pair(search_interval, subtract_value));
do { do {
@ -469,7 +470,8 @@ private:
void NotifyBufferDeletion(); void NotifyBufferDeletion();
[[nodiscard]] Binding StorageBufferBinding(GPUVAddr ssbo_addr, u32 cbuf_index, bool is_written) const; [[nodiscard]] Binding StorageBufferBinding(GPUVAddr ssbo_addr, u32 cbuf_index,
bool is_written) const;
[[nodiscard]] TextureBufferBinding GetTextureBufferBinding(GPUVAddr gpu_addr, u32 size, [[nodiscard]] TextureBufferBinding GetTextureBufferBinding(GPUVAddr gpu_addr, u32 size,
PixelFormat format); PixelFormat format);

View file

@ -35,67 +35,71 @@ public:
/// Returns the inclusive CPU modified range in a begin end pair /// Returns the inclusive CPU modified range in a begin end pair
[[nodiscard]] std::pair<u64, u64> ModifiedCpuRegion(VAddr query_cpu_addr, [[nodiscard]] std::pair<u64, u64> ModifiedCpuRegion(VAddr query_cpu_addr,
u64 query_size) noexcept { u64 query_size) noexcept {
return IteratePairs<true>(query_cpu_addr, query_size, return IteratePairs<true>(
[](Manager* manager, u64 offset, size_t size) { query_cpu_addr, query_size, [](Manager* manager, u64 offset, size_t size) {
return manager->ModifiedRegion<Type::CPU>(offset, size); return manager->template ModifiedRegion<Type::CPU>(offset, size);
}); });
} }
/// Returns the inclusive GPU modified range in a begin end pair /// Returns the inclusive GPU modified range in a begin end pair
[[nodiscard]] std::pair<u64, u64> ModifiedGpuRegion(VAddr query_cpu_addr, [[nodiscard]] std::pair<u64, u64> ModifiedGpuRegion(VAddr query_cpu_addr,
u64 query_size) noexcept { u64 query_size) noexcept {
return IteratePairs<false>(query_cpu_addr, query_size, return IteratePairs<false>(
[](Manager* manager, u64 offset, size_t size) { query_cpu_addr, query_size, [](Manager* manager, u64 offset, size_t size) {
return manager->ModifiedRegion<Type::GPU>(offset, size); return manager->template ModifiedRegion<Type::GPU>(offset, size);
}); });
} }
/// Returns true if a region has been modified from the CPU /// Returns true if a region has been modified from the CPU
[[nodiscard]] bool IsRegionCpuModified(VAddr query_cpu_addr, u64 query_size) noexcept { [[nodiscard]] bool IsRegionCpuModified(VAddr query_cpu_addr, u64 query_size) noexcept {
return IteratePages<true>(query_cpu_addr, query_size, return IteratePages<true>(
[](Manager* manager, u64 offset, size_t size) { query_cpu_addr, query_size, [](Manager* manager, u64 offset, size_t size) {
return manager->IsRegionModified<Type::CPU>(offset, size); return manager->template IsRegionModified<Type::CPU>(offset, size);
}); });
} }
/// Returns true if a region has been modified from the GPU /// Returns true if a region has been modified from the GPU
[[nodiscard]] bool IsRegionGpuModified(VAddr query_cpu_addr, u64 query_size) noexcept { [[nodiscard]] bool IsRegionGpuModified(VAddr query_cpu_addr, u64 query_size) noexcept {
return IteratePages<false>(query_cpu_addr, query_size, return IteratePages<false>(
[](Manager* manager, u64 offset, size_t size) { query_cpu_addr, query_size, [](Manager* manager, u64 offset, size_t size) {
return manager->IsRegionModified<Type::GPU>(offset, size); return manager->template IsRegionModified<Type::GPU>(offset, size);
}); });
} }
/// Mark region as CPU modified, notifying the rasterizer about this change /// Mark region as CPU modified, notifying the rasterizer about this change
void MarkRegionAsCpuModified(VAddr dirty_cpu_addr, u64 query_size) { void MarkRegionAsCpuModified(VAddr dirty_cpu_addr, u64 query_size) {
IteratePages<true>( IteratePages<true>(dirty_cpu_addr, query_size,
dirty_cpu_addr, query_size, [](Manager* manager, u64 offset, size_t size) { [](Manager* manager, u64 offset, size_t size) {
manager->ChangeRegionState<Type::CPU, true>(manager->GetCpuAddr() + offset, size); manager->template ChangeRegionState<Type::CPU, true>(
}); manager->GetCpuAddr() + offset, size);
});
} }
/// Unmark region as CPU modified, notifying the rasterizer about this change /// Unmark region as CPU modified, notifying the rasterizer about this change
void UnmarkRegionAsCpuModified(VAddr dirty_cpu_addr, u64 query_size) { void UnmarkRegionAsCpuModified(VAddr dirty_cpu_addr, u64 query_size) {
IteratePages<true>( IteratePages<true>(dirty_cpu_addr, query_size,
dirty_cpu_addr, query_size, [](Manager* manager, u64 offset, size_t size) { [](Manager* manager, u64 offset, size_t size) {
manager->ChangeRegionState<Type::CPU, false>(manager->GetCpuAddr() + offset, size); manager->template ChangeRegionState<Type::CPU, false>(
}); manager->GetCpuAddr() + offset, size);
});
} }
/// Mark region as modified from the host GPU /// Mark region as modified from the host GPU
void MarkRegionAsGpuModified(VAddr dirty_cpu_addr, u64 query_size) noexcept { void MarkRegionAsGpuModified(VAddr dirty_cpu_addr, u64 query_size) noexcept {
IteratePages<true>( IteratePages<true>(dirty_cpu_addr, query_size,
dirty_cpu_addr, query_size, [](Manager* manager, u64 offset, size_t size) { [](Manager* manager, u64 offset, size_t size) {
manager->ChangeRegionState<Type::GPU, true>(manager->GetCpuAddr() + offset, size); manager->template ChangeRegionState<Type::GPU, true>(
}); manager->GetCpuAddr() + offset, size);
});
} }
/// Unmark region as modified from the host GPU /// Unmark region as modified from the host GPU
void UnmarkRegionAsGpuModified(VAddr dirty_cpu_addr, u64 query_size) noexcept { void UnmarkRegionAsGpuModified(VAddr dirty_cpu_addr, u64 query_size) noexcept {
IteratePages<true>( IteratePages<true>(dirty_cpu_addr, query_size,
dirty_cpu_addr, query_size, [](Manager* manager, u64 offset, size_t size) { [](Manager* manager, u64 offset, size_t size) {
manager->ChangeRegionState<Type::GPU, false>(manager->GetCpuAddr() + offset, size); manager->template ChangeRegionState<Type::GPU, false>(
}); manager->GetCpuAddr() + offset, size);
});
} }
/// Mark region as modified from the CPU /// Mark region as modified from the CPU
@ -104,7 +108,7 @@ public:
IteratePages<true>( IteratePages<true>(
dirty_cpu_addr, query_size, [this](Manager* manager, u64 offset, size_t size) { dirty_cpu_addr, query_size, [this](Manager* manager, u64 offset, size_t size) {
const VAddr cpu_address = manager->GetCpuAddr() + offset; const VAddr cpu_address = manager->GetCpuAddr() + offset;
manager->ChangeRegionState<Type::CachedCPU, true>(cpu_address, size); manager->template ChangeRegionState<Type::CachedCPU, true>(cpu_address, size);
cached_pages.insert(static_cast<u32>(cpu_address >> HIGHER_PAGE_BITS)); cached_pages.insert(static_cast<u32>(cpu_address >> HIGHER_PAGE_BITS));
}); });
} }
@ -128,7 +132,7 @@ public:
void ForEachUploadRange(VAddr query_cpu_range, u64 query_size, Func&& func) { void ForEachUploadRange(VAddr query_cpu_range, u64 query_size, Func&& func) {
IteratePages<true>(query_cpu_range, query_size, IteratePages<true>(query_cpu_range, query_size,
[&func](Manager* manager, u64 offset, size_t size) { [&func](Manager* manager, u64 offset, size_t size) {
manager->ForEachModifiedRange<Type::CPU>( manager->template ForEachModifiedRange<Type::CPU>(
manager->GetCpuAddr() + offset, size, true, func); manager->GetCpuAddr() + offset, size, true, func);
}); });
} }
@ -138,7 +142,7 @@ public:
void ForEachDownloadRange(VAddr query_cpu_range, u64 query_size, bool clear, Func&& func) { void ForEachDownloadRange(VAddr query_cpu_range, u64 query_size, bool clear, Func&& func) {
IteratePages<false>(query_cpu_range, query_size, IteratePages<false>(query_cpu_range, query_size,
[&func, clear](Manager* manager, u64 offset, size_t size) { [&func, clear](Manager* manager, u64 offset, size_t size) {
manager->ForEachModifiedRange<Type::GPU>( manager->template ForEachModifiedRange<Type::GPU>(
manager->GetCpuAddr() + offset, size, clear, func); manager->GetCpuAddr() + offset, size, clear, func);
}); });
} }
@ -147,7 +151,7 @@ public:
void ForEachDownloadRangeAndClear(VAddr query_cpu_range, u64 query_size, Func&& func) { void ForEachDownloadRangeAndClear(VAddr query_cpu_range, u64 query_size, Func&& func) {
IteratePages<false>(query_cpu_range, query_size, IteratePages<false>(query_cpu_range, query_size,
[&func](Manager* manager, u64 offset, size_t size) { [&func](Manager* manager, u64 offset, size_t size) {
manager->ForEachModifiedRange<Type::GPU>( manager->template ForEachModifiedRange<Type::GPU>(
manager->GetCpuAddr() + offset, size, true, func); manager->GetCpuAddr() + offset, size, true, func);
}); });
} }
@ -218,7 +222,11 @@ private:
page_offset = 0; page_offset = 0;
remaining_size -= copy_amount; remaining_size -= copy_amount;
} }
return begin < end ? std::make_pair(begin, end) : std::make_pair(0ULL, 0ULL); if (begin < end) {
return std::make_pair(begin, end);
} else {
return std::make_pair(0ULL, 0ULL);
}
} }
void CreateRegion(std::size_t page_index) { void CreateRegion(std::size_t page_index) {

View file

@ -3,7 +3,7 @@
#pragma once #pragma once
#include "video_core/buffer_cache/buffer_cache.h" #include "video_core/buffer_cache/buffer_cache_base.h"
#include "video_core/buffer_cache/memory_tracker_base.h" #include "video_core/buffer_cache/memory_tracker_base.h"
#include "video_core/engines/maxwell_3d.h" #include "video_core/engines/maxwell_3d.h"
#include "video_core/renderer_vulkan/vk_compute_pass.h" #include "video_core/renderer_vulkan/vk_compute_pass.h"