1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 20:52:10 +01:00

[dxvk] Avoid redundant descriptor set updates when binding buffers (v2)

We need to check not just the buffer object but also the length of the
bound buffer range, since this information will be written into the
descriptor and cannot be changed via dynamic offsets.

Fixes: f501ebc ('[dxvk] Avoid redundant descriptor set updates when binding buffers')
This commit is contained in:
Philip Rebohle 2019-08-01 21:30:27 +02:00
parent af15d85baa
commit 02d92210ad
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -148,12 +148,24 @@ namespace dxvk {
void DxvkContext::bindResourceBuffer(
uint32_t slot,
const DxvkBufferSlice& buffer) {
m_rc[slot].bufferSlice = buffer;
m_rcTracked.clr(slot);
bool needsUpdate = !m_rc[slot].bufferSlice.matchesBuffer(buffer);
m_flags.set(
DxvkContextFlag::CpDirtyResources,
DxvkContextFlag::GpDirtyResources);
if (likely(needsUpdate))
m_rcTracked.clr(slot);
else
needsUpdate = m_rc[slot].bufferSlice.length() != buffer.length();
if (likely(needsUpdate)) {
m_flags.set(
DxvkContextFlag::CpDirtyResources,
DxvkContextFlag::GpDirtyResources);
} else {
m_flags.set(
DxvkContextFlag::CpDirtyDescriptorOffsets,
DxvkContextFlag::GpDirtyDescriptorOffsets);
}
m_rc[slot].bufferSlice = buffer;
}