1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-31 14:52:11 +01:00

[dxvk] Add methods to query source access type for an accessed resource

This commit is contained in:
Philip Rebohle 2019-02-07 00:26:40 +01:00
parent 9165f8c072
commit 24dca37fce
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 48 additions and 0 deletions

View File

@ -128,6 +128,43 @@ namespace dxvk {
}
DxvkAccessFlags DxvkBarrierSet::getBufferAccess(
const DxvkBufferSliceHandle& bufSlice) {
DxvkAccessFlags access = getAccessTypes(m_srcAccess);
for (uint32_t i = 0; i < m_bufSlices.size(); i++) {
const DxvkBufferSliceHandle& dstSlice = m_bufSlices[i].slice;
if ((bufSlice.handle == dstSlice.handle)
&& (bufSlice.offset + bufSlice.length > dstSlice.offset)
&& (bufSlice.offset < dstSlice.offset + dstSlice.length))
access = access | m_bufSlices[i].access;
}
return access;
}
DxvkAccessFlags DxvkBarrierSet::getImageAccess(
const Rc<DxvkImage>& image,
const VkImageSubresourceRange& imgSubres) {
DxvkAccessFlags access = getAccessTypes(m_srcAccess & image->info().access);
for (uint32_t i = 0; i < m_imgSlices.size(); i++) {
const VkImageSubresourceRange& dstSubres = m_imgSlices[i].subres;
if ((image == m_imgSlices[i].image)
&& (imgSubres.baseArrayLayer < dstSubres.baseArrayLayer + dstSubres.layerCount)
&& (imgSubres.baseArrayLayer + imgSubres.layerCount > dstSubres.baseArrayLayer)
&& (imgSubres.baseMipLevel < dstSubres.baseMipLevel + dstSubres.levelCount)
&& (imgSubres.baseMipLevel + imgSubres.levelCount > dstSubres.baseMipLevel))
access = access | m_imgSlices[i].access;
}
return access;
}
void DxvkBarrierSet::recordCommands(const Rc<DxvkCommandList>& commandList) {
if (m_srcStages | m_dstStages) {
VkPipelineStageFlags srcFlags = m_srcStages;

View File

@ -52,6 +52,17 @@ namespace dxvk {
const VkImageSubresourceRange& imgSubres,
DxvkAccessFlags imgAccess);
DxvkAccessFlags getBufferAccess(
const DxvkBufferSliceHandle& bufSlice);
DxvkAccessFlags getImageAccess(
const Rc<DxvkImage>& image,
const VkImageSubresourceRange& imgSubres);
VkPipelineStageFlags getSrcStages() {
return m_srcStages;
}
void recordCommands(
const Rc<DxvkCommandList>& commandList);