diff options
| author | 2020-02-10 13:33:13 -0400 | |
|---|---|---|
| committer | 2020-06-18 16:29:19 -0400 | |
| commit | 1bd706344e2381e11245b2f0bdc291429e46c634 (patch) | |
| tree | 4abae5a2088df1eb023967d83c0b808eceb30cea /src/common | |
| parent | Common: Correct fcontext fibers. (diff) | |
| download | yuzu-1bd706344e2381e11245b2f0bdc291429e46c634.tar.gz yuzu-1bd706344e2381e11245b2f0bdc291429e46c634.tar.xz yuzu-1bd706344e2381e11245b2f0bdc291429e46c634.zip | |
Common/Tests: Clang Format.
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/fiber.cpp | 21 | ||||
| -rw-r--r-- | src/common/fiber.h | 2 | ||||
| -rw-r--r-- | src/common/wall_clock.cpp | 12 | ||||
| -rw-r--r-- | src/common/wall_clock.h | 4 |
4 files changed, 21 insertions, 18 deletions
diff --git a/src/common/fiber.cpp b/src/common/fiber.cpp index e91d86dbe..a46be73c1 100644 --- a/src/common/fiber.cpp +++ b/src/common/fiber.cpp | |||
| @@ -12,7 +12,6 @@ | |||
| 12 | 12 | ||
| 13 | namespace Common { | 13 | namespace Common { |
| 14 | 14 | ||
| 15 | |||
| 16 | #ifdef _MSC_VER | 15 | #ifdef _MSC_VER |
| 17 | 16 | ||
| 18 | struct Fiber::FiberImpl { | 17 | struct Fiber::FiberImpl { |
| @@ -27,14 +26,14 @@ void Fiber::start() { | |||
| 27 | UNREACHABLE(); | 26 | UNREACHABLE(); |
| 28 | } | 27 | } |
| 29 | 28 | ||
| 30 | void __stdcall Fiber::FiberStartFunc(void* fiber_parameter) | 29 | void __stdcall Fiber::FiberStartFunc(void* fiber_parameter) { |
| 31 | { | 30 | auto fiber = static_cast<Fiber*>(fiber_parameter); |
| 32 | auto fiber = static_cast<Fiber *>(fiber_parameter); | 31 | fiber->start(); |
| 33 | fiber->start(); | ||
| 34 | } | 32 | } |
| 35 | 33 | ||
| 36 | Fiber::Fiber(std::function<void(void*)>&& entry_point_func, void* start_parameter) | 34 | Fiber::Fiber(std::function<void(void*)>&& entry_point_func, void* start_parameter) |
| 37 | : guard{}, entry_point{std::move(entry_point_func)}, start_parameter{start_parameter}, previous_fiber{} { | 35 | : guard{}, entry_point{std::move(entry_point_func)}, start_parameter{start_parameter}, |
| 36 | previous_fiber{} { | ||
| 38 | impl = std::make_unique<FiberImpl>(); | 37 | impl = std::make_unique<FiberImpl>(); |
| 39 | impl->handle = CreateFiber(0, &FiberStartFunc, this); | 38 | impl->handle = CreateFiber(0, &FiberStartFunc, this); |
| 40 | } | 39 | } |
| @@ -99,14 +98,14 @@ void Fiber::start(boost::context::detail::transfer_t& transfer) { | |||
| 99 | UNREACHABLE(); | 98 | UNREACHABLE(); |
| 100 | } | 99 | } |
| 101 | 100 | ||
| 102 | void Fiber::FiberStartFunc(boost::context::detail::transfer_t transfer) | 101 | void Fiber::FiberStartFunc(boost::context::detail::transfer_t transfer) { |
| 103 | { | 102 | auto fiber = static_cast<Fiber*>(transfer.data); |
| 104 | auto fiber = static_cast<Fiber *>(transfer.data); | 103 | fiber->start(transfer); |
| 105 | fiber->start(transfer); | ||
| 106 | } | 104 | } |
| 107 | 105 | ||
| 108 | Fiber::Fiber(std::function<void(void*)>&& entry_point_func, void* start_parameter) | 106 | Fiber::Fiber(std::function<void(void*)>&& entry_point_func, void* start_parameter) |
| 109 | : guard{}, entry_point{std::move(entry_point_func)}, start_parameter{start_parameter}, previous_fiber{} { | 107 | : guard{}, entry_point{std::move(entry_point_func)}, start_parameter{start_parameter}, |
| 108 | previous_fiber{} { | ||
| 110 | impl = std::make_unique<FiberImpl>(); | 109 | impl = std::make_unique<FiberImpl>(); |
| 111 | impl->context = boost::context::detail::make_fcontext(impl->stack.data(), impl->stack.size(), | 110 | impl->context = boost::context::detail::make_fcontext(impl->stack.data(), impl->stack.size(), |
| 112 | FiberStartFunc); | 111 | FiberStartFunc); |
diff --git a/src/common/fiber.h b/src/common/fiber.h index 89a01fdd8..b530bf4d2 100644 --- a/src/common/fiber.h +++ b/src/common/fiber.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | #ifndef _MSC_VER | 13 | #ifndef _MSC_VER |
| 14 | namespace boost::context::detail { | 14 | namespace boost::context::detail { |
| 15 | struct transfer_t; | 15 | struct transfer_t; |
| 16 | } | 16 | } |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
diff --git a/src/common/wall_clock.cpp b/src/common/wall_clock.cpp index 8f5e17fa4..e6161c72c 100644 --- a/src/common/wall_clock.cpp +++ b/src/common/wall_clock.cpp | |||
| @@ -58,7 +58,8 @@ private: | |||
| 58 | 58 | ||
| 59 | #ifdef ARCHITECTURE_x86_64 | 59 | #ifdef ARCHITECTURE_x86_64 |
| 60 | 60 | ||
| 61 | std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency, u32 emulated_clock_frequency) { | 61 | std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency, |
| 62 | u32 emulated_clock_frequency) { | ||
| 62 | const auto& caps = GetCPUCaps(); | 63 | const auto& caps = GetCPUCaps(); |
| 63 | u64 rtsc_frequency = 0; | 64 | u64 rtsc_frequency = 0; |
| 64 | if (caps.invariant_tsc) { | 65 | if (caps.invariant_tsc) { |
| @@ -70,15 +71,18 @@ std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency, u | |||
| 70 | } | 71 | } |
| 71 | } | 72 | } |
| 72 | if (rtsc_frequency == 0) { | 73 | if (rtsc_frequency == 0) { |
| 73 | return std::make_unique<StandardWallClock>(emulated_cpu_frequency, emulated_clock_frequency); | 74 | return std::make_unique<StandardWallClock>(emulated_cpu_frequency, |
| 75 | emulated_clock_frequency); | ||
| 74 | } else { | 76 | } else { |
| 75 | return std::make_unique<X64::NativeClock>(emulated_cpu_frequency, emulated_clock_frequency, rtsc_frequency); | 77 | return std::make_unique<X64::NativeClock>(emulated_cpu_frequency, emulated_clock_frequency, |
| 78 | rtsc_frequency); | ||
| 76 | } | 79 | } |
| 77 | } | 80 | } |
| 78 | 81 | ||
| 79 | #else | 82 | #else |
| 80 | 83 | ||
| 81 | std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency, u32 emulated_clock_frequency) { | 84 | std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency, |
| 85 | u32 emulated_clock_frequency) { | ||
| 82 | return std::make_unique<StandardWallClock>(emulated_cpu_frequency, emulated_clock_frequency); | 86 | return std::make_unique<StandardWallClock>(emulated_cpu_frequency, emulated_clock_frequency); |
| 83 | } | 87 | } |
| 84 | 88 | ||
diff --git a/src/common/wall_clock.h b/src/common/wall_clock.h index fc34429bb..ed284cf50 100644 --- a/src/common/wall_clock.h +++ b/src/common/wall_clock.h | |||
| @@ -13,7 +13,6 @@ namespace Common { | |||
| 13 | 13 | ||
| 14 | class WallClock { | 14 | class WallClock { |
| 15 | public: | 15 | public: |
| 16 | |||
| 17 | /// Returns current wall time in nanoseconds | 16 | /// Returns current wall time in nanoseconds |
| 18 | virtual std::chrono::nanoseconds GetTimeNS() = 0; | 17 | virtual std::chrono::nanoseconds GetTimeNS() = 0; |
| 19 | 18 | ||
| @@ -46,6 +45,7 @@ private: | |||
| 46 | bool is_native; | 45 | bool is_native; |
| 47 | }; | 46 | }; |
| 48 | 47 | ||
| 49 | std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency, u32 emulated_clock_frequency); | 48 | std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency, |
| 49 | u32 emulated_clock_frequency); | ||
| 50 | 50 | ||
| 51 | } // namespace Common | 51 | } // namespace Common |