mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 22:05:38 +00:00
GPUDevice: Add ExecuteAndWaitForGPUIdle()
This commit is contained in:
parent
9fcc98a60a
commit
3749b812a3
|
@ -466,6 +466,11 @@ std::string D3D11Device::GetDriverInfo() const
|
|||
return ret;
|
||||
}
|
||||
|
||||
void D3D11Device::ExecuteAndWaitForGPUIdle()
|
||||
{
|
||||
m_context->Flush();
|
||||
}
|
||||
|
||||
bool D3D11Device::CreateBuffers()
|
||||
{
|
||||
if (!m_vertex_buffer.Create(D3D11_BIND_VERTEX_BUFFER, VERTEX_BUFFER_SIZE, VERTEX_BUFFER_SIZE) ||
|
||||
|
|
|
@ -47,6 +47,8 @@ public:
|
|||
|
||||
std::string GetDriverInfo() const override;
|
||||
|
||||
void ExecuteAndWaitForGPUIdle() override;
|
||||
|
||||
std::unique_ptr<GPUTexture> CreateTexture(u32 width, u32 height, u32 layers, u32 levels, u32 samples,
|
||||
GPUTexture::Type type, GPUTexture::Format format,
|
||||
const void* data = nullptr, u32 data_stride = 0) override;
|
||||
|
|
|
@ -638,6 +638,14 @@ void D3D12Device::WaitForGPUIdle()
|
|||
}
|
||||
}
|
||||
|
||||
void D3D12Device::ExecuteAndWaitForGPUIdle()
|
||||
{
|
||||
if (InRenderPass())
|
||||
EndRenderPass();
|
||||
|
||||
SubmitCommandList(true);
|
||||
}
|
||||
|
||||
bool D3D12Device::CreateTimestampQuery()
|
||||
{
|
||||
constexpr u32 QUERY_COUNT = NUM_TIMESTAMP_QUERIES_PER_CMDLIST * NUM_COMMAND_LISTS;
|
||||
|
|
|
@ -68,6 +68,8 @@ public:
|
|||
|
||||
std::string GetDriverInfo() const override;
|
||||
|
||||
void ExecuteAndWaitForGPUIdle() override;
|
||||
|
||||
std::unique_ptr<GPUTexture> CreateTexture(u32 width, u32 height, u32 layers, u32 levels, u32 samples,
|
||||
GPUTexture::Type type, GPUTexture::Format format,
|
||||
const void* data = nullptr, u32 data_stride = 0) override;
|
||||
|
|
|
@ -612,6 +612,9 @@ public:
|
|||
|
||||
virtual std::string GetDriverInfo() const = 0;
|
||||
|
||||
// Executes current command buffer, waits for its completion, and destroys all pending resources.
|
||||
virtual void ExecuteAndWaitForGPUIdle() = 0;
|
||||
|
||||
virtual std::unique_ptr<GPUTexture> CreateTexture(u32 width, u32 height, u32 layers, u32 levels, u32 samples,
|
||||
GPUTexture::Type type, GPUTexture::Format format,
|
||||
const void* data = nullptr, u32 data_stride = 0) = 0;
|
||||
|
|
|
@ -208,6 +208,8 @@ public:
|
|||
|
||||
std::string GetDriverInfo() const override;
|
||||
|
||||
void ExecuteAndWaitForGPUIdle() override;
|
||||
|
||||
std::unique_ptr<GPUTexture> CreateTexture(u32 width, u32 height, u32 layers, u32 levels, u32 samples,
|
||||
GPUTexture::Type type, GPUTexture::Format format,
|
||||
const void* data = nullptr, u32 data_stride = 0) override;
|
||||
|
|
|
@ -2468,6 +2468,12 @@ void MetalDevice::WaitForPreviousCommandBuffers()
|
|||
WaitForFenceCounter(m_current_fence_counter - 1);
|
||||
}
|
||||
|
||||
void MetalDevice::ExecuteAndWaitForGPUIdle()
|
||||
{
|
||||
SubmitCommandBuffer(true);
|
||||
CleanupObjects();
|
||||
}
|
||||
|
||||
void MetalDevice::CleanupObjects()
|
||||
{
|
||||
const u64 counter = m_completed_fence_counter.load(std::memory_order_acquire);
|
||||
|
|
|
@ -582,6 +582,12 @@ std::string OpenGLDevice::GetDriverInfo() const
|
|||
gl_shading_language_version);
|
||||
}
|
||||
|
||||
void OpenGLDevice::ExecuteAndWaitForGPUIdle()
|
||||
{
|
||||
// Could be glFinish(), but I'm afraid for mobile drivers...
|
||||
glFlush();
|
||||
}
|
||||
|
||||
void OpenGLDevice::SetSwapInterval()
|
||||
{
|
||||
if (m_window_info.type == WindowInfo::Type::Surfaceless)
|
||||
|
|
|
@ -48,6 +48,8 @@ public:
|
|||
|
||||
std::string GetDriverInfo() const override;
|
||||
|
||||
void ExecuteAndWaitForGPUIdle() override;
|
||||
|
||||
std::unique_ptr<GPUTexture> CreateTexture(u32 width, u32 height, u32 layers, u32 levels, u32 samples,
|
||||
GPUTexture::Type type, GPUTexture::Format format,
|
||||
const void* data = nullptr, u32 data_stride = 0) override;
|
||||
|
|
|
@ -2370,6 +2370,14 @@ std::string VulkanDevice::GetDriverInfo() const
|
|||
return ret;
|
||||
}
|
||||
|
||||
void VulkanDevice::ExecuteAndWaitForGPUIdle()
|
||||
{
|
||||
if (InRenderPass())
|
||||
EndRenderPass();
|
||||
|
||||
SubmitCommandBuffer(true);
|
||||
}
|
||||
|
||||
void VulkanDevice::SetVSyncMode(GPUVSyncMode mode, bool allow_present_throttle)
|
||||
{
|
||||
m_allow_present_throttle = allow_present_throttle;
|
||||
|
|
|
@ -82,6 +82,8 @@ public:
|
|||
|
||||
std::string GetDriverInfo() const override;
|
||||
|
||||
void ExecuteAndWaitForGPUIdle() override;
|
||||
|
||||
std::unique_ptr<GPUTexture> CreateTexture(u32 width, u32 height, u32 layers, u32 levels, u32 samples,
|
||||
GPUTexture::Type type, GPUTexture::Format format,
|
||||
const void* data = nullptr, u32 data_stride = 0) override;
|
||||
|
|
Loading…
Reference in a new issue