[d3d9] Ignore DISCARD after device loss

This commit is contained in:
Robin Kertels 2023-05-26 03:19:50 +02:00 committed by Joshie
parent 1850819483
commit 2c3f2b9ad1
1 changed files with 8 additions and 0 deletions

View File

@ -4328,6 +4328,10 @@ namespace dxvk {
if (unlikely((Flags & (D3DLOCK_DISCARD | D3DLOCK_NOOVERWRITE)) == (D3DLOCK_DISCARD | D3DLOCK_NOOVERWRITE)))
Flags &= ~D3DLOCK_DISCARD;
// Tests show that D3D9 drivers ignore DISCARD when the device is lost.
if (unlikely(m_deviceLostState != D3D9DeviceLostState::Ok))
Flags &= ~D3DLOCK_DISCARD;
auto& desc = *(pResource->Desc());
if (unlikely(!desc.IsLockable))
@ -4808,6 +4812,10 @@ namespace dxvk {
if (desc.Usage & D3DUSAGE_DYNAMIC)
Flags &= ~D3DLOCK_DONOTWAIT;
// Tests show that D3D9 drivers ignore DISCARD when the device is lost.
if (unlikely(m_deviceLostState != D3D9DeviceLostState::Ok))
Flags &= ~D3DLOCK_DISCARD;
// We only bounds check for MANAGED.
// (TODO: Apparently this is meant to happen for DYNAMIC too but I am not sure
// how that works given it is meant to be a DIRECT access..?)