mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-07 12:05:52 +00:00
GPU: Ensure batches are flushed before presenting frame
Fixes occasional assertion failing when using the debugger.
This commit is contained in:
parent
dc9cdddd4c
commit
cae1ddc971
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user