mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-11 10:24:10 +01:00
[dxvk] Use new barrier tracking for images
This commit is contained in:
parent
30bc137f9c
commit
ec18532ed4
@ -87,7 +87,8 @@ namespace dxvk {
|
||||
m_imgBarriers.push_back(barrier);
|
||||
}
|
||||
|
||||
this->insertImageSlice({ image->handle(), subresources, access });
|
||||
m_imgSlices.insert(image->handle(),
|
||||
DxvkBarrierImageSlice(subresources, access));
|
||||
}
|
||||
|
||||
|
||||
@ -168,8 +169,10 @@ namespace dxvk {
|
||||
acquire.m_imgBarriers.push_back(barrier);
|
||||
|
||||
DxvkAccessFlags access(DxvkAccess::Read, DxvkAccess::Write);
|
||||
release.m_imgSlices.push_back({ image->handle(), subresources, access });
|
||||
acquire.m_imgSlices.push_back({ image->handle(), subresources, access });
|
||||
release.m_imgSlices.insert(image->handle(),
|
||||
DxvkBarrierImageSlice(subresources, access));
|
||||
acquire.m_imgSlices.insert(image->handle(),
|
||||
DxvkBarrierImageSlice(subresources, access));
|
||||
}
|
||||
|
||||
|
||||
@ -185,19 +188,8 @@ namespace dxvk {
|
||||
const Rc<DxvkImage>& image,
|
||||
const VkImageSubresourceRange& imgSubres,
|
||||
DxvkAccessFlags imgAccess) {
|
||||
bool result = false;
|
||||
|
||||
for (uint32_t i = 0; i < m_imgSlices.size() && !result; i++) {
|
||||
const VkImageSubresourceRange& dstSubres = m_imgSlices[i].subres;
|
||||
|
||||
result = (image->handle() == m_imgSlices[i].image) && (imgAccess | m_imgSlices[i].access).test(DxvkAccess::Write)
|
||||
&& (imgSubres.baseArrayLayer < dstSubres.baseArrayLayer + dstSubres.layerCount)
|
||||
&& (imgSubres.baseArrayLayer + imgSubres.layerCount > dstSubres.baseArrayLayer)
|
||||
&& (imgSubres.baseMipLevel < dstSubres.baseMipLevel + dstSubres.levelCount)
|
||||
&& (imgSubres.baseMipLevel + imgSubres.levelCount > dstSubres.baseMipLevel);
|
||||
}
|
||||
|
||||
return result;
|
||||
return m_imgSlices.isDirty(image->handle(),
|
||||
DxvkBarrierImageSlice(imgSubres, imgAccess));
|
||||
}
|
||||
|
||||
|
||||
@ -211,20 +203,8 @@ namespace dxvk {
|
||||
DxvkAccessFlags DxvkBarrierSet::getImageAccess(
|
||||
const Rc<DxvkImage>& image,
|
||||
const VkImageSubresourceRange& imgSubres) {
|
||||
DxvkAccessFlags access;
|
||||
|
||||
for (uint32_t i = 0; i < m_imgSlices.size(); i++) {
|
||||
const VkImageSubresourceRange& dstSubres = m_imgSlices[i].subres;
|
||||
|
||||
if ((image->handle() == 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;
|
||||
return m_imgSlices.getAccess(image->handle(),
|
||||
DxvkBarrierImageSlice(imgSubres, 0));
|
||||
}
|
||||
|
||||
|
||||
@ -270,22 +250,10 @@ namespace dxvk {
|
||||
m_imgBarriers.resize(0);
|
||||
|
||||
m_bufSlices.clear();
|
||||
m_imgSlices.resize(0);
|
||||
m_imgSlices.clear();
|
||||
}
|
||||
|
||||
|
||||
void DxvkBarrierSet::insertImageSlice(ImgSlice slice) {
|
||||
for (auto i = m_imgSlices.begin(); i != m_imgSlices.end(); i++) {
|
||||
if (slice.image == i->image && slice.subres == i->subres) {
|
||||
i->access.set(slice.access);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_imgSlices.push_back(slice);
|
||||
}
|
||||
|
||||
|
||||
DxvkAccessFlags DxvkBarrierSet::getAccessTypes(VkAccessFlags flags) {
|
||||
const VkAccessFlags rflags
|
||||
= VK_ACCESS_INDIRECT_COMMAND_READ_BIT
|
||||
|
@ -564,11 +564,8 @@ namespace dxvk {
|
||||
std::vector<VkBufferMemoryBarrier> m_bufBarriers;
|
||||
std::vector<VkImageMemoryBarrier> m_imgBarriers;
|
||||
|
||||
std::vector<ImgSlice> m_imgSlices;
|
||||
|
||||
DxvkBarrierSubresourceSet<VkBuffer, DxvkBarrierBufferSlice> m_bufSlices;
|
||||
|
||||
void insertImageSlice(ImgSlice slice);
|
||||
DxvkBarrierSubresourceSet<VkImage, DxvkBarrierImageSlice> m_imgSlices;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user