diff --git a/src/nvofapi/nvofapi_d3d12_instance.cpp b/src/nvofapi/nvofapi_d3d12_instance.cpp index cc2b2e02..93a08f65 100644 --- a/src/nvofapi/nvofapi_d3d12_instance.cpp +++ b/src/nvofapi/nvofapi_d3d12_instance.cpp @@ -135,18 +135,18 @@ namespace dxvk { // Use vkd3d-proton's interop functionality to grab a VkCommandBuffer // that we record our commands into. Work submission and synchronization // happens using D3D12. - m_cmdLists[m_cmdListIndex]->Reset(m_cmdAllocator, nullptr); + m_cmdLists[m_cmdListIndex]->Reset(m_cmdAllocator.ptr(), nullptr); for (uint32_t i = 0; i < inParams->numFencePoints; i++) { m_commandQueue->Wait(inParams->fencePoint[i].fence, inParams->fencePoint[i].value); } VkCommandBuffer vkCmdBuf; - m_device->BeginVkCommandBufferInterop(m_cmdLists[m_cmdListIndex], &vkCmdBuf); + m_device->BeginVkCommandBufferInterop(m_cmdLists[m_cmdListIndex].ptr(), &vkCmdBuf); this->RecordCmdBuf(&vkInputParams, &vkOutputParams, vkCmdBuf); - m_device->EndVkCommandBufferInterop(m_cmdLists[m_cmdListIndex]); + m_device->EndVkCommandBufferInterop(m_cmdLists[m_cmdListIndex].ptr()); m_cmdLists[m_cmdListIndex]->Close(); m_commandQueue->ExecuteCommandLists(1, reinterpret_cast(&m_cmdLists[m_cmdListIndex])); diff --git a/src/nvofapi/nvofapi_d3d12_instance.h b/src/nvofapi/nvofapi_d3d12_instance.h index eacfb68c..0e719615 100644 --- a/src/nvofapi/nvofapi_d3d12_instance.h +++ b/src/nvofapi/nvofapi_d3d12_instance.h @@ -25,48 +25,27 @@ #include "../nvofapi_private.h" #include "nvofapi_instance.h" +#include "../util/com_pointer.h" namespace dxvk { class NvOFInstanceD3D12 : public NvOFInstance { public: NvOFInstanceD3D12(ID3D12Device* pD3D12Device); - - virtual ~NvOFInstanceD3D12() { - for (auto& cmdList : m_cmdLists) { - if (cmdList) - cmdList->Release(); - } - if (m_cmdAllocator) - m_cmdAllocator->Release(); - - if (m_commandQueue) - m_commandQueue->Release(); - - if (m_deviceExt) - m_deviceExt->Release(); - - if (m_d3ddevice) - m_d3ddevice->Release(); - - if (m_device) - m_device->Release(); - } - - void Execute(const NV_OF_EXECUTE_INPUT_PARAMS_D3D12* inParams, NV_OF_EXECUTE_OUTPUT_PARAMS_D3D12* outParams); + ~NvOFInstanceD3D12() override = default; bool Initialize(); - + void Execute(const NV_OF_EXECUTE_INPUT_PARAMS_D3D12* inParams, NV_OF_EXECUTE_OUTPUT_PARAMS_D3D12* outParams); void RegisterBuffer(const NV_OF_REGISTER_RESOURCE_PARAMS_D3D12* registerParams); private: - ID3D12DXVKInteropDevice1* m_device{}; - ID3D12DeviceExt* m_deviceExt{}; - ID3D12Device4* m_d3ddevice{}; - ID3D12CommandQueue* m_commandQueue{}; - std::array m_cmdLists{}; + Com m_device{}; + Com m_deviceExt{}; + Com m_d3ddevice{}; + Com m_commandQueue{}; + std::array, CMDS_IN_FLIGHT> m_cmdLists{}; uint32_t m_cmdListIndex{0}; - ID3D12CommandAllocator* m_cmdAllocator{}; + Com m_cmdAllocator{}; uint32_t m_vkQueueFamilyIndex{0}; };