Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for EvictManagedOnUnlock & SWTOR performance #2126

Merged
merged 2 commits into from
Jul 1, 2021

Conversation

K0bin
Copy link
Collaborator

@K0bin K0bin commented Jun 27, 2021

Fixes #2125

Borderlands 2 locks textures like this:

Lock(Mip 0)
Lock(Mip 1)
Unlock(Mip 0)
Unlock(Mip 1)

which leads to us clearing the dirty box too soon and not copying the smaller mip maps over.


Fixes #2130

SWTOR locks a 1024x1024 D3DPOOL_DEFAULT, D3DFORMAT_A8, USAGE_DYNAMIC texture very often. (Probably cached font glyphs?). It properly sets the dirty rect whenever it makes a change.

On current master we never clear the dirty so it stays at the initial 1024x1024 rect. That means we keep repacking (from 4 aligned pitch managed buffer into tightly packed staging buffer) the entire image a bunch of times per frame. That's really slow.
If we just clear the dirty box like we do for managed textures, all we have to repack and copy are <30x30 parts of the texture.

@K0bin K0bin requested a review from Joshua-Ashton June 27, 2021 12:05
@philipl
Copy link

philipl commented Jun 27, 2021

Did a quick test with the build artifacts and it looks correct. Thanks!

@K0bin K0bin changed the title Fix for EvictManagedOnUnlock Fix for EvictManagedOnUnlock & SWTOR performance Jun 29, 2021
- 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.
@Joshua-Ashton Joshua-Ashton merged commit 309284e into doitsujin:master Jul 1, 2021
@K0bin K0bin deleted the evict-managed-fix branch July 1, 2021 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants