diff --git a/Common/GPU/D3D11/thin3d_d3d11.cpp b/Common/GPU/D3D11/thin3d_d3d11.cpp index 58d5a59397..4a90c318c1 100644 --- a/Common/GPU/D3D11/thin3d_d3d11.cpp +++ b/Common/GPU/D3D11/thin3d_d3d11.cpp @@ -75,6 +75,10 @@ public: return (uint32_t)ShaderLanguage::HLSL_D3D11; } uint32_t GetDataFormatSupport(DataFormat fmt) const override; + PresentationMode GetPresentationMode() const override { + // TODO: Fix. Not yet used. + return PresentationMode::FIFO; + } InputLayout *CreateInputLayout(const InputLayoutDesc &desc) override; DepthStencilState *CreateDepthStencilState(const DepthStencilStateDesc &desc) override; diff --git a/Common/GPU/D3D9/thin3d_d3d9.cpp b/Common/GPU/D3D9/thin3d_d3d9.cpp index a560a78fe3..a817bebdf7 100644 --- a/Common/GPU/D3D9/thin3d_d3d9.cpp +++ b/Common/GPU/D3D9/thin3d_d3d9.cpp @@ -514,6 +514,10 @@ public: return (uint32_t)ShaderLanguage::HLSL_D3D9; } uint32_t GetDataFormatSupport(DataFormat fmt) const override; + PresentationMode GetPresentationMode() const override { + // TODO: Fix. Not yet used. + return PresentationMode::FIFO; + } ShaderModule *CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize, const char *tag) override; DepthStencilState *CreateDepthStencilState(const DepthStencilStateDesc &desc) override; diff --git a/Common/GPU/OpenGL/thin3d_gl.cpp b/Common/GPU/OpenGL/thin3d_gl.cpp index a4be2eca70..a50346f2b2 100644 --- a/Common/GPU/OpenGL/thin3d_gl.cpp +++ b/Common/GPU/OpenGL/thin3d_gl.cpp @@ -346,6 +346,11 @@ public: renderManager_.SetErrorCallback(callback, userdata); } + PresentationMode GetPresentationMode() const override { + // TODO: Fix. Not yet used. + return PresentationMode::FIFO; + } + DepthStencilState *CreateDepthStencilState(const DepthStencilStateDesc &desc) override; BlendState *CreateBlendState(const BlendStateDesc &desc) override; SamplerState *CreateSamplerState(const SamplerStateDesc &desc) override; diff --git a/Common/GPU/Vulkan/thin3d_vulkan.cpp b/Common/GPU/Vulkan/thin3d_vulkan.cpp index 47d42c9956..351fa38faf 100644 --- a/Common/GPU/Vulkan/thin3d_vulkan.cpp +++ b/Common/GPU/Vulkan/thin3d_vulkan.cpp @@ -398,6 +398,16 @@ public: } uint32_t GetDataFormatSupport(DataFormat fmt) const override; + PresentationMode GetPresentationMode() const override { + switch (vulkan_->GetPresentMode()) { + case VK_PRESENT_MODE_FIFO_KHR: return PresentationMode::FIFO; + case VK_PRESENT_MODE_FIFO_RELAXED_KHR: return PresentationMode::FIFO_RELAXED; + case VK_PRESENT_MODE_IMMEDIATE_KHR: return PresentationMode::IMMEDIATE; + case VK_PRESENT_MODE_MAILBOX_KHR: return PresentationMode::MAILBOX; + default: return PresentationMode::FIFO; + } + } + DepthStencilState *CreateDepthStencilState(const DepthStencilStateDesc &desc) override; BlendState *CreateBlendState(const BlendStateDesc &desc) override; InputLayout *CreateInputLayout(const InputLayoutDesc &desc) override; diff --git a/Common/GPU/thin3d.h b/Common/GPU/thin3d.h index ae3db6af00..5ccb236b07 100644 --- a/Common/GPU/thin3d.h +++ b/Common/GPU/thin3d.h @@ -652,6 +652,13 @@ enum class DebugFlags { }; ENUM_CLASS_BITOPS(DebugFlags); +enum class PresentationMode { + FIFO, + FIFO_RELAXED, + IMMEDIATE, + MAILBOX, +}; + class DrawContext { public: virtual ~DrawContext(); @@ -666,6 +673,8 @@ public: virtual std::vector GetExtensionList() const { return std::vector(); } virtual std::vector GetDeviceList() const { return std::vector(); } + virtual PresentationMode GetPresentationMode() const = 0; + // Describes the primary shader language that this implementation prefers. const ShaderLanguageDesc &GetShaderLanguageDesc() { return shaderLanguageDesc_; diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 3b85701a88..3ad5060da2 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -546,8 +546,12 @@ void __DisplayFlip(int cyclesLate) { bool duplicateFrames = g_Config.bRenderDuplicateFrames && g_Config.iFrameSkip == 0; bool fastForwardSkipFlip = g_Config.iFastForwardMode != (int)FastForwardMode::CONTINUOUS; - if (g_Config.bVSync && GetGPUBackend() == GPUBackend::VULKAN) { + + bool fifo = gpu && gpu->GetDrawContext() && gpu->GetDrawContext()->GetPresentationMode() == Draw::PresentationMode::FIFO; + + if (fifo && GetGPUBackend() == GPUBackend::VULKAN) { // Vulkan doesn't support the interval setting, so we force skipping the flip. + // TODO: We'll clean this up in a more backend-independent way later. fastForwardSkipFlip = true; }