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

[dxvk] Consider indirect draw buffer in graphics pipeline barriers

This commit is contained in:
Philip Rebohle 2019-10-26 03:34:43 +02:00
parent f60d1db1f1
commit c44d30d78b
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 20 additions and 3 deletions

View File

@ -4353,7 +4353,7 @@ namespace dxvk {
}
if (m_state.gp.flags.test(DxvkGraphicsPipelineFlag::HasStorageDescriptors))
this->commitGraphicsBarriers<Indexed>();
this->commitGraphicsBarriers<Indexed, Indirect>();
if (m_flags.test(DxvkContextFlag::GpDirtyFramebuffer))
this->updateFramebuffer();
@ -4538,7 +4538,7 @@ namespace dxvk {
}
template<bool Indexed>
template<bool Indexed, bool Indirect>
void DxvkContext::commitGraphicsBarriers() {
auto layout = m_state.gp.pipeline->layout();
@ -4548,6 +4548,23 @@ namespace dxvk {
bool requiresBarrier = false;
// Check the draw buffer for indirect draw calls
if (m_flags.test(DxvkContextFlag::DirtyDrawBuffer) && Indirect) {
std::array<DxvkBufferSlice*, 2> slices = {{
&m_state.id.argBuffer,
&m_state.id.cntBuffer,
}};
for (uint32_t i = 0; i < slices.size() && !requiresBarrier; i++) {
if (slices[i]->defined()
&& slices[i]->bufferInfo().usage & storageBufferUsage) {
requiresBarrier = this->checkGfxBufferBarrier(*slices[i],
VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT,
VK_ACCESS_INDIRECT_COMMAND_READ_BIT).test(DxvkAccess::Write);
}
}
}
// Read-only stage, so we only have to check this if
// the bindngs have actually changed between draws
if (m_flags.test(DxvkContextFlag::GpDirtyIndexBuffer) && !requiresBarrier && Indexed) {

View File

@ -1183,7 +1183,7 @@ namespace dxvk {
void commitComputeInitBarriers();
void commitComputePostBarriers();
template<bool Indexed>
template<bool Indexed, bool Indirect>
void commitGraphicsBarriers();
DxvkAccessFlags checkGfxBufferBarrier(