From 69d562e701dd96e44c4c364049b1fc74890a2612 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 28 Oct 2024 13:14:40 +0100 Subject: [PATCH] [dxvk] Refactor command buffer allocation --- src/dxvk/dxvk_cmdlist.cpp | 41 +++++----- src/dxvk/dxvk_cmdlist.h | 155 +++++++++++++++++++------------------- 2 files changed, 98 insertions(+), 98 deletions(-) diff --git a/src/dxvk/dxvk_cmdlist.cpp b/src/dxvk/dxvk_cmdlist.cpp index 08356843..b0f4b0fe 100644 --- a/src/dxvk/dxvk_cmdlist.cpp +++ b/src/dxvk/dxvk_cmdlist.cpp @@ -226,7 +226,7 @@ namespace dxvk { // Execute transfer command buffer, if any if (cmd.usedFlags.test(DxvkCmdBuffer::SdmaBuffer)) - m_commandSubmission.executeCommandBuffer(cmd.sdmaBuffer); + m_commandSubmission.executeCommandBuffer(cmd.cmdBuffers[uint32_t(DxvkCmdBuffer::SdmaBuffer)]); // If we had either a transfer command or a semaphore wait, submit to the // transfer queue so that all subsequent commands get stalled as necessary. @@ -250,10 +250,10 @@ namespace dxvk { // Submit graphics commands if (cmd.usedFlags.test(DxvkCmdBuffer::InitBuffer)) - m_commandSubmission.executeCommandBuffer(cmd.initBuffer); + m_commandSubmission.executeCommandBuffer(cmd.cmdBuffers[uint32_t(DxvkCmdBuffer::InitBuffer)]); if (cmd.usedFlags.test(DxvkCmdBuffer::ExecBuffer)) - m_commandSubmission.executeCommandBuffer(cmd.execBuffer); + m_commandSubmission.executeCommandBuffer(cmd.cmdBuffers[uint32_t(DxvkCmdBuffer::ExecBuffer)]); if (isLast) { // Signal per-command list semaphores on the final submission @@ -306,9 +306,8 @@ namespace dxvk { m_cmd = DxvkCommandSubmissionInfo(); // Grab a fresh set of command buffers from the pools - m_cmd.execBuffer = m_graphicsPool->getCommandBuffer(); - m_cmd.initBuffer = m_graphicsPool->getCommandBuffer(); - m_cmd.sdmaBuffer = m_transferPool->getCommandBuffer(); + for (uint32_t i = 0; i < m_cmd.cmdBuffers.size(); i++) + m_cmd.cmdBuffers[i] = allocateCommandBuffer(DxvkCmdBuffer(i)); } @@ -318,9 +317,8 @@ namespace dxvk { // For consistency, end all command buffers here, // regardless of whether they have been used. - this->endCommandBuffer(m_cmd.execBuffer); - this->endCommandBuffer(m_cmd.initBuffer); - this->endCommandBuffer(m_cmd.sdmaBuffer); + for (uint32_t i = 0; i < m_cmd.cmdBuffers.size(); i++) + endCommandBuffer(m_cmd.cmdBuffers[i]); // Reset all command buffer handles m_cmd = DxvkCommandSubmissionInfo(); @@ -336,19 +334,11 @@ namespace dxvk { m_cmdSubmissions.push_back(m_cmd); // Only replace used command buffer to save resources - if (m_cmd.usedFlags.test(DxvkCmdBuffer::ExecBuffer)) { - this->endCommandBuffer(m_cmd.execBuffer); - m_cmd.execBuffer = m_graphicsPool->getCommandBuffer(); - } - - if (m_cmd.usedFlags.test(DxvkCmdBuffer::InitBuffer)) { - this->endCommandBuffer(m_cmd.initBuffer); - m_cmd.initBuffer = m_graphicsPool->getCommandBuffer(); - } - - if (m_cmd.usedFlags.test(DxvkCmdBuffer::SdmaBuffer)) { - this->endCommandBuffer(m_cmd.sdmaBuffer); - m_cmd.sdmaBuffer = m_transferPool->getCommandBuffer(); + for (uint32_t i = 0; i < m_cmd.cmdBuffers.size(); i++) { + if (m_cmd.usedFlags.test(DxvkCmdBuffer(i))) { + endCommandBuffer(m_cmd.cmdBuffers[i]); + m_cmd.cmdBuffers[i] = allocateCommandBuffer(DxvkCmdBuffer(i)); + } } m_cmd.syncSdma = VK_FALSE; @@ -399,4 +389,11 @@ namespace dxvk { throw DxvkError("DxvkCommandList: Failed to end command buffer"); } + + VkCommandBuffer DxvkCommandList::allocateCommandBuffer(DxvkCmdBuffer type) { + return type == DxvkCmdBuffer::SdmaBuffer + ? m_transferPool->getCommandBuffer() + : m_graphicsPool->getCommandBuffer(); + } + } diff --git a/src/dxvk/dxvk_cmdlist.h b/src/dxvk/dxvk_cmdlist.h index 86344a10..169e536f 100644 --- a/src/dxvk/dxvk_cmdlist.h +++ b/src/dxvk/dxvk_cmdlist.h @@ -45,9 +45,11 @@ namespace dxvk { * the command buffers need to be submitted. */ enum class DxvkCmdBuffer : uint32_t { - InitBuffer = 0, - ExecBuffer = 1, - SdmaBuffer = 2, + ExecBuffer, + InitBuffer, + SdmaBuffer, + + Count }; using DxvkCmdBufferFlags = Flags; @@ -138,11 +140,10 @@ namespace dxvk { struct DxvkCommandSubmissionInfo { DxvkCmdBufferFlags usedFlags = 0; VkBool32 syncSdma = VK_FALSE; - VkCommandBuffer execBuffer = VK_NULL_HANDLE; - VkCommandBuffer initBuffer = VK_NULL_HANDLE; - VkCommandBuffer sdmaBuffer = VK_NULL_HANDLE; VkBool32 sparseBind = VK_FALSE; uint32_t sparseCmd = 0; + + std::array cmdBuffers = { }; }; @@ -404,8 +405,7 @@ namespace dxvk { VkQueryControlFlags flags) { m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer); - m_vkd->vkCmdBeginQuery(m_cmd.execBuffer, - queryPool, query, flags); + m_vkd->vkCmdBeginQuery(getCmdBuffer(), queryPool, query, flags); } @@ -416,8 +416,8 @@ namespace dxvk { uint32_t index) { m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer); - m_vkd->vkCmdBeginQueryIndexedEXT( - m_cmd.execBuffer, queryPool, query, flags, index); + m_vkd->vkCmdBeginQueryIndexedEXT(getCmdBuffer(), + queryPool, query, flags, index); } @@ -425,7 +425,7 @@ namespace dxvk { const VkRenderingInfo* pRenderingInfo) { m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer); - m_vkd->vkCmdBeginRendering(m_cmd.execBuffer, pRenderingInfo); + m_vkd->vkCmdBeginRendering(getCmdBuffer(), pRenderingInfo); } @@ -434,7 +434,7 @@ namespace dxvk { uint32_t bufferCount, const VkBuffer* counterBuffers, const VkDeviceSize* counterOffsets) { - m_vkd->vkCmdBeginTransformFeedbackEXT(m_cmd.execBuffer, + m_vkd->vkCmdBeginTransformFeedbackEXT(getCmdBuffer(), firstBuffer, bufferCount, counterBuffers, counterOffsets); } @@ -471,7 +471,7 @@ namespace dxvk { VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) { - m_vkd->vkCmdBindIndexBuffer(m_cmd.execBuffer, + m_vkd->vkCmdBindIndexBuffer(getCmdBuffer(), buffer, offset, indexType); } @@ -481,7 +481,7 @@ namespace dxvk { VkDeviceSize offset, VkDeviceSize size, VkIndexType indexType) { - m_vkd->vkCmdBindIndexBuffer2KHR(m_cmd.execBuffer, + m_vkd->vkCmdBindIndexBuffer2KHR(getCmdBuffer(), buffer, offset, size, indexType); } @@ -501,7 +501,7 @@ namespace dxvk { const VkBuffer* pBuffers, const VkDeviceSize* pOffsets, const VkDeviceSize* pSizes) { - m_vkd->vkCmdBindTransformFeedbackBuffersEXT(m_cmd.execBuffer, + m_vkd->vkCmdBindTransformFeedbackBuffersEXT(getCmdBuffer(), firstBinding, bindingCount, pBuffers, pOffsets, pSizes); } @@ -513,7 +513,7 @@ namespace dxvk { const VkDeviceSize* pOffsets, const VkDeviceSize* pSizes, const VkDeviceSize* pStrides) { - m_vkd->vkCmdBindVertexBuffers2(m_cmd.execBuffer, + m_vkd->vkCmdBindVertexBuffers2(getCmdBuffer(), firstBinding, bindingCount, pBuffers, pOffsets, pSizes, pStrides); } @@ -521,7 +521,7 @@ namespace dxvk { void cmdLaunchCuKernel(VkCuLaunchInfoNVX launchInfo) { m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer); - m_vkd->vkCmdCuLaunchKernelNVX(m_cmd.execBuffer, &launchInfo); + m_vkd->vkCmdCuLaunchKernelNVX(getCmdBuffer(), &launchInfo); } @@ -529,7 +529,7 @@ namespace dxvk { const VkBlitImageInfo2* pBlitInfo) { m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer); - m_vkd->vkCmdBlitImage2(m_cmd.execBuffer, pBlitInfo); + m_vkd->vkCmdBlitImage2(getCmdBuffer(), pBlitInfo); } @@ -538,9 +538,8 @@ namespace dxvk { const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects) { - m_vkd->vkCmdClearAttachments(m_cmd.execBuffer, - attachmentCount, pAttachments, - rectCount, pRects); + m_vkd->vkCmdClearAttachments(getCmdBuffer(), + attachmentCount, pAttachments, rectCount, pRects); } @@ -653,7 +652,7 @@ namespace dxvk { uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) { - m_vkd->vkCmdDraw(m_cmd.execBuffer, + m_vkd->vkCmdDraw(getCmdBuffer(), vertexCount, instanceCount, firstVertex, firstInstance); } @@ -664,7 +663,7 @@ namespace dxvk { VkDeviceSize offset, uint32_t drawCount, uint32_t stride) { - m_vkd->vkCmdDrawIndirect(m_cmd.execBuffer, + m_vkd->vkCmdDrawIndirect(getCmdBuffer(), buffer, offset, drawCount, stride); } @@ -676,7 +675,7 @@ namespace dxvk { VkDeviceSize countOffset, uint32_t maxDrawCount, uint32_t stride) { - m_vkd->vkCmdDrawIndirectCount(m_cmd.execBuffer, + m_vkd->vkCmdDrawIndirectCount(getCmdBuffer(), buffer, offset, countBuffer, countOffset, maxDrawCount, stride); } @@ -687,7 +686,7 @@ namespace dxvk { uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) { - m_vkd->vkCmdDrawIndexed(m_cmd.execBuffer, + m_vkd->vkCmdDrawIndexed(getCmdBuffer(), indexCount, instanceCount, firstIndex, vertexOffset, firstInstance); @@ -699,7 +698,7 @@ namespace dxvk { VkDeviceSize offset, uint32_t drawCount, uint32_t stride) { - m_vkd->vkCmdDrawIndexedIndirect(m_cmd.execBuffer, + m_vkd->vkCmdDrawIndexedIndirect(getCmdBuffer(), buffer, offset, drawCount, stride); } @@ -711,7 +710,7 @@ namespace dxvk { VkDeviceSize countOffset, uint32_t maxDrawCount, uint32_t stride) { - m_vkd->vkCmdDrawIndexedIndirectCount(m_cmd.execBuffer, + m_vkd->vkCmdDrawIndexedIndirectCount(getCmdBuffer(), buffer, offset, countBuffer, countOffset, maxDrawCount, stride); } @@ -723,7 +722,7 @@ namespace dxvk { VkDeviceSize counterBufferOffset, uint32_t counterOffset, uint32_t vertexStride) { - m_vkd->vkCmdDrawIndirectByteCountEXT(m_cmd.execBuffer, + m_vkd->vkCmdDrawIndirectByteCountEXT(getCmdBuffer(), instanceCount, firstInstance, counterBuffer, counterBufferOffset, counterOffset, vertexStride); } @@ -732,7 +731,7 @@ namespace dxvk { void cmdEndQuery( VkQueryPool queryPool, uint32_t query) { - m_vkd->vkCmdEndQuery(m_cmd.execBuffer, queryPool, query); + m_vkd->vkCmdEndQuery(getCmdBuffer(), queryPool, query); } @@ -740,13 +739,13 @@ namespace dxvk { VkQueryPool queryPool, uint32_t query, uint32_t index) { - m_vkd->vkCmdEndQueryIndexedEXT( - m_cmd.execBuffer, queryPool, query, index); + m_vkd->vkCmdEndQueryIndexedEXT(getCmdBuffer(), + queryPool, query, index); } void cmdEndRendering() { - m_vkd->vkCmdEndRendering(m_cmd.execBuffer); + m_vkd->vkCmdEndRendering(getCmdBuffer()); } @@ -755,7 +754,7 @@ namespace dxvk { uint32_t bufferCount, const VkBuffer* counterBuffers, const VkDeviceSize* counterOffsets) { - m_vkd->vkCmdEndTransformFeedbackEXT(m_cmd.execBuffer, + m_vkd->vkCmdEndTransformFeedbackEXT(getCmdBuffer(), firstBuffer, bufferCount, counterBuffers, counterOffsets); } @@ -810,7 +809,7 @@ namespace dxvk { const VkResolveImageInfo2* resolveInfo) { m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer); - m_vkd->vkCmdResolveImage2(m_cmd.execBuffer, resolveInfo); + m_vkd->vkCmdResolveImage2(getCmdBuffer(), resolveInfo); } @@ -829,24 +828,24 @@ namespace dxvk { void cmdSetAlphaToCoverageState( VkBool32 alphaToCoverageEnable) { - m_vkd->vkCmdSetAlphaToCoverageEnableEXT(m_cmd.execBuffer, alphaToCoverageEnable); + m_vkd->vkCmdSetAlphaToCoverageEnableEXT(getCmdBuffer(), alphaToCoverageEnable); } void cmdSetBlendConstants(const float blendConstants[4]) { - m_vkd->vkCmdSetBlendConstants(m_cmd.execBuffer, blendConstants); + m_vkd->vkCmdSetBlendConstants(getCmdBuffer(), blendConstants); } void cmdSetDepthBiasState( VkBool32 depthBiasEnable) { - m_vkd->vkCmdSetDepthBiasEnable(m_cmd.execBuffer, depthBiasEnable); + m_vkd->vkCmdSetDepthBiasEnable(getCmdBuffer(), depthBiasEnable); } void cmdSetDepthClipState( VkBool32 depthClipEnable) { - m_vkd->vkCmdSetDepthClipEnableEXT(m_cmd.execBuffer, depthClipEnable); + m_vkd->vkCmdSetDepthClipEnableEXT(getCmdBuffer(), depthClipEnable); } @@ -854,7 +853,7 @@ namespace dxvk { float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor) { - m_vkd->vkCmdSetDepthBias(m_cmd.execBuffer, + m_vkd->vkCmdSetDepthBias(getCmdBuffer(), depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); @@ -863,14 +862,14 @@ namespace dxvk { void cmdSetDepthBias2( const VkDepthBiasInfoEXT *depthBiasInfo) { - m_vkd->vkCmdSetDepthBias2EXT(m_cmd.execBuffer, depthBiasInfo); + m_vkd->vkCmdSetDepthBias2EXT(getCmdBuffer(), depthBiasInfo); } void cmdSetDepthBounds( float minDepthBounds, float maxDepthBounds) { - m_vkd->vkCmdSetDepthBounds(m_cmd.execBuffer, + m_vkd->vkCmdSetDepthBounds(getCmdBuffer(), minDepthBounds, maxDepthBounds); } @@ -878,7 +877,7 @@ namespace dxvk { void cmdSetDepthBoundsState( VkBool32 depthBoundsTestEnable) { - m_vkd->vkCmdSetDepthBoundsTestEnable(m_cmd.execBuffer, depthBoundsTestEnable); + m_vkd->vkCmdSetDepthBoundsTestEnable(getCmdBuffer(), depthBoundsTestEnable); } @@ -886,14 +885,15 @@ namespace dxvk { VkBool32 depthTestEnable, VkBool32 depthWriteEnable, VkCompareOp depthCompareOp) { - m_vkd->vkCmdSetDepthTestEnable(m_cmd.execBuffer, depthTestEnable); + VkCommandBuffer cmdBuffer = getCmdBuffer(); + m_vkd->vkCmdSetDepthTestEnable(cmdBuffer, depthTestEnable); if (depthTestEnable) { - m_vkd->vkCmdSetDepthWriteEnable(m_cmd.execBuffer, depthWriteEnable); - m_vkd->vkCmdSetDepthCompareOp(m_cmd.execBuffer, depthCompareOp); + m_vkd->vkCmdSetDepthWriteEnable(cmdBuffer, depthWriteEnable); + m_vkd->vkCmdSetDepthCompareOp(cmdBuffer, depthCompareOp); } else { - m_vkd->vkCmdSetDepthWriteEnable(m_cmd.execBuffer, VK_FALSE); - m_vkd->vkCmdSetDepthCompareOp(m_cmd.execBuffer, VK_COMPARE_OP_ALWAYS); + m_vkd->vkCmdSetDepthWriteEnable(cmdBuffer, VK_FALSE); + m_vkd->vkCmdSetDepthCompareOp(cmdBuffer, VK_COMPARE_OP_ALWAYS); } } @@ -903,31 +903,34 @@ namespace dxvk { const VkDependencyInfo* dependencyInfo) { m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer); - m_vkd->vkCmdSetEvent2(m_cmd.execBuffer, event, dependencyInfo); + m_vkd->vkCmdSetEvent2(getCmdBuffer(), event, dependencyInfo); } void cmdSetMultisampleState( VkSampleCountFlagBits sampleCount, VkSampleMask sampleMask) { - m_vkd->vkCmdSetRasterizationSamplesEXT(m_cmd.execBuffer, sampleCount); - m_vkd->vkCmdSetSampleMaskEXT(m_cmd.execBuffer, sampleCount, &sampleMask); + VkCommandBuffer cmdBuffer = getCmdBuffer(); + + m_vkd->vkCmdSetRasterizationSamplesEXT(cmdBuffer, sampleCount); + m_vkd->vkCmdSetSampleMaskEXT(cmdBuffer, sampleCount, &sampleMask); } void cmdSetRasterizerState( VkCullModeFlags cullMode, VkFrontFace frontFace) { - m_vkd->vkCmdSetCullMode(m_cmd.execBuffer, cullMode); - m_vkd->vkCmdSetFrontFace(m_cmd.execBuffer, frontFace); + VkCommandBuffer cmdBuffer = getCmdBuffer(); + + m_vkd->vkCmdSetCullMode(cmdBuffer, cullMode); + m_vkd->vkCmdSetFrontFace(cmdBuffer, frontFace); } void cmdSetScissor( uint32_t scissorCount, const VkRect2D* scissors) { - m_vkd->vkCmdSetScissorWithCount( - m_cmd.execBuffer, scissorCount, scissors); + m_vkd->vkCmdSetScissorWithCount(getCmdBuffer(), scissorCount, scissors); } @@ -935,33 +938,35 @@ namespace dxvk { VkBool32 enableStencilTest, const VkStencilOpState& front, const VkStencilOpState& back) { + VkCommandBuffer cmdBuffer = getCmdBuffer(); + m_vkd->vkCmdSetStencilTestEnable( - m_cmd.execBuffer, enableStencilTest); + cmdBuffer, enableStencilTest); if (enableStencilTest) { - m_vkd->vkCmdSetStencilOp(m_cmd.execBuffer, + m_vkd->vkCmdSetStencilOp(cmdBuffer, VK_STENCIL_FACE_FRONT_BIT, front.failOp, front.passOp, front.depthFailOp, front.compareOp); - m_vkd->vkCmdSetStencilCompareMask(m_cmd.execBuffer, + m_vkd->vkCmdSetStencilCompareMask(cmdBuffer, VK_STENCIL_FACE_FRONT_BIT, front.compareMask); - m_vkd->vkCmdSetStencilWriteMask(m_cmd.execBuffer, + m_vkd->vkCmdSetStencilWriteMask(cmdBuffer, VK_STENCIL_FACE_FRONT_BIT, front.writeMask); - m_vkd->vkCmdSetStencilOp(m_cmd.execBuffer, + m_vkd->vkCmdSetStencilOp(cmdBuffer, VK_STENCIL_FACE_BACK_BIT, back.failOp, back.passOp, back.depthFailOp, back.compareOp); - m_vkd->vkCmdSetStencilCompareMask(m_cmd.execBuffer, + m_vkd->vkCmdSetStencilCompareMask(cmdBuffer, VK_STENCIL_FACE_BACK_BIT, back.compareMask); - m_vkd->vkCmdSetStencilWriteMask(m_cmd.execBuffer, + m_vkd->vkCmdSetStencilWriteMask(cmdBuffer, VK_STENCIL_FACE_BACK_BIT, back.writeMask); } else { - m_vkd->vkCmdSetStencilOp(m_cmd.execBuffer, + m_vkd->vkCmdSetStencilOp(cmdBuffer, VK_STENCIL_FACE_FRONT_AND_BACK, VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_COMPARE_OP_ALWAYS); - m_vkd->vkCmdSetStencilCompareMask(m_cmd.execBuffer, + m_vkd->vkCmdSetStencilCompareMask(cmdBuffer, VK_STENCIL_FACE_FRONT_AND_BACK, 0x0); - m_vkd->vkCmdSetStencilWriteMask(m_cmd.execBuffer, + m_vkd->vkCmdSetStencilWriteMask(cmdBuffer, VK_STENCIL_FACE_FRONT_AND_BACK, 0x0); } } @@ -970,7 +975,7 @@ namespace dxvk { void cmdSetStencilReference( VkStencilFaceFlags faceMask, uint32_t reference) { - m_vkd->vkCmdSetStencilReference(m_cmd.execBuffer, + m_vkd->vkCmdSetStencilReference(getCmdBuffer(), faceMask, reference); } @@ -978,15 +983,14 @@ namespace dxvk { void cmdSetStencilWriteMask( VkStencilFaceFlags faceMask, uint32_t writeMask) { - m_vkd->vkCmdSetStencilWriteMask(m_cmd.execBuffer, faceMask, writeMask); + m_vkd->vkCmdSetStencilWriteMask(getCmdBuffer(), faceMask, writeMask); } void cmdSetViewport( uint32_t viewportCount, const VkViewport* viewports) { - m_vkd->vkCmdSetViewportWithCount( - m_cmd.execBuffer, viewportCount, viewports); + m_vkd->vkCmdSetViewportWithCount(getCmdBuffer(), viewportCount, viewports); } @@ -1006,14 +1010,14 @@ namespace dxvk { VkDebugUtilsLabelEXT* pLabelInfo) { m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer); - m_vki->vkCmdBeginDebugUtilsLabelEXT(m_cmd.execBuffer, pLabelInfo); + m_vki->vkCmdBeginDebugUtilsLabelEXT(getCmdBuffer(), pLabelInfo); } void cmdEndDebugUtilsLabel() { m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer); - m_vki->vkCmdEndDebugUtilsLabelEXT(m_cmd.execBuffer); + m_vki->vkCmdEndDebugUtilsLabelEXT(getCmdBuffer()); } @@ -1021,7 +1025,7 @@ namespace dxvk { VkDebugUtilsLabelEXT* pLabelInfo) { m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer); - m_vki->vkCmdInsertDebugUtilsLabelEXT(m_cmd.execBuffer, pLabelInfo); + m_vki->vkCmdInsertDebugUtilsLabelEXT(getCmdBuffer(), pLabelInfo); } @@ -1098,11 +1102,8 @@ namespace dxvk { std::vector m_pipelines; - VkCommandBuffer getCmdBuffer(DxvkCmdBuffer cmdBuffer) const { - if (cmdBuffer == DxvkCmdBuffer::ExecBuffer) return m_cmd.execBuffer; - if (cmdBuffer == DxvkCmdBuffer::InitBuffer) return m_cmd.initBuffer; - if (cmdBuffer == DxvkCmdBuffer::SdmaBuffer) return m_cmd.sdmaBuffer; - return VK_NULL_HANDLE; + force_inline VkCommandBuffer getCmdBuffer(DxvkCmdBuffer cmdBuffer = DxvkCmdBuffer::ExecBuffer) const { + return m_cmd.cmdBuffers[uint32_t(cmdBuffer)]; } DxvkSparseBindSubmission& getSparseBindSubmission() { @@ -1117,6 +1118,8 @@ namespace dxvk { void endCommandBuffer(VkCommandBuffer cmdBuffer); + VkCommandBuffer allocateCommandBuffer(DxvkCmdBuffer type); + }; }