1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-01 16:24:12 +01:00

[d3d9] Only bind textures if they are used by the shader

This commit is contained in:
Joshua Ashton 2021-08-11 01:03:59 +01:00
parent c0c1565cba
commit 5e48035e99
No known key found for this signature in database
GPG Key ID: C85A08669126BE8D
2 changed files with 7 additions and 6 deletions

View File

@ -5847,11 +5847,11 @@ namespace dxvk {
} }
void D3D9DeviceEx::UndirtyTextures() { void D3D9DeviceEx::UndirtyTextures(uint32_t mask) {
for (uint32_t tex = m_dirtyTextures; tex; tex &= tex - 1) for (uint32_t tex = mask; tex; tex &= tex - 1)
BindTexture(bit::tzcnt(tex)); BindTexture(bit::tzcnt(tex));
m_dirtyTextures = 0; m_dirtyTextures &= ~mask;
} }
void D3D9DeviceEx::MarkTextureBindingDirty(IDirect3DBaseTexture9* texture) { void D3D9DeviceEx::MarkTextureBindingDirty(IDirect3DBaseTexture9* texture) {
@ -5930,8 +5930,9 @@ namespace dxvk {
if (activeDirtySamplers) if (activeDirtySamplers)
UndirtySamplers(activeDirtySamplers); UndirtySamplers(activeDirtySamplers);
if (m_dirtyTextures) const uint32_t activeDirtyTextures = m_dirtyTextures & usedSamplerMask;
UndirtyTextures(); if (activeDirtyTextures)
UndirtyTextures(activeDirtyTextures);
if (m_flags.test(D3D9DeviceFlag::DirtyBlendState)) if (m_flags.test(D3D9DeviceFlag::DirtyBlendState))
BindBlendState(); BindBlendState();

View File

@ -837,7 +837,7 @@ namespace dxvk {
void UndirtySamplers(uint32_t mask); void UndirtySamplers(uint32_t mask);
void UndirtyTextures(); void UndirtyTextures(uint32_t mask);
void MarkTextureBindingDirty(IDirect3DBaseTexture9* texture); void MarkTextureBindingDirty(IDirect3DBaseTexture9* texture);