1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 01:24:11 +01:00

[d3d9] Handle edge cases around implicit discard

This commit is contained in:
Robin Kertels 2020-08-15 02:53:23 +02:00 committed by Joshie
parent ea53923406
commit 89d36e1d7f
2 changed files with 3 additions and 2 deletions

View File

@ -153,6 +153,7 @@ namespace dxvk {
return --m_lockCount;
}
uint32_t GetLockCount() const { return m_lockCount; }
void MarkUploaded() { m_needsUpload = false; }
void MarkNeedsUpload() { m_needsUpload = true; }

View File

@ -4004,7 +4004,7 @@ namespace dxvk {
if (alloced)
std::memset(physSlice.mapPtr, 0, physSlice.length);
else if ((managed || systemmem) && !skipWait) {
else if ((managed || (systemmem && !dirty)) && !(Flags & D3DLOCK_DONOTWAIT) && !skipWait) {
if (!WaitForResource(mappedBuffer, D3DLOCK_DONOTWAIT)) {
// if the mapped buffer is currently being copied to image
// we can just avoid a stall by allocating a new slice and copying the existing contents
@ -4350,7 +4350,7 @@ namespace dxvk {
quickRead ||
(boundsCheck && !pResource->DirtyRange().Overlaps(pResource->LockRange()));
if (!skipWait) {
if (IsPoolManaged(desc.Pool) || desc.Pool == D3DPOOL_SYSTEMMEM) {
if ((IsPoolManaged(desc.Pool) || desc.Pool == D3DPOOL_SYSTEMMEM) && !(Flags & D3DLOCK_DONOTWAIT) && pResource->GetLockCount() == 0) {
if (!WaitForResource(mappingBuffer, D3DLOCK_DONOTWAIT)) {
// if the mapped buffer is currently being copied to the primary buffer
// we can just avoid a stall by allocating a new slice and copying the existing contents