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

[d3d9] Perform tracking for preloaded managed resources

This commit is contained in:
Joshua Ashton 2020-06-06 21:59:25 +01:00 committed by Joshie
parent 7e72010302
commit e6ed8dab63
3 changed files with 26 additions and 9 deletions

View File

@ -466,11 +466,12 @@ namespace dxvk {
void D3D9CommonTexture::PreLoadAll() {
if (IsManaged()) {
auto lock = m_device->LockDevice();
if (!IsManaged())
return;
m_device->UploadManagedTexture(this);
}
auto lock = m_device->LockDevice();
m_device->UploadManagedTexture(this);
m_device->MarkTextureUploaded(this);
}
@ -481,6 +482,9 @@ namespace dxvk {
if (GetNeedsUpload(Subresource)) {
m_device->FlushImage(this, Subresource);
SetNeedsUpload(Subresource, false);
if (!NeedsAnyUpload())
m_device->MarkTextureUploaded(this);
}
}
}

View File

@ -4891,12 +4891,11 @@ namespace dxvk {
void D3D9DeviceEx::UploadManagedTexture(D3D9CommonTexture* pResource) {
for (uint32_t i = 0; i < pResource->GetUploadBitmask().dwordCount(); i++) {
for (uint32_t subresources = pResource->GetUploadBitmask().dword(i); subresources; subresources &= subresources - 1) {
uint32_t subresource = i * 32 + bit::tzcnt(subresources);
for (uint32_t subresource = 0; subresource < pResource->CountSubresources(); subresource++) {
if (!pResource->GetNeedsUpload(subresource))
continue;
this->FlushImage(pResource, subresource);
}
this->FlushImage(pResource, subresource);
}
pResource->ClearNeedsUpload();
@ -4958,6 +4957,18 @@ namespace dxvk {
}
void D3D9DeviceEx::MarkTextureUploaded(D3D9CommonTexture* pResource) {
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_activeTexturesToUpload &= ~(1 << i);
}
}
template <bool Points>
void D3D9DeviceEx::UpdatePointMode() {
if constexpr (!Points) {

View File

@ -758,6 +758,8 @@ namespace dxvk {
void MarkTextureMipsUnDirty(D3D9CommonTexture* pResource);
void MarkTextureUploaded(D3D9CommonTexture* pResource);
template <bool Points>
void UpdatePointMode();