[d3d9] Use buffer DirtyRange to track managed uploads

This commit is contained in:
Robin Kertels 2021-03-17 22:20:19 +01:00 committed by Joshie
parent 4f45e74d96
commit 3f57a3a8cc
2 changed files with 5 additions and 11 deletions

View File

@ -168,9 +168,10 @@ namespace dxvk {
} }
uint32_t GetLockCount() const { return m_lockCount; } uint32_t GetLockCount() const { return m_lockCount; }
void MarkUploaded() { m_needsUpload = false; } /**
void MarkNeedsUpload() { m_needsUpload = true; } * \brief Whether or not the staging buffer needs to be copied to the actual buffer
bool NeedsUpload() const { return m_needsUpload; } */
bool NeedsUpload() { return m_desc.Pool != D3DPOOL_DEFAULT && !m_dirtyRange.IsDegenerate(); }
void PreLoad(); void PreLoad();
@ -206,8 +207,6 @@ namespace dxvk {
uint32_t m_lockCount = 0; uint32_t m_lockCount = 0;
bool m_needsUpload = false;
}; };
} }

View File

@ -4463,13 +4463,9 @@ namespace dxvk {
// We need to remove the READONLY flags from the map flags // We need to remove the READONLY flags from the map flags
// if there was ever a non-readonly upload. // if there was ever a non-readonly upload.
if (!(Flags & D3DLOCK_READONLY)) { if (!(Flags & D3DLOCK_READONLY))
oldFlags &= ~D3DLOCK_READONLY; oldFlags &= ~D3DLOCK_READONLY;
if (pResource->Desc()->Pool != D3DPOOL_DEFAULT)
pResource->MarkNeedsUpload();
}
pResource->SetMapFlags(Flags | oldFlags); pResource->SetMapFlags(Flags | oldFlags);
pResource->IncrementLockCount(); pResource->IncrementLockCount();
@ -4496,7 +4492,6 @@ namespace dxvk {
pResource->GPUReadingRange().Conjoin(pResource->DirtyRange()); pResource->GPUReadingRange().Conjoin(pResource->DirtyRange());
pResource->DirtyRange().Clear(); pResource->DirtyRange().Clear();
pResource->MarkUploaded();
return D3D_OK; return D3D_OK;
} }