diff --git a/src/core/gpu_backend.h b/src/core/gpu_backend.h index 223a44da1..230c8297f 100644 --- a/src/core/gpu_backend.h +++ b/src/core/gpu_backend.h @@ -90,6 +90,9 @@ public: // TODO: replace with "invalidate cached state" virtual void RestoreDeviceContext() = 0; + /// Ensures all pending draws are flushed to the host GPU. + virtual void FlushRender() = 0; + /// Main command handler for GPU thread. void HandleCommand(const GPUThreadCommand* cmd); @@ -140,9 +143,6 @@ protected: virtual bool AllocateMemorySaveState(System::MemorySaveState& mss, Error* error) = 0; virtual void DoMemoryState(StateWrapper& sw, System::MemorySaveState& mss) = 0; - /// Ensures all pending draws are flushed to the host GPU. - virtual void FlushRender() = 0; - /// Helper function for computing the draw rectangle in a larger window. void CalculateDrawRect(s32 window_width, s32 window_height, bool apply_rotation, bool apply_aspect_ratio, GSVector4i* display_rect, GSVector4i* draw_rect) const; diff --git a/src/core/gpu_hw.h b/src/core/gpu_hw.h index fb598bb42..6f8827f9c 100644 --- a/src/core/gpu_hw.h +++ b/src/core/gpu_hw.h @@ -71,6 +71,7 @@ public: u32 GetResolutionScale() const override; void RestoreDeviceContext() override; + void FlushRender() override; protected: void UpdateSettings(const GPUSettings& old_settings) override; @@ -91,7 +92,6 @@ protected: void DrawLine(const GPUBackendDrawLineCommand* cmd) override; void DrawPreciseLine(const GPUBackendDrawPreciseLineCommand* cmd) override; - void FlushRender() override; void DrawingAreaChanged() override; void ClearVRAM() override; diff --git a/src/core/gpu_sw.h b/src/core/gpu_sw.h index f3801441e..9eb9a89a8 100644 --- a/src/core/gpu_sw.h +++ b/src/core/gpu_sw.h @@ -23,6 +23,7 @@ public: bool Initialize(bool upload_vram, Error* error) override; void RestoreDeviceContext() override; + void FlushRender() override; u32 GetResolutionScale() const override; @@ -46,8 +47,6 @@ protected: void ClearVRAM() override; - void FlushRender() override; - void UpdateResolutionScale() override; void LoadState(const GPUBackendLoadStateCommand* cmd) override; diff --git a/src/core/gpu_thread.cpp b/src/core/gpu_thread.cpp index fa2fe9cda..de22247ff 100644 --- a/src/core/gpu_thread.cpp +++ b/src/core/gpu_thread.cpp @@ -1215,6 +1215,9 @@ void GPUThread::SleepUntilPresentTime(Timer::Value present_time) void GPUThread::Internal::PresentFrame(bool allow_skip_present, u64 present_time) { + if (s_state.gpu_backend) + s_state.gpu_backend->FlushRender(); + const bool skip_present = (!g_gpu_device->HasMainSwapChain() || (allow_skip_present && g_gpu_device->GetMainSwapChain()->ShouldSkipPresentingFrame() && s_state.skipped_present_count < MAX_SKIPPED_PRESENT_COUNT));