GPUDevice: Remove BeginPresent() skip parameter

It wasn't used - System does its own present skipping.
This commit is contained in:
Stenzek 2024-09-07 12:53:55 +10:00
parent 4b0c1fdbf2
commit ac5a2a153a
No known key found for this signature in database
18 changed files with 30 additions and 55 deletions

View File

@ -2063,8 +2063,7 @@ GPUDevice::PresentResult GPU::RenderDisplay(GPUTexture* target, const GSVector4i
{
if (target)
g_gpu_device->SetRenderTarget(target);
else if (const GPUDevice::PresentResult pres = g_gpu_device->BeginPresent(false);
pres != GPUDevice::PresentResult::OK)
else if (const GPUDevice::PresentResult pres = g_gpu_device->BeginPresent(); pres != GPUDevice::PresentResult::OK)
return pres;
}

View File

@ -160,7 +160,7 @@ void Host::DisplayLoadingScreen(const char* message, int progress_min /*= -1*/,
// TODO: Glass effect or something.
if (g_gpu_device->BeginPresent(false) == GPUDevice::PresentResult::OK)
if (g_gpu_device->BeginPresent() == GPUDevice::PresentResult::OK)
{
g_gpu_device->RenderImGui();
g_gpu_device->EndPresent(false);

View File

@ -2166,7 +2166,7 @@ void System::FrameDone()
const bool explicit_present = (throttle_before_present && g_gpu_device->GetFeatures().explicit_present);
if (explicit_present)
{
const bool do_present = PresentDisplay(false, true);
const bool do_present = PresentDisplay(true);
Throttle(current_time);
if (do_present)
g_gpu_device->SubmitPresent();
@ -2176,7 +2176,7 @@ void System::FrameDone()
if (throttle_before_present)
Throttle(current_time);
PresentDisplay(false, false);
PresentDisplay(false);
if (!throttle_before_present && s_throttler_enabled && !IsExecutionInterrupted())
Throttle(current_time);
@ -5731,31 +5731,23 @@ void System::HostDisplayResized()
g_gpu->UpdateResolutionScale();
}
bool System::PresentDisplay(bool skip_present, bool explicit_present)
bool System::PresentDisplay(bool explicit_present)
{
// acquire for IO.MousePos.
std::atomic_thread_fence(std::memory_order_acquire);
if (!skip_present)
{
FullscreenUI::Render();
ImGuiManager::RenderTextOverlays();
ImGuiManager::RenderOSDMessages();
FullscreenUI::Render();
ImGuiManager::RenderTextOverlays();
ImGuiManager::RenderOSDMessages();
if (s_state == State::Running)
ImGuiManager::RenderSoftwareCursors();
}
if (s_state == State::Running)
ImGuiManager::RenderSoftwareCursors();
// Debug windows are always rendered, otherwise mouse input breaks on skip.
ImGuiManager::RenderOverlayWindows();
ImGuiManager::RenderDebugWindows();
GPUDevice::PresentResult pres;
if (g_gpu && !skip_present)
pres = g_gpu->PresentDisplay();
else
pres = g_gpu_device->BeginPresent(skip_present);
const GPUDevice::PresentResult pres = g_gpu ? g_gpu->PresentDisplay() : g_gpu_device->BeginPresent();
if (pres == GPUDevice::PresentResult::OK)
{
g_gpu_device->RenderImGui();
@ -5783,7 +5775,7 @@ bool System::PresentDisplay(bool skip_present, bool explicit_present)
void System::InvalidateDisplay()
{
PresentDisplay(false, false);
PresentDisplay(false);
if (g_gpu)
g_gpu->RestoreDeviceContext();

View File

@ -448,7 +448,7 @@ void RequestDisplaySize(float scale = 0.0f);
void HostDisplayResized();
/// Renders the display.
bool PresentDisplay(bool skip_present, bool explicit_present);
bool PresentDisplay(bool explicit_present);
void InvalidateDisplay();
//////////////////////////////////////////////////////////////////////////

View File

@ -1798,7 +1798,7 @@ void EmuThread::run()
System::Internal::IdlePollUpdate();
if (g_gpu_device)
{
System::PresentDisplay(false, false);
System::PresentDisplay(false);
if (!g_gpu_device->IsVSyncModeBlocking())
g_gpu_device->ThrottlePresentation();
}

View File

@ -639,11 +639,8 @@ void D3D11Device::SetVSyncMode(GPUVSyncMode mode, bool allow_present_throttle)
}
}
GPUDevice::PresentResult D3D11Device::BeginPresent(bool skip_present, u32 clear_color)
GPUDevice::PresentResult D3D11Device::BeginPresent(u32 clear_color)
{
if (skip_present)
return PresentResult::SkipPresent;
if (!m_swap_chain)
{
// Note: Really slow on Intel...

View File

@ -104,7 +104,7 @@ public:
bool SetGPUTimingEnabled(bool enabled) override;
float GetAndResetAccumulatedGPUTime() override;
PresentResult BeginPresent(bool skip_present, u32 clear_color) override;
PresentResult BeginPresent(u32 clear_color) override;
void EndPresent(bool explicit_present) override;
void SubmitPresent() override;

View File

@ -1123,7 +1123,7 @@ void D3D12Device::SetVSyncMode(GPUVSyncMode mode, bool allow_present_throttle)
}
}
GPUDevice::PresentResult D3D12Device::BeginPresent(bool frame_skip, u32 clear_color)
GPUDevice::PresentResult D3D12Device::BeginPresent(u32 clear_color)
{
if (InRenderPass())
EndRenderPass();
@ -1131,9 +1131,6 @@ GPUDevice::PresentResult D3D12Device::BeginPresent(bool frame_skip, u32 clear_co
if (m_device_was_lost) [[unlikely]]
return PresentResult::DeviceLost;
if (frame_skip)
return PresentResult::SkipPresent;
// If we're running surfaceless, kick the command buffer so we don't run out of descriptors.
if (!m_swap_chain)
{

View File

@ -126,7 +126,7 @@ public:
bool SetGPUTimingEnabled(bool enabled) override;
float GetAndResetAccumulatedGPUTime() override;
PresentResult BeginPresent(bool skip_present, u32 clear_color) override;
PresentResult BeginPresent(u32 clear_color) override;
void EndPresent(bool explicit_present) override;
void SubmitPresent() override;

View File

@ -709,7 +709,7 @@ public:
virtual void DrawIndexedWithBarrier(u32 index_count, u32 base_index, u32 base_vertex, DrawBarrier type) = 0;
/// Returns false if the window was completely occluded.
virtual PresentResult BeginPresent(bool skip_present, u32 clear_color = DEFAULT_CLEAR_COLOR) = 0;
virtual PresentResult BeginPresent(u32 clear_color = DEFAULT_CLEAR_COLOR) = 0;
virtual void EndPresent(bool explicit_submit) = 0;
virtual void SubmitPresent() = 0;

View File

@ -265,7 +265,7 @@ public:
void SetVSyncMode(GPUVSyncMode mode, bool allow_present_throttle) override;
PresentResult BeginPresent(bool skip_present, u32 clear_color) override;
PresentResult BeginPresent(u32 clear_color) override;
void EndPresent(bool explicit_submit) override;
void SubmitPresent() override;

View File

@ -2312,13 +2312,10 @@ id<MTLBlitCommandEncoder> MetalDevice::GetBlitEncoder(bool is_inline)
}
}
GPUDevice::PresentResult MetalDevice::BeginPresent(bool skip_present, u32 clear_color)
GPUDevice::PresentResult MetalDevice::BeginPresent(u32 clear_color)
{
@autoreleasepool
{
if (skip_present)
return PresentResult::SkipPresent;
if (m_layer == nil)
{
TrimTexturePool();

View File

@ -740,16 +740,12 @@ void OpenGLDevice::DestroyBuffers()
m_vertex_buffer.reset();
}
GPUDevice::PresentResult OpenGLDevice::BeginPresent(bool skip_present, u32 clear_color)
GPUDevice::PresentResult OpenGLDevice::BeginPresent(u32 clear_color)
{
if (skip_present || m_window_info.type == WindowInfo::Type::Surfaceless)
if (m_window_info.type == WindowInfo::Type::Surfaceless)
{
if (!skip_present)
{
glFlush();
TrimTexturePool();
}
glFlush();
TrimTexturePool();
return PresentResult::SkipPresent;
}

View File

@ -104,7 +104,7 @@ public:
void SetVSyncMode(GPUVSyncMode mode, bool allow_present_throttle) override;
PresentResult BeginPresent(bool skip_present, u32 clear_color) override;
PresentResult BeginPresent(u32 clear_color) override;
void EndPresent(bool explicit_present) override;
void SubmitPresent() override;

View File

@ -1784,7 +1784,7 @@ GPUDevice::PresentResult PostProcessing::ReShadeFXShader::Apply(GPUTexture* inpu
if (pass.render_targets.size() == 1 && pass.render_targets[0] == OUTPUT_COLOR_TEXTURE && !final_target)
{
// Special case: drawing to final buffer.
if (const GPUDevice::PresentResult pres = g_gpu_device->BeginPresent(false); pres != GPUDevice::PresentResult::OK)
if (const GPUDevice::PresentResult pres = g_gpu_device->BeginPresent(); pres != GPUDevice::PresentResult::OK)
{
GL_POP();
return pres;

View File

@ -177,7 +177,7 @@ GPUDevice::PresentResult PostProcessing::GLSLShader::Apply(GPUTexture* input_col
// Assumes final stage has been cleared already.
if (!final_target)
{
if (const GPUDevice::PresentResult pres = g_gpu_device->BeginPresent(false); pres != GPUDevice::PresentResult::OK)
if (const GPUDevice::PresentResult pres = g_gpu_device->BeginPresent(); pres != GPUDevice::PresentResult::OK)
return pres;
}
else

View File

@ -2342,7 +2342,7 @@ void VulkanDevice::SetVSyncMode(GPUVSyncMode mode, bool allow_present_throttle)
}
}
GPUDevice::PresentResult VulkanDevice::BeginPresent(bool frame_skip, u32 clear_color)
GPUDevice::PresentResult VulkanDevice::BeginPresent(u32 clear_color)
{
if (InRenderPass())
EndRenderPass();
@ -2350,9 +2350,6 @@ GPUDevice::PresentResult VulkanDevice::BeginPresent(bool frame_skip, u32 clear_c
if (m_device_was_lost) [[unlikely]]
return PresentResult::DeviceLost;
if (frame_skip)
return PresentResult::SkipPresent;
// If we're running surfaceless, kick the command buffer so we don't run out of descriptors.
if (!m_swap_chain)
{

View File

@ -142,7 +142,7 @@ public:
void SetVSyncMode(GPUVSyncMode mode, bool allow_present_throttle) override;
PresentResult BeginPresent(bool skip_present, u32 clear_color) override;
PresentResult BeginPresent(u32 clear_color) override;
void EndPresent(bool explicit_present) override;
void SubmitPresent() override;