1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-31 23:52:20 +01:00

[dxvk] Add method to wait for fence as a GPU sync point

This commit is contained in:
Philip Rebohle 2024-10-30 16:01:17 +01:00
parent 3c389ae06b
commit 85684109b3
2 changed files with 27 additions and 0 deletions

View File

@ -292,6 +292,22 @@ namespace dxvk {
}
void DxvkDevice::waitForFence(sync::Fence& fence, uint64_t value) {
if (fence.value() >= value)
return;
auto t0 = dxvk::high_resolution_clock::now();
fence.wait(value);
auto t1 = dxvk::high_resolution_clock::now();
auto us = std::chrono::duration_cast<std::chrono::microseconds>(t1 - t0);
m_statCounters.addCtr(DxvkStatCounter::GpuSyncCount, 1);
m_statCounters.addCtr(DxvkStatCounter::GpuSyncTicks, us.count());
}
void DxvkDevice::waitForResource(const DxvkPagedResource& resource, DxvkAccess access) {
if (resource.isInUse(access)) {
auto t0 = dxvk::high_resolution_clock::now();

View File

@ -518,6 +518,17 @@ namespace dxvk {
*/
VkResult waitForSubmission(DxvkSubmitStatus* status);
/**
* \brief Waits for a fence to become signaled
*
* Treats the fence wait as a GPU sync point, which can
* be useful for device statistics. Should only be used
* if rendering is stalled because of this wait.
* \param [in] fence Fence to wait on
* \param [in] value Fence value
*/
void waitForFence(sync::Fence& fence, uint64_t value);
/**
* \brief Waits for resource to become idle
*