1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-04-06 00:57:40 +02:00

[dxvk] Use new barrier helpers in copyImageToBufferCs

And actually rename that function to make sense.
This commit is contained in:
Philip Rebohle 2024-10-12 09:39:24 +02:00 committed by Philip Rebohle
parent 59d37757b0
commit 856a84e6fd
2 changed files with 10 additions and 23 deletions

View File

@ -607,7 +607,7 @@ namespace dxvk {
bool useFb = !formatsAreCopyCompatible(srcImage->info().format, dstFormat); bool useFb = !formatsAreCopyCompatible(srcImage->info().format, dstFormat);
if (useFb) { if (useFb) {
copyImageToBufferFb(dstBuffer, dstOffset, rowAlignment, sliceAlignment, copyImageToBufferCs(dstBuffer, dstOffset, rowAlignment, sliceAlignment,
dstFormat ? dstFormat : srcImage->info().format, dstFormat ? dstFormat : srcImage->info().format,
srcImage, srcSubresource, srcOffset, srcExtent); srcImage, srcSubresource, srcOffset, srcExtent);
} else { } else {
@ -3135,7 +3135,7 @@ namespace dxvk {
} }
void DxvkContext::copyImageToBufferFb( void DxvkContext::copyImageToBufferCs(
const Rc<DxvkBuffer>& buffer, const Rc<DxvkBuffer>& buffer,
VkDeviceSize bufferOffset, VkDeviceSize bufferOffset,
VkDeviceSize bufferRowAlignment, VkDeviceSize bufferRowAlignment,
@ -3156,8 +3156,7 @@ namespace dxvk {
ensureImageCompatibility(image, imageUsage); ensureImageCompatibility(image, imageUsage);
if (m_execBarriers.isImageDirty(image, vk::makeSubresourceRange(imageSubresource), DxvkAccess::Write)) flushPendingAccesses(*image, vk::makeSubresourceRange(imageSubresource), DxvkAccess::Read);
m_execBarriers.recordCommands(m_cmd);
auto formatInfo = lookupFormatInfo(bufferFormat); auto formatInfo = lookupFormatInfo(bufferFormat);
@ -3191,11 +3190,7 @@ namespace dxvk {
Rc<DxvkBufferView> bufferView = buffer->createView(bufferViewInfo); Rc<DxvkBufferView> bufferView = buffer->createView(bufferViewInfo);
VkBufferView bufferViewHandle = bufferView->handle(); VkBufferView bufferViewHandle = bufferView->handle();
DxvkBufferSliceHandle bufferSlice = buffer->getSliceHandle( flushPendingAccesses(*bufferView, DxvkAccess::Write);
bufferViewInfo.offset, bufferViewInfo.size);
if (m_execBarriers.isBufferDirty(bufferSlice, DxvkAccess::Read))
m_execBarriers.recordCommands(m_cmd);
// Transition image to a layout we can use for reading as necessary // Transition image to a layout we can use for reading as necessary
VkImageLayout imageLayout = (image->formatInfo()->aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) VkImageLayout imageLayout = (image->formatInfo()->aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT))
@ -3293,20 +3288,12 @@ namespace dxvk {
workgroupCount.height, workgroupCount.height,
workgroupCount.depth); workgroupCount.depth);
m_execBarriers.accessBuffer(bufferSlice, accessBuffer(DxvkCmdBuffer::ExecBuffer, *bufferView,
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, VK_ACCESS_2_SHADER_WRITE_BIT);
VK_ACCESS_SHADER_WRITE_BIT,
buffer->info().stages,
buffer->info().access);
m_execBarriers.accessImage(image, accessImage(DxvkCmdBuffer::ExecBuffer, *image,
vk::makeSubresourceRange(imageSubresource), vk::makeSubresourceRange(imageSubresource), imageLayout,
imageLayout, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, VK_ACCESS_2_SHADER_READ_BIT);
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
VK_ACCESS_SHADER_READ_BIT,
image->info().layout,
image->info().stages,
image->info().access);
m_cmd->trackResource<DxvkAccess::Write>(buffer); m_cmd->trackResource<DxvkAccess::Write>(buffer);
m_cmd->trackResource<DxvkAccess::Read>(image); m_cmd->trackResource<DxvkAccess::Read>(image);

View File

@ -1489,7 +1489,7 @@ namespace dxvk {
VkOffset3D imageOffset, VkOffset3D imageOffset,
VkExtent3D imageExtent); VkExtent3D imageExtent);
void copyImageToBufferFb( void copyImageToBufferCs(
const Rc<DxvkBuffer>& buffer, const Rc<DxvkBuffer>& buffer,
VkDeviceSize bufferOffset, VkDeviceSize bufferOffset,
VkDeviceSize bufferRowAlignment, VkDeviceSize bufferRowAlignment,