diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index e38cf7c12..01b008d2c 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -4206,8 +4206,6 @@ namespace dxvk { ] (DxvkContext* ctx) { ctx->generateMipmaps(cImageView); }); - - pResource->SetNeedsMipGen(false); } @@ -4896,12 +4894,13 @@ namespace dxvk { auto texInfo = GetCommonTexture(m_state.textures[bit::tzcnt(tex)]); this->GenerateMips(texInfo); + texInfo->SetNeedsMipGen(false); } m_activeTexturesToGen &= ~mask; } - + void D3D9DeviceEx::MarkTextureMipsDirty(D3D9CommonTexture* pResource) { pResource->SetNeedsMipGen(true); @@ -4919,6 +4918,20 @@ namespace dxvk { } + void D3D9DeviceEx::MarkTextureMipsUnDirty(D3D9CommonTexture* pResource) { + pResource->SetNeedsMipGen(false); + + for (uint32_t tex = m_activeTextures; tex; tex &= tex - 1) { + // Guaranteed to not be nullptr... + const uint32_t i = bit::tzcnt(tex); + auto texInfo = GetCommonTexture(m_state.textures[i]); + + if (texInfo == pResource) + m_activeTexturesToGen &= 1 << i; + } + } + + template void D3D9DeviceEx::UpdatePointMode() { if constexpr (!Points) { diff --git a/src/d3d9/d3d9_device.h b/src/d3d9/d3d9_device.h index 7a1ce49cf..003d9bcac 100644 --- a/src/d3d9/d3d9_device.h +++ b/src/d3d9/d3d9_device.h @@ -754,6 +754,8 @@ namespace dxvk { void MarkTextureMipsDirty(D3D9CommonTexture* pResource); + void MarkTextureMipsUnDirty(D3D9CommonTexture* pResource); + template void UpdatePointMode(); diff --git a/src/d3d9/d3d9_texture.h b/src/d3d9/d3d9_texture.h index 3d5a5d40c..0af62f0e6 100644 --- a/src/d3d9/d3d9_texture.h +++ b/src/d3d9/d3d9_texture.h @@ -87,6 +87,7 @@ namespace dxvk { if (!m_texture.NeedsMipGen()) return; + this->m_parent->MarkTextureMipsUnDirty(&m_texture); this->m_parent->GenerateMips(&m_texture); }