...
 
Commits (3)
......@@ -4199,15 +4199,13 @@ namespace dxvk {
}
void D3D9DeviceEx::GenerateMips(
void D3D9DeviceEx::EmitGenerateMips(
D3D9CommonTexture* pResource) {
EmitCs([
cImageView = pResource->GetSampleView(false)
] (DxvkContext* ctx) {
ctx->generateMipmaps(cImageView);
});
pResource->SetNeedsMipGen(false);
}
......@@ -4895,13 +4893,16 @@ namespace dxvk {
// Guaranteed to not be nullptr...
auto texInfo = GetCommonTexture(m_state.textures[bit::tzcnt(tex)]);
this->GenerateMips(texInfo);
if (texInfo->NeedsMipGen()) {
this->EmitGenerateMips(texInfo);
texInfo->SetNeedsMipGen(false);
}
}
m_activeTexturesToGen &= ~mask;
}
void D3D9DeviceEx::MarkTextureMipsDirty(D3D9CommonTexture* pResource) {
pResource->SetNeedsMipGen(true);
......@@ -4919,6 +4920,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 <bool Points>
void D3D9DeviceEx::UpdatePointMode() {
if constexpr (!Points) {
......
......@@ -706,7 +706,7 @@ namespace dxvk {
D3D9CommonTexture* pResource,
UINT Subresource);
void GenerateMips(
void EmitGenerateMips(
D3D9CommonTexture* pResource);
HRESULT LockBuffer(
......@@ -754,6 +754,8 @@ namespace dxvk {
void MarkTextureMipsDirty(D3D9CommonTexture* pResource);
void MarkTextureMipsUnDirty(D3D9CommonTexture* pResource);
template <bool Points>
void UpdatePointMode();
......
......@@ -87,7 +87,8 @@ namespace dxvk {
if (!m_texture.NeedsMipGen())
return;
this->m_parent->GenerateMips(&m_texture);
this->m_parent->MarkTextureMipsUnDirty(&m_texture);
this->m_parent->EmitGenerateMips(&m_texture);
}
D3D9CommonTexture* GetCommonTexture() {
......