early-access version 1863

This commit is contained in:
pineappleEA 2021-07-09 02:33:25 +02:00
parent 4967de61a1
commit e0163eb4d0
8 changed files with 22 additions and 47 deletions

View File

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

View File

@ -9,6 +9,9 @@
namespace Common { namespace Common {
/// General purpose function wrapper similar to std::function.
/// Unlike std::function, the captured values don't have to be copyable.
/// This class can be moved but not copied.
template <typename ResultType, typename... Args> template <typename ResultType, typename... Args>
class UniqueFunction { class UniqueFunction {
class CallableBase { class CallableBase {

View File

@ -103,23 +103,6 @@ public:
} }
} }
void TryReleasePendingFences() {
while (!fences.empty()) {
TFence& current_fence = fences.front();
if (ShouldWait() && !IsFenceSignaled(current_fence)) {
return;
}
PopAsyncFlushes();
if (current_fence->IsSemaphore()) {
gpu_memory.template Write<u32>(current_fence->GetAddress(),
current_fence->GetPayload());
} else {
gpu.IncrementSyncPoint(current_fence->GetPayload());
}
PopFence();
}
}
protected: protected:
explicit FenceManager(VideoCore::RasterizerInterface& rasterizer_, Tegra::GPU& gpu_, explicit FenceManager(VideoCore::RasterizerInterface& rasterizer_, Tegra::GPU& gpu_,
TTextureCache& texture_cache_, TTBufferCache& buffer_cache_, TTextureCache& texture_cache_, TTBufferCache& buffer_cache_,
@ -149,6 +132,23 @@ protected:
TQueryCache& query_cache; TQueryCache& query_cache;
private: private:
void TryReleasePendingFences() {
while (!fences.empty()) {
TFence& current_fence = fences.front();
if (ShouldWait() && !IsFenceSignaled(current_fence)) {
return;
}
PopAsyncFlushes();
if (current_fence->IsSemaphore()) {
gpu_memory.template Write<u32>(current_fence->GetAddress(),
current_fence->GetPayload());
} else {
gpu.IncrementSyncPoint(current_fence->GetPayload());
}
PopFence();
}
}
bool ShouldWait() const { bool ShouldWait() const {
std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex}; std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex};
return texture_cache.ShouldWaitAsyncFlushes() || buffer_cache.ShouldWaitAsyncFlushes() || return texture_cache.ShouldWaitAsyncFlushes() || buffer_cache.ShouldWaitAsyncFlushes() ||

View File

@ -8,7 +8,6 @@
#include "common/settings.h" #include "common/settings.h"
#include "common/thread.h" #include "common/thread.h"
#include "core/core.h" #include "core/core.h"
#include "core/core_timing.h"
#include "core/frontend/emu_window.h" #include "core/frontend/emu_window.h"
#include "video_core/dma_pusher.h" #include "video_core/dma_pusher.h"
#include "video_core/gpu.h" #include "video_core/gpu.h"
@ -84,17 +83,6 @@ void ThreadManager::StartThread(VideoCore::RendererBase& renderer,
rasterizer = renderer.ReadRasterizer(); rasterizer = renderer.ReadRasterizer();
thread = std::thread(RunThread, std::ref(system), std::ref(renderer), std::ref(context), thread = std::thread(RunThread, std::ref(system), std::ref(renderer), std::ref(context),
std::ref(dma_pusher), std::ref(state)); std::ref(dma_pusher), std::ref(state));
gpu_sync_event = Core::Timing::CreateEvent(
"GPUHostSyncCallback", [this](std::uintptr_t, std::chrono::nanoseconds) {
if (!state.is_running) {
return;
}
OnCommandListEnd();
const auto time_interval = std::chrono::nanoseconds{500 * 1000};
system.CoreTiming().ScheduleEvent(time_interval, gpu_sync_event);
});
system.CoreTiming().ScheduleEvent(std::chrono::nanoseconds{500 * 1000}, gpu_sync_event);
} }
void ThreadManager::SubmitList(Tegra::CommandList&& entries) { void ThreadManager::SubmitList(Tegra::CommandList&& entries) {
@ -140,9 +128,6 @@ void ThreadManager::ShutDown() {
state.cv.notify_all(); state.cv.notify_all();
} }
system.CoreTiming().UnscheduleEvent(gpu_sync_event, 0);
system.CoreTiming().RemoveEvent(gpu_sync_event);
if (!thread.joinable()) { if (!thread.joinable()) {
return; return;
} }

View File

@ -20,10 +20,6 @@ class DmaPusher;
} // namespace Tegra } // namespace Tegra
namespace Core { namespace Core {
namespace Timing {
class CoreTiming;
struct EventType;
} // namespace Timing
namespace Frontend { namespace Frontend {
class GraphicsContext; class GraphicsContext;
} }
@ -154,7 +150,6 @@ private:
SynchState state; SynchState state;
std::thread thread; std::thread thread;
std::shared_ptr<Core::Timing::EventType> gpu_sync_event;
}; };
} // namespace VideoCommon::GPUThread } // namespace VideoCommon::GPUThread

View File

@ -34,10 +34,6 @@ bool InnerFence::IsSignaled() const {
if (is_stubbed) { if (is_stubbed) {
return true; return true;
} }
if (scheduler.IsFree(wait_tick)) {
return true;
}
scheduler.Refresh();
return scheduler.IsFree(wait_tick); return scheduler.IsFree(wait_tick);
} }

View File

@ -611,7 +611,7 @@ void RasterizerVulkan::ReleaseFences() {
if (!gpu.IsAsync()) { if (!gpu.IsAsync()) {
return; return;
} }
fence_manager.TryReleasePendingFences(); fence_manager.WaitPendingFences();
} }
void RasterizerVulkan::FlushAndInvalidateRegion(VAddr addr, u64 size) { void RasterizerVulkan::FlushAndInvalidateRegion(VAddr addr, u64 size) {

View File

@ -83,10 +83,6 @@ public:
return master_semaphore->IsFree(tick); return master_semaphore->IsFree(tick);
} }
void Refresh() const noexcept {
return master_semaphore->Refresh();
}
/// Waits for the given tick to trigger on the GPU. /// Waits for the given tick to trigger on the GPU.
void Wait(u64 tick) { void Wait(u64 tick) {
master_semaphore->Wait(tick); master_semaphore->Wait(tick);