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

[d3d9] Don't clear mipGenBit if texture is bound as attachment

This commit is contained in:
Robin Kertels 2024-10-11 21:30:55 +02:00 committed by Philip Rebohle
parent 5ff365b9f1
commit 5890eae32f
2 changed files with 31 additions and 8 deletions

View File

@ -6158,9 +6158,11 @@ namespace dxvk {
// Guaranteed to not be nullptr...
auto texInfo = GetCommonTexture(m_state.textures[texIdx]);
if (texInfo->NeedsMipGen()) {
if (likely(texInfo->NeedsMipGen())) {
this->EmitGenerateMips(texInfo);
texInfo->SetNeedsMipGen(false);
if (likely(!IsTextureBoundAsAttachment(texInfo))) {
texInfo->SetNeedsMipGen(false);
}
}
}
@ -6185,14 +6187,18 @@ namespace dxvk {
void D3D9DeviceEx::MarkTextureMipsUnDirty(D3D9CommonTexture* pResource) {
pResource->SetNeedsMipGen(false);
if (likely(!IsTextureBoundAsAttachment(pResource))) {
// We need to keep the texture marked as needing mipmap generation because we don't set that when rendering.
pResource->SetNeedsMipGen(false);
for (uint32_t i : bit::BitMask(m_activeTextures)) {
// Guaranteed to not be nullptr...
auto texInfo = GetCommonTexture(m_state.textures[i]);
for (uint32_t i : bit::BitMask(m_activeTextures)) {
// Guaranteed to not be nullptr...
auto texInfo = GetCommonTexture(m_state.textures[i]);
if (texInfo == pResource)
m_activeTexturesToGen &= ~(1 << i);
if (unlikely(texInfo == pResource)) {
m_activeTexturesToGen &= ~(1 << i);
}
}
}
}

View File

@ -1299,6 +1299,23 @@ namespace dxvk {
m_mostRecentlyUsedSwapchain = m_implicitSwapchain.ptr();
}
bool IsTextureBoundAsAttachment(const D3D9CommonTexture* pTexture) const {
if (unlikely(pTexture->IsRenderTarget())) {
for (uint32_t i : bit::BitMask(m_boundRTs)) {
auto texInfo = m_state.renderTargets[i]->GetCommonTexture();
if (unlikely(texInfo == pTexture)) {
return true;
}
}
} else if (unlikely(pTexture->IsDepthStencil() && m_state.depthStencil != nullptr)) {
auto texInfo = m_state.depthStencil->GetCommonTexture();
if (unlikely(texInfo == pTexture)) {
return true;
}
}
return false;
}
Com<D3D9InterfaceEx> m_parent;
D3DDEVTYPE m_deviceType;
HWND m_window;