From 9024f8bb2c1c4e2a19d99becf861f9fcc8e9ca86 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 8 Jan 2018 14:21:50 +0100 Subject: [PATCH] [dxvk] Inlined all frequently called DxvkCmdList methods --- src/dxvk/dxvk_cmdlist.cpp | 251 -------------------------------------- src/dxvk/dxvk_cmdlist.h | 160 ++++++++++++++++++++---- 2 files changed, 134 insertions(+), 277 deletions(-) diff --git a/src/dxvk/dxvk_cmdlist.cpp b/src/dxvk/dxvk_cmdlist.cpp index 23808fd04..5018f5ab7 100644 --- a/src/dxvk/dxvk_cmdlist.cpp +++ b/src/dxvk/dxvk_cmdlist.cpp @@ -81,11 +81,6 @@ namespace dxvk { } - void DxvkCommandList::trackResource(const Rc& rc) { - m_resources.trackResource(rc); - } - - void DxvkCommandList::reset() { m_stagingAlloc.reset(); m_descAlloc.reset(); @@ -136,252 +131,6 @@ namespace dxvk { } - void DxvkCommandList::cmdBeginRenderPass( - const VkRenderPassBeginInfo* pRenderPassBegin, - VkSubpassContents contents) { - m_vkd->vkCmdBeginRenderPass(m_buffer, - pRenderPassBegin, contents); - } - - - void DxvkCommandList::cmdBindIndexBuffer( - VkBuffer buffer, - VkDeviceSize offset, - VkIndexType indexType) { - m_vkd->vkCmdBindIndexBuffer(m_buffer, - buffer, offset, indexType); - } - - - void DxvkCommandList::cmdBindPipeline( - VkPipelineBindPoint pipelineBindPoint, - VkPipeline pipeline) { - m_vkd->vkCmdBindPipeline(m_buffer, - pipelineBindPoint, pipeline); - } - - - void DxvkCommandList::cmdBindVertexBuffers( - uint32_t firstBinding, - uint32_t bindingCount, - const VkBuffer* pBuffers, - const VkDeviceSize* pOffsets) { - m_vkd->vkCmdBindVertexBuffers(m_buffer, - firstBinding, bindingCount, pBuffers, pOffsets); - } - - - void DxvkCommandList::cmdClearAttachments( - uint32_t attachmentCount, - const VkClearAttachment* pAttachments, - uint32_t rectCount, - const VkClearRect* pRects) { - m_vkd->vkCmdClearAttachments(m_buffer, - attachmentCount, pAttachments, - rectCount, pRects); - } - - - void DxvkCommandList::cmdClearColorImage( - VkImage image, - VkImageLayout imageLayout, - const VkClearColorValue* pColor, - uint32_t rangeCount, - const VkImageSubresourceRange* pRanges) { - m_vkd->vkCmdClearColorImage(m_buffer, - image, imageLayout, pColor, - rangeCount, pRanges); - } - - - void DxvkCommandList::cmdClearDepthStencilImage( - VkImage image, - VkImageLayout imageLayout, - const VkClearDepthStencilValue* pDepthStencil, - uint32_t rangeCount, - const VkImageSubresourceRange* pRanges) { - m_vkd->vkCmdClearDepthStencilImage(m_buffer, - image, imageLayout, pDepthStencil, - rangeCount, pRanges); - } - - - void DxvkCommandList::cmdCopyBuffer( - VkBuffer srcBuffer, - VkBuffer dstBuffer, - uint32_t regionCount, - const VkBufferCopy* pRegions) { - m_vkd->vkCmdCopyBuffer(m_buffer, - srcBuffer, dstBuffer, - regionCount, pRegions); - } - - - void DxvkCommandList::cmdCopyBufferToImage( - VkBuffer srcBuffer, - VkImage dstImage, - VkImageLayout dstImageLayout, - uint32_t regionCount, - const VkBufferImageCopy* pRegions) { - m_vkd->vkCmdCopyBufferToImage(m_buffer, - srcBuffer, dstImage, dstImageLayout, - regionCount, pRegions); - } - - - void DxvkCommandList::cmdCopyImage( - VkImage srcImage, - VkImageLayout srcImageLayout, - VkImage dstImage, - VkImageLayout dstImageLayout, - uint32_t regionCount, - const VkImageCopy* pRegions) { - m_vkd->vkCmdCopyImage(m_buffer, - srcImage, srcImageLayout, - dstImage, dstImageLayout, - regionCount, pRegions); - } - - - void DxvkCommandList::cmdDispatch( - uint32_t x, - uint32_t y, - uint32_t z) { - m_vkd->vkCmdDispatch(m_buffer, x, y, z); - } - - - void DxvkCommandList::cmdDispatchIndirect( - VkBuffer buffer, - VkDeviceSize offset) { - m_vkd->vkCmdDispatchIndirect( - m_buffer, buffer, offset); - } - - - void DxvkCommandList::cmdDraw( - uint32_t vertexCount, - uint32_t instanceCount, - uint32_t firstVertex, - uint32_t firstInstance) { - m_vkd->vkCmdDraw(m_buffer, - vertexCount, instanceCount, - firstVertex, firstInstance); - } - - - void DxvkCommandList::cmdDrawIndirect( - VkBuffer buffer, - VkDeviceSize offset, - uint32_t drawCount, - uint32_t stride) { - m_vkd->vkCmdDrawIndirect(m_buffer, - buffer, offset, drawCount, stride); - } - - - void DxvkCommandList::cmdDrawIndexed( - uint32_t indexCount, - uint32_t instanceCount, - uint32_t firstIndex, - uint32_t vertexOffset, - uint32_t firstInstance) { - m_vkd->vkCmdDrawIndexed(m_buffer, - indexCount, instanceCount, - firstIndex, vertexOffset, - firstInstance); - } - - - void DxvkCommandList::cmdDrawIndexedIndirect( - VkBuffer buffer, - VkDeviceSize offset, - uint32_t drawCount, - uint32_t stride) { - m_vkd->vkCmdDrawIndexedIndirect(m_buffer, - buffer, offset, drawCount, stride); - } - - - void DxvkCommandList::cmdEndRenderPass() { - m_vkd->vkCmdEndRenderPass(m_buffer); - } - - - void DxvkCommandList::cmdPipelineBarrier( - VkPipelineStageFlags srcStageMask, - VkPipelineStageFlags dstStageMask, - VkDependencyFlags dependencyFlags, - uint32_t memoryBarrierCount, - const VkMemoryBarrier* pMemoryBarriers, - uint32_t bufferMemoryBarrierCount, - const VkBufferMemoryBarrier* pBufferMemoryBarriers, - uint32_t imageMemoryBarrierCount, - const VkImageMemoryBarrier* pImageMemoryBarriers) { - m_vkd->vkCmdPipelineBarrier(m_buffer, - srcStageMask, dstStageMask, dependencyFlags, - memoryBarrierCount, pMemoryBarriers, - bufferMemoryBarrierCount, pBufferMemoryBarriers, - imageMemoryBarrierCount, pImageMemoryBarriers); - } - - - void DxvkCommandList::cmdResolveImage( - VkImage srcImage, - VkImageLayout srcImageLayout, - VkImage dstImage, - VkImageLayout dstImageLayout, - uint32_t regionCount, - const VkImageResolve* pRegions) { - m_vkd->vkCmdResolveImage(m_buffer, - srcImage, srcImageLayout, - dstImage, dstImageLayout, - regionCount, pRegions); - } - - - void DxvkCommandList::cmdUpdateBuffer( - VkBuffer dstBuffer, - VkDeviceSize dstOffset, - VkDeviceSize dataSize, - const void* pData) { - m_vkd->vkCmdUpdateBuffer(m_buffer, - dstBuffer, dstOffset, dataSize, pData); - } - - - void DxvkCommandList::cmdSetBlendConstants( - float blendConstants[4]) { - m_vkd->vkCmdSetBlendConstants(m_buffer, blendConstants); - } - - - void DxvkCommandList::cmdSetScissor( - uint32_t firstScissor, - uint32_t scissorCount, - const VkRect2D* scissors) { - m_vkd->vkCmdSetScissor(m_buffer, - firstScissor, scissorCount, scissors); - } - - - void DxvkCommandList::cmdSetStencilReference( - VkStencilFaceFlags faceMask, - uint32_t reference) { - m_vkd->vkCmdSetStencilReference(m_buffer, - faceMask, reference); - } - - - void DxvkCommandList::cmdSetViewport( - uint32_t firstViewport, - uint32_t viewportCount, - const VkViewport* viewports) { - m_vkd->vkCmdSetViewport(m_buffer, - firstViewport, viewportCount, viewports); - } - - DxvkStagingBufferSlice DxvkCommandList::stagedAlloc(VkDeviceSize size) { return m_stagingAlloc.alloc(size); } diff --git a/src/dxvk/dxvk_cmdlist.h b/src/dxvk/dxvk_cmdlist.h index ca5d8c5c2..390cbb437 100644 --- a/src/dxvk/dxvk_cmdlist.h +++ b/src/dxvk/dxvk_cmdlist.h @@ -67,8 +67,9 @@ namespace dxvk { * the device can guarantee that the submission has * completed. */ - void trackResource( - const Rc& rc); + void trackResource(const Rc& rc) { + m_resources.trackResource(rc); + } /** * \brief Resets the command list @@ -90,55 +91,96 @@ namespace dxvk { void cmdBeginRenderPass( const VkRenderPassBeginInfo* pRenderPassBegin, - VkSubpassContents contents); + VkSubpassContents contents) { + m_vkd->vkCmdBeginRenderPass(m_buffer, + pRenderPassBegin, contents); + } + void cmdBindIndexBuffer( VkBuffer buffer, VkDeviceSize offset, - VkIndexType indexType); + VkIndexType indexType) { + m_vkd->vkCmdBindIndexBuffer(m_buffer, + buffer, offset, indexType); + } + void cmdBindPipeline( VkPipelineBindPoint pipelineBindPoint, - VkPipeline pipeline); + VkPipeline pipeline) { + m_vkd->vkCmdBindPipeline(m_buffer, + pipelineBindPoint, pipeline); + } + void cmdBindVertexBuffers( uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, - const VkDeviceSize* pOffsets); + const VkDeviceSize* pOffsets) { + m_vkd->vkCmdBindVertexBuffers(m_buffer, + firstBinding, bindingCount, pBuffers, pOffsets); + } + void cmdClearAttachments( uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, - const VkClearRect* pRects); + const VkClearRect* pRects) { + m_vkd->vkCmdClearAttachments(m_buffer, + attachmentCount, pAttachments, + rectCount, pRects); + } + void cmdClearColorImage( VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, - const VkImageSubresourceRange* pRanges); + const VkImageSubresourceRange* pRanges) { + m_vkd->vkCmdClearColorImage(m_buffer, + image, imageLayout, pColor, + rangeCount, pRanges); + } + void cmdClearDepthStencilImage( VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, - const VkImageSubresourceRange* pRanges); + const VkImageSubresourceRange* pRanges) { + m_vkd->vkCmdClearDepthStencilImage(m_buffer, + image, imageLayout, pDepthStencil, + rangeCount, pRanges); + } + void cmdCopyBuffer( VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, - const VkBufferCopy* pRegions); + const VkBufferCopy* pRegions) { + m_vkd->vkCmdCopyBuffer(m_buffer, + srcBuffer, dstBuffer, + regionCount, pRegions); + } + void cmdCopyBufferToImage( VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, - const VkBufferImageCopy* pRegions); + const VkBufferImageCopy* pRegions) { + m_vkd->vkCmdCopyBufferToImage(m_buffer, + srcBuffer, dstImage, dstImageLayout, + regionCount, pRegions); + } + void cmdCopyImage( VkImage srcImage, @@ -146,43 +188,77 @@ namespace dxvk { VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, - const VkImageCopy* pRegions); + const VkImageCopy* pRegions) { + m_vkd->vkCmdCopyImage(m_buffer, + srcImage, srcImageLayout, + dstImage, dstImageLayout, + regionCount, pRegions); + } + void cmdDispatch( uint32_t x, uint32_t y, - uint32_t z); + uint32_t z) { + m_vkd->vkCmdDispatch(m_buffer, x, y, z); + } + void cmdDispatchIndirect( VkBuffer buffer, - VkDeviceSize offset); + VkDeviceSize offset) { + m_vkd->vkCmdDispatchIndirect( + m_buffer, buffer, offset); + } + void cmdDraw( uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, - uint32_t firstInstance); + uint32_t firstInstance) { + m_vkd->vkCmdDraw(m_buffer, + vertexCount, instanceCount, + firstVertex, firstInstance); + } + void cmdDrawIndirect( VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, - uint32_t stride); + uint32_t stride) { + m_vkd->vkCmdDrawIndirect(m_buffer, + buffer, offset, drawCount, stride); + } + void cmdDrawIndexed( uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, uint32_t vertexOffset, - uint32_t firstInstance); + uint32_t firstInstance) { + m_vkd->vkCmdDrawIndexed(m_buffer, + indexCount, instanceCount, + firstIndex, vertexOffset, + firstInstance); + } + void cmdDrawIndexedIndirect( VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, - uint32_t stride); + uint32_t stride) { + m_vkd->vkCmdDrawIndexedIndirect(m_buffer, + buffer, offset, drawCount, stride); + } - void cmdEndRenderPass(); + + void cmdEndRenderPass() { + m_vkd->vkCmdEndRenderPass(m_buffer); + } void cmdPipelineBarrier( VkPipelineStageFlags srcStageMask, @@ -193,7 +269,14 @@ namespace dxvk { uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, - const VkImageMemoryBarrier* pImageMemoryBarriers); + const VkImageMemoryBarrier* pImageMemoryBarriers) { + m_vkd->vkCmdPipelineBarrier(m_buffer, + srcStageMask, dstStageMask, dependencyFlags, + memoryBarrierCount, pMemoryBarriers, + bufferMemoryBarrierCount, pBufferMemoryBarriers, + imageMemoryBarrierCount, pImageMemoryBarriers); + } + void cmdResolveImage( VkImage srcImage, @@ -201,30 +284,55 @@ namespace dxvk { VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, - const VkImageResolve* pRegions); + const VkImageResolve* pRegions) { + m_vkd->vkCmdResolveImage(m_buffer, + srcImage, srcImageLayout, + dstImage, dstImageLayout, + regionCount, pRegions); + } + void cmdUpdateBuffer( VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, - const void* pData); + const void* pData) { + m_vkd->vkCmdUpdateBuffer(m_buffer, + dstBuffer, dstOffset, dataSize, pData); + } + void cmdSetBlendConstants( - float blendConstants[4]); + float blendConstants[4]) { + m_vkd->vkCmdSetBlendConstants(m_buffer, blendConstants); + } + void cmdSetScissor( uint32_t firstScissor, uint32_t scissorCount, - const VkRect2D* scissors); + const VkRect2D* scissors) { + m_vkd->vkCmdSetScissor(m_buffer, + firstScissor, scissorCount, scissors); + } + void cmdSetStencilReference( VkStencilFaceFlags faceMask, - uint32_t reference); + uint32_t reference) { + m_vkd->vkCmdSetStencilReference(m_buffer, + faceMask, reference); + } + void cmdSetViewport( uint32_t firstViewport, uint32_t viewportCount, - const VkViewport* viewports); + const VkViewport* viewports) { + m_vkd->vkCmdSetViewport(m_buffer, + firstViewport, viewportCount, viewports); + } + DxvkStagingBufferSlice stagedAlloc( VkDeviceSize size);