mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[dxvk] Factor out waiting for resource to become idle
And use the new generic spin function to reduce syscall spam.
This commit is contained in:
parent
da506f5932
commit
ba213c1fa0
@ -616,8 +616,7 @@ namespace dxvk {
|
||||
Flush();
|
||||
SynchronizeCsThread();
|
||||
|
||||
while (Resource->isInUse(access))
|
||||
dxvk::this_thread::yield();
|
||||
Resource->waitIdle(access);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3779,8 +3779,7 @@ namespace dxvk {
|
||||
Flush();
|
||||
SynchronizeCsThread();
|
||||
|
||||
while (Resource->isInUse(access))
|
||||
dxvk::this_thread::yield();
|
||||
Resource->waitIdle(access);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,6 +69,19 @@ namespace dxvk {
|
||||
: m_useCountW) -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Waits for resource to become unused
|
||||
*
|
||||
* Blocks calling thread until the GPU finishes
|
||||
* using the resource with the given access type.
|
||||
* \param [in] access Access type to check for
|
||||
*/
|
||||
void waitIdle(DxvkAccess access = DxvkAccess::Read) const {
|
||||
sync::spin(50000, [this, access] {
|
||||
return !isInUse(access);
|
||||
});
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user