1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-03 04:24:11 +01:00

[dxvk] Add helpers to flush pending execution barriers if needed

This commit is contained in:
Philip Rebohle 2024-10-12 00:47:12 +02:00 committed by Philip Rebohle
parent 318e79c2ad
commit bbe7767475
2 changed files with 137 additions and 0 deletions

View File

@ -6986,6 +6986,94 @@ namespace dxvk {
}
void DxvkContext::accessBuffer(
DxvkCmdBuffer cmdBuffer,
DxvkBufferView& bufferView,
VkPipelineStageFlags2 srcStages,
VkAccessFlags2 srcAccess) {
accessBuffer(cmdBuffer,
*bufferView.buffer(),
bufferView.info().offset,
bufferView.info().size,
srcStages, srcAccess);
}
void DxvkContext::accessBuffer(
DxvkCmdBuffer cmdBuffer,
DxvkBufferView& bufferView,
VkPipelineStageFlags2 srcStages,
VkAccessFlags2 srcAccess,
VkPipelineStageFlags2 dstStages,
VkAccessFlags2 dstAccess) {
accessBuffer(cmdBuffer,
*bufferView.buffer(),
bufferView.info().offset,
bufferView.info().size,
srcStages, srcAccess,
dstStages, dstAccess);
}
void DxvkContext::flushPendingAccesses(
DxvkBuffer& buffer,
VkDeviceSize offset,
VkDeviceSize size,
DxvkAccess access) {
if (m_execBarriers.isBufferDirty(buffer.getSliceHandle(offset, size), access))
m_execBarriers.recordCommands(m_cmd);
}
void DxvkContext::flushPendingAccesses(
DxvkBufferView& bufferView,
DxvkAccess access) {
flushPendingAccesses(*bufferView.buffer(),
bufferView.info().offset,
bufferView.info().size,
access);
}
void DxvkContext::flushPendingAccesses(
DxvkImage& image,
const VkImageSubresourceRange& subresources,
DxvkAccess access) {
if (m_execBarriers.isImageDirty(&image, subresources, access))
m_execBarriers.recordCommands(m_cmd);
}
void DxvkContext::flushPendingAccesses(
DxvkImageView& imageView,
DxvkAccess access) {
flushPendingAccesses(*imageView.image(),
imageView.imageSubresources(), access);
}
void DxvkContext::flushBarriers() {
m_execBarriers.recordCommands(m_cmd);
}
bool DxvkContext::resourceHasAccess(
DxvkBuffer& buffer,
VkDeviceSize offset,
VkDeviceSize size,
DxvkAccess access) {
return m_execBarriers.getBufferAccess(buffer.getSliceHandle(offset, size)).test(access);
}
bool DxvkContext::resourceHasAccess(
DxvkImageView& imageView,
DxvkAccess access) {
return m_execBarriers.getImageAccess(imageView.image(),
imageView.imageSubresources()).test(access);
}
bool DxvkContext::formatsAreCopyCompatible(
VkFormat imageFormat,
VkFormat bufferFormat) {

View File

@ -1850,6 +1850,55 @@ namespace dxvk {
VkPipelineStageFlags2 dstStages,
VkAccessFlags2 dstAccess);
void accessBuffer(
DxvkCmdBuffer cmdBuffer,
DxvkBufferView& bufferView,
VkPipelineStageFlags2 srcStages,
VkAccessFlags2 srcAccess);
void accessBuffer(
DxvkCmdBuffer cmdBuffer,
DxvkBufferView& bufferView,
VkPipelineStageFlags2 srcStages,
VkAccessFlags2 srcAccess,
VkPipelineStageFlags2 dstStages,
VkAccessFlags2 dstAccess);
void flushPendingAccesses(
DxvkBuffer& buffer,
VkDeviceSize offset,
VkDeviceSize size,
DxvkAccess access);
void flushPendingAccesses(
DxvkBufferView& bufferView,
DxvkAccess access);
void flushPendingAccesses(
DxvkImage& image,
const VkImageSubresourceRange& subresources,
DxvkAccess access);
void flushPendingAccesses(
DxvkImageView& imageView,
DxvkAccess access);
void flushBarriers();
bool resourceHasAccess(
DxvkBuffer& buffer,
VkDeviceSize offset,
VkDeviceSize size,
DxvkAccess access);
bool resourceHasAccess(
DxvkBufferView& buffer,
DxvkAccess access);
bool resourceHasAccess(
DxvkImageView& imageView,
DxvkAccess access);
static bool formatsAreCopyCompatible(
VkFormat imageFormat,
VkFormat bufferFormat);