1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-20 08:52:22 +01:00

[dxvk] Use out-of-order transfer helper in clearBufferView

Covers some ClearUAV / ClearView use cases involving buffers.
This commit is contained in:
Philip Rebohle 2024-10-28 11:54:43 +01:00 committed by Philip Rebohle
parent 301f06bdfb
commit c795415c39

View File

@ -258,10 +258,16 @@ namespace dxvk {
VkDeviceSize offset, VkDeviceSize offset,
VkDeviceSize length, VkDeviceSize length,
VkClearColorValue value) { VkClearColorValue value) {
this->spillRenderPass(true); DxvkCmdBuffer cmdBuffer = DxvkCmdBuffer::InitBuffer;
this->invalidateState();
flushPendingAccesses(*bufferView, DxvkAccess::Write); if (!prepareOutOfOrderTransfer(bufferView, offset, length, DxvkAccess::Write)) {
spillRenderPass(true);
invalidateState();
flushPendingAccesses(*bufferView, DxvkAccess::Write);
cmdBuffer = DxvkCmdBuffer::ExecBuffer;
}
// Query pipeline objects to use for this clear operation // Query pipeline objects to use for this clear operation
DxvkMetaClearPipeline pipeInfo = m_common->metaClear().getClearBufferPipeline( DxvkMetaClearPipeline pipeInfo = m_common->metaClear().getClearBufferPipeline(
@ -290,19 +296,20 @@ namespace dxvk {
VkExtent3D workgroups = util::computeBlockCount( VkExtent3D workgroups = util::computeBlockCount(
pushArgs.extent, pipeInfo.workgroupSize); pushArgs.extent, pipeInfo.workgroupSize);
m_cmd->cmdBindPipeline(DxvkCmdBuffer::ExecBuffer, m_cmd->cmdBindPipeline(cmdBuffer,
VK_PIPELINE_BIND_POINT_COMPUTE, pipeInfo.pipeline); VK_PIPELINE_BIND_POINT_COMPUTE, pipeInfo.pipeline);
m_cmd->cmdBindDescriptorSet(DxvkCmdBuffer::ExecBuffer, m_cmd->cmdBindDescriptorSet(cmdBuffer,
VK_PIPELINE_BIND_POINT_COMPUTE, pipeInfo.pipeLayout, VK_PIPELINE_BIND_POINT_COMPUTE, pipeInfo.pipeLayout,
descriptorSet, 0, nullptr); descriptorSet, 0, nullptr);
m_cmd->cmdPushConstants(DxvkCmdBuffer::ExecBuffer, m_cmd->cmdPushConstants(cmdBuffer,
pipeInfo.pipeLayout, VK_SHADER_STAGE_COMPUTE_BIT, pipeInfo.pipeLayout, VK_SHADER_STAGE_COMPUTE_BIT,
0, sizeof(pushArgs), &pushArgs); 0, sizeof(pushArgs), &pushArgs);
m_cmd->cmdDispatch(DxvkCmdBuffer::ExecBuffer, m_cmd->cmdDispatch(cmdBuffer,
workgroups.width, workgroups.height, workgroups.depth); workgroups.width, workgroups.height, workgroups.depth);
accessBuffer(DxvkCmdBuffer::ExecBuffer, *bufferView, accessBuffer(cmdBuffer, *bufferView,
VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, VK_ACCESS_2_SHADER_WRITE_BIT); VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
VK_ACCESS_2_SHADER_WRITE_BIT);
m_cmd->track(bufferView->buffer(), DxvkAccess::Write); m_cmd->track(bufferView->buffer(), DxvkAccess::Write);
} }