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

[d3d9] Fix texture dirty box clearing

- Fix interleaved locks with evictManagedOnUnlock
We need to make sure there are no other subresources of a texture locked
before clearing the dirty box. Otherwise the data for those other subresources
won't get copied into VRAM.

- Clear dirty box regardless of texture pool
Otherwise we keep repacking and copying the whole texture
for every single lock. This causes performance problems
in Star Wars: The Old Republic.
This commit is contained in:
Robin Kertels 2021-06-27 13:39:26 +02:00 committed by Joshie
parent 2ff8b42fff
commit c43618d19f
3 changed files with 5 additions and 3 deletions

View File

@ -308,6 +308,8 @@ namespace dxvk {
bool GetLocked(UINT Subresource) const { return m_locked.get(Subresource); }
bool IsAnySubresourceLocked() const { return m_locked.any(); }
void SetWrittenByGPU(UINT Subresource, bool value) { m_wasWrittenByGPU.set(Subresource, value); }
bool WasWrittenByGPU(UINT Subresource) const { return m_wasWrittenByGPU.get(Subresource); }

View File

@ -4224,7 +4224,7 @@ namespace dxvk {
}
}
if (pResource->IsManaged() && !m_d3d9Options.evictManagedOnUnlock && !readOnly) {
if (managed && !m_d3d9Options.evictManagedOnUnlock && !readOnly) {
pResource->SetNeedsUpload(Subresource, true);
for (uint32_t tex = m_activeTextures; tex; tex &= tex - 1) {
@ -4276,7 +4276,7 @@ namespace dxvk {
if (shouldFlush) {
this->FlushImage(pResource, Subresource);
if (pResource->IsManaged())
if (!pResource->IsAnySubresourceLocked())
pResource->ClearDirtyBoxes();
}

View File

@ -242,7 +242,7 @@ namespace dxvk::bit {
m_dwords[i] = 0;
}
constexpr bool any() {
constexpr bool any() const {
for (size_t i = 0; i < Dwords; i++) {
if (m_dwords[i] != 0)
return true;