|
|
@ -65,7 +65,8 @@ static void RunThread(Core::System& system, VideoCore::RendererBase& renderer, |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
ThreadManager::ThreadManager(Core::System& system_) : system{system_} {} |
|
|
|
|
|
|
|
|
ThreadManager::ThreadManager(Core::System& system_, bool is_async_) |
|
|
|
|
|
: system{system_}, is_async{is_async_} {} |
|
|
|
|
|
|
|
|
ThreadManager::~ThreadManager() { |
|
|
ThreadManager::~ThreadManager() { |
|
|
if (!thread.joinable()) { |
|
|
if (!thread.joinable()) { |
|
|
@ -97,19 +98,30 @@ void ThreadManager::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void ThreadManager::FlushRegion(VAddr addr, u64 size) { |
|
|
void ThreadManager::FlushRegion(VAddr addr, u64 size) { |
|
|
if (!Settings::IsGPULevelHigh()) { |
|
|
|
|
|
|
|
|
if (!is_async) { |
|
|
|
|
|
// Always flush with synchronous GPU mode
|
|
|
PushCommand(FlushRegionCommand(addr, size)); |
|
|
PushCommand(FlushRegionCommand(addr, size)); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (!Settings::IsGPULevelExtreme()) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (system.Renderer().Rasterizer().MustFlushRegion(addr, size)) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Asynchronous GPU mode
|
|
|
|
|
|
switch (Settings::values.gpu_accuracy.GetValue()) { |
|
|
|
|
|
case Settings::GPUAccuracy::Normal: |
|
|
|
|
|
PushCommand(FlushRegionCommand(addr, size)); |
|
|
|
|
|
break; |
|
|
|
|
|
case Settings::GPUAccuracy::High: |
|
|
|
|
|
// TODO(bunnei): Is this right? Preserving existing behavior for now
|
|
|
|
|
|
break; |
|
|
|
|
|
case Settings::GPUAccuracy::Extreme: { |
|
|
auto& gpu = system.GPU(); |
|
|
auto& gpu = system.GPU(); |
|
|
u64 fence = gpu.RequestFlush(addr, size); |
|
|
u64 fence = gpu.RequestFlush(addr, size); |
|
|
PushCommand(GPUTickCommand()); |
|
|
PushCommand(GPUTickCommand()); |
|
|
while (fence > gpu.CurrentFlushRequestFence()) { |
|
|
while (fence > gpu.CurrentFlushRequestFence()) { |
|
|
} |
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
default: |
|
|
|
|
|
UNIMPLEMENTED_MSG("Unsupported gpu_accuracy {}", Settings::values.gpu_accuracy.GetValue()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -134,6 +146,12 @@ void ThreadManager::OnCommandListEnd() { |
|
|
u64 ThreadManager::PushCommand(CommandData&& command_data) { |
|
|
u64 ThreadManager::PushCommand(CommandData&& command_data) { |
|
|
const u64 fence{++state.last_fence}; |
|
|
const u64 fence{++state.last_fence}; |
|
|
state.queue.Push(CommandDataContainer(std::move(command_data), fence)); |
|
|
state.queue.Push(CommandDataContainer(std::move(command_data), fence)); |
|
|
|
|
|
|
|
|
|
|
|
if (!is_async) { |
|
|
|
|
|
// In synchronous GPU mode, block the caller until the command has executed
|
|
|
|
|
|
WaitIdle(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return fence; |
|
|
return fence; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|