early-access version 4086

This commit is contained in:
pineappleEA 2024-01-25 07:35:49 +01:00
parent 430b277c08
commit 318dc2a69d
9 changed files with 16 additions and 30 deletions

View file

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 4085. This is the source code for early-access 4086.
## Legal Notice ## Legal Notice

View file

@ -29,10 +29,6 @@ NativeClock::NativeClock() {
gputick_cntfrq_factor = GetFixedPointFactor(GPUTickFreq, host_cntfrq); gputick_cntfrq_factor = GetFixedPointFactor(GPUTickFreq, host_cntfrq);
} }
void NativeClock::Reset() {
start_ticks = GetUptime();
}
std::chrono::nanoseconds NativeClock::GetTimeNS() const { std::chrono::nanoseconds NativeClock::GetTimeNS() const {
return std::chrono::nanoseconds{MultiplyHigh(GetUptime(), ns_cntfrq_factor)}; return std::chrono::nanoseconds{MultiplyHigh(GetUptime(), ns_cntfrq_factor)};
} }
@ -46,11 +42,11 @@ std::chrono::milliseconds NativeClock::GetTimeMS() const {
} }
s64 NativeClock::GetCNTPCT() const { s64 NativeClock::GetCNTPCT() const {
return MultiplyHigh(GetUptime() - start_ticks, guest_cntfrq_factor); return MultiplyHigh(GetUptime(), guest_cntfrq_factor);
} }
s64 NativeClock::GetGPUTick() const { s64 NativeClock::GetGPUTick() const {
return MultiplyHigh(GetUptime() - start_ticks, gputick_cntfrq_factor); return MultiplyHigh(GetUptime(), gputick_cntfrq_factor);
} }
s64 NativeClock::GetUptime() const { s64 NativeClock::GetUptime() const {

View file

@ -11,8 +11,6 @@ class NativeClock final : public WallClock {
public: public:
explicit NativeClock(); explicit NativeClock();
void Reset() override;
std::chrono::nanoseconds GetTimeNS() const override; std::chrono::nanoseconds GetTimeNS() const override;
std::chrono::microseconds GetTimeUS() const override; std::chrono::microseconds GetTimeUS() const override;
@ -42,7 +40,6 @@ private:
FactorType ms_cntfrq_factor; FactorType ms_cntfrq_factor;
FactorType guest_cntfrq_factor; FactorType guest_cntfrq_factor;
FactorType gputick_cntfrq_factor; FactorType gputick_cntfrq_factor;
s64 start_ticks;
}; };
} // namespace Common::Arm64 } // namespace Common::Arm64

View file

@ -20,10 +20,6 @@ class StandardWallClock final : public WallClock {
public: public:
explicit StandardWallClock() {} explicit StandardWallClock() {}
void Reset() override {
start_time = std::chrono::system_clock::now();
}
std::chrono::nanoseconds GetTimeNS() const override { std::chrono::nanoseconds GetTimeNS() const override {
return std::chrono::duration_cast<std::chrono::nanoseconds>( return std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::system_clock::now().time_since_epoch()); std::chrono::system_clock::now().time_since_epoch());
@ -49,16 +45,13 @@ public:
s64 GetUptime() const override { s64 GetUptime() const override {
return std::chrono::duration_cast<std::chrono::nanoseconds>( return std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::system_clock::now() - start_time) std::chrono::steady_clock::now().time_since_epoch())
.count(); .count();
} }
bool IsNative() const override { bool IsNative() const override {
return false; return false;
} }
private:
std::chrono::system_clock::time_point start_time{};
}; };
std::unique_ptr<WallClock> CreateOptimalClock() { std::unique_ptr<WallClock> CreateOptimalClock() {

View file

@ -19,8 +19,6 @@ public:
virtual ~WallClock() = default; virtual ~WallClock() = default;
virtual void Reset() = 0;
/// @returns The time in nanoseconds since the construction of this clock. /// @returns The time in nanoseconds since the construction of this clock.
virtual std::chrono::nanoseconds GetTimeNS() const = 0; virtual std::chrono::nanoseconds GetTimeNS() const = 0;

View file

@ -15,10 +15,6 @@ NativeClock::NativeClock(u64 rdtsc_frequency_)
cntpct_rdtsc_factor{GetFixedPoint64Factor(CNTFRQ, rdtsc_frequency)}, cntpct_rdtsc_factor{GetFixedPoint64Factor(CNTFRQ, rdtsc_frequency)},
gputick_rdtsc_factor{GetFixedPoint64Factor(GPUTickFreq, rdtsc_frequency)} {} gputick_rdtsc_factor{GetFixedPoint64Factor(GPUTickFreq, rdtsc_frequency)} {}
void NativeClock::Reset() {
start_ticks = FencedRDTSC();
}
std::chrono::nanoseconds NativeClock::GetTimeNS() const { std::chrono::nanoseconds NativeClock::GetTimeNS() const {
return std::chrono::nanoseconds{MultiplyHigh(GetUptime(), ns_rdtsc_factor)}; return std::chrono::nanoseconds{MultiplyHigh(GetUptime(), ns_rdtsc_factor)};
} }
@ -32,11 +28,11 @@ std::chrono::milliseconds NativeClock::GetTimeMS() const {
} }
s64 NativeClock::GetCNTPCT() const { s64 NativeClock::GetCNTPCT() const {
return MultiplyHigh(GetUptime() - start_ticks, cntpct_rdtsc_factor); return MultiplyHigh(GetUptime(), cntpct_rdtsc_factor);
} }
s64 NativeClock::GetGPUTick() const { s64 NativeClock::GetGPUTick() const {
return MultiplyHigh(GetUptime() - start_ticks, gputick_rdtsc_factor); return MultiplyHigh(GetUptime(), gputick_rdtsc_factor);
} }
s64 NativeClock::GetUptime() const { s64 NativeClock::GetUptime() const {

View file

@ -11,8 +11,6 @@ class NativeClock final : public WallClock {
public: public:
explicit NativeClock(u64 rdtsc_frequency_); explicit NativeClock(u64 rdtsc_frequency_);
void Reset() override;
std::chrono::nanoseconds GetTimeNS() const override; std::chrono::nanoseconds GetTimeNS() const override;
std::chrono::microseconds GetTimeUS() const override; std::chrono::microseconds GetTimeUS() const override;
@ -28,7 +26,6 @@ public:
bool IsNative() const override; bool IsNative() const override;
private: private:
u64 start_ticks;
u64 rdtsc_frequency; u64 rdtsc_frequency;
u64 ns_rdtsc_factor; u64 ns_rdtsc_factor;

View file

@ -66,7 +66,6 @@ void CoreTiming::Initialize(std::function<void()>&& on_thread_init_) {
event_fifo_id = 0; event_fifo_id = 0;
shutting_down = false; shutting_down = false;
cpu_ticks = 0; cpu_ticks = 0;
clock->Reset();
if (is_multicore) { if (is_multicore) {
timer_thread = std::make_unique<std::jthread>(ThreadEntry, std::ref(*this)); timer_thread = std::make_unique<std::jthread>(ThreadEntry, std::ref(*this));
} }

View file

@ -39,6 +39,10 @@ void SortPhysicalDevicesPerVendor(std::vector<VkPhysicalDevice>& devices,
} }
} }
bool IsMicrosoftDozen(const char* device_name) {
return std::strstr(device_name, "Microsoft") != nullptr;
}
void SortPhysicalDevices(std::vector<VkPhysicalDevice>& devices, const InstanceDispatch& dld) { void SortPhysicalDevices(std::vector<VkPhysicalDevice>& devices, const InstanceDispatch& dld) {
// Sort by name, this will set a base and make GPUs with higher numbers appear first // Sort by name, this will set a base and make GPUs with higher numbers appear first
// (e.g. GTX 1650 will intentionally be listed before a GTX 1080). // (e.g. GTX 1650 will intentionally be listed before a GTX 1080).
@ -52,6 +56,12 @@ void SortPhysicalDevices(std::vector<VkPhysicalDevice>& devices, const InstanceD
}); });
// Prefer Nvidia over AMD, AMD over Intel, Intel over the rest. // Prefer Nvidia over AMD, AMD over Intel, Intel over the rest.
SortPhysicalDevicesPerVendor(devices, dld, {0x10DE, 0x1002, 0x8086}); SortPhysicalDevicesPerVendor(devices, dld, {0x10DE, 0x1002, 0x8086});
// Demote Microsoft's Dozen devices to the bottom.
SortPhysicalDevices(
devices, dld,
[](const VkPhysicalDeviceProperties& lhs, const VkPhysicalDeviceProperties& rhs) {
return IsMicrosoftDozen(rhs.deviceName) && !IsMicrosoftDozen(lhs.deviceName);
});
} }
template <typename T> template <typename T>