From a08f9d089777011813b3625b9a3cff3484213ab9 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 18 Jul 2019 16:52:44 +0200 Subject: [PATCH] [dxvk] Implement device- and driver-specific performance hints These are meant to be read by the DxvkContext in order to choose a fast path for certasin operations. --- src/dxvk/dxvk_device.cpp | 9 +++++++++ src/dxvk/dxvk_device.h | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/dxvk/dxvk_device.cpp b/src/dxvk/dxvk_device.cpp index ad3000db0..a0de88384 100644 --- a/src/dxvk/dxvk_device.cpp +++ b/src/dxvk/dxvk_device.cpp @@ -16,6 +16,7 @@ namespace dxvk { m_extensions (extensions), m_features (features), m_properties (adapter->deviceProperties()), + m_perfHints (getPerfHints()), m_memory (new DxvkMemoryAllocator (this)), m_renderPassPool (new DxvkRenderPassPool (vkd)), m_pipelineManager (new DxvkPipelineManager (this, m_renderPassPool.ptr())), @@ -258,6 +259,14 @@ namespace dxvk { } + DxvkDevicePerfHints DxvkDevice::getPerfHints() { + DxvkDevicePerfHints hints; + hints.preferFbDepthStencilCopy = m_extensions.extShaderStencilExport + && m_adapter->matchesDriver(DxvkGpuVendor::Amd, VK_DRIVER_ID_MESA_RADV_KHR, 0, 0); + return hints; + } + + void DxvkDevice::recycleCommandList(const Rc& cmdList) { m_recycledCommandLists.returnObject(cmdList); } diff --git a/src/dxvk/dxvk_device.h b/src/dxvk/dxvk_device.h index bd6dfd089..6e62222b3 100644 --- a/src/dxvk/dxvk_device.h +++ b/src/dxvk/dxvk_device.h @@ -34,6 +34,13 @@ namespace dxvk { uint32_t maxNumDynamicUniformBuffers = 0; uint32_t maxNumDynamicStorageBuffers = 0; }; + + /** + * \brief Device performance hints + */ + struct DxvkDevicePerfHints { + VkBool32 preferFbDepthStencilCopy : 1; + }; /** * \brief Device queue @@ -168,6 +175,14 @@ namespace dxvk { * \returns Device options */ DxvkDeviceOptions options() const; + + /** + * \brief Retrieves performance hints + * \returns Device-specific perf hints + */ + DxvkDevicePerfHints perfHints() const { + return m_perfHints; + } /** * \brief Creates a command list @@ -417,6 +432,8 @@ namespace dxvk { DxvkDeviceFeatures m_features; VkPhysicalDeviceProperties m_properties; + DxvkDevicePerfHints m_perfHints; + Rc m_memory; Rc m_renderPassPool; Rc m_pipelineManager; @@ -441,6 +458,8 @@ namespace dxvk { DxvkRecycler m_recycledDescriptorPools; DxvkSubmissionQueue m_submissionQueue; + + DxvkDevicePerfHints getPerfHints(); void recycleCommandList( const Rc& cmdList);