mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-02 04:29:14 +01:00
[d3d11] Optimize WaitForResource behaviour when resource is already idle
We don't have to flush everything in this case, just flushing the current CS chunk is enough to determine if the resource is in use by the GPU.
This commit is contained in:
parent
662b6429a8
commit
adadf362a3
@ -521,16 +521,24 @@ namespace dxvk {
|
||||
// Wait for the any pending D3D11 command to be executed
|
||||
// on the CS thread so that we can determine whether the
|
||||
// resource is currently in use or not.
|
||||
Flush();
|
||||
FlushCsChunk();
|
||||
SynchronizeCsThread();
|
||||
|
||||
if (Resource->isInUse()) {
|
||||
if (MapFlags & D3D11_MAP_FLAG_DO_NOT_WAIT)
|
||||
if (MapFlags & D3D11_MAP_FLAG_DO_NOT_WAIT) {
|
||||
// We don't have to wait, but misbehaving games may
|
||||
// still try to spin on `Map` until the resource is
|
||||
// idle, so we should flush pending commands
|
||||
FlushImplicit();
|
||||
return false;
|
||||
|
||||
// TODO implement properly in DxvkDevice
|
||||
while (Resource->isInUse())
|
||||
dxvk::this_thread::yield();
|
||||
} else {
|
||||
// Make sure pending commands using the resource get
|
||||
// executed on the the GPU if we have to wait for it
|
||||
Flush();
|
||||
|
||||
while (Resource->isInUse())
|
||||
dxvk::this_thread::yield();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user