mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-01 08:52:11 +01:00
[dxvk] Add method to wait for fence as a GPU sync point
This commit is contained in:
parent
3c389ae06b
commit
85684109b3
@ -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) {
|
void DxvkDevice::waitForResource(const DxvkPagedResource& resource, DxvkAccess access) {
|
||||||
if (resource.isInUse(access)) {
|
if (resource.isInUse(access)) {
|
||||||
auto t0 = dxvk::high_resolution_clock::now();
|
auto t0 = dxvk::high_resolution_clock::now();
|
||||||
|
@ -518,6 +518,17 @@ namespace dxvk {
|
|||||||
*/
|
*/
|
||||||
VkResult waitForSubmission(DxvkSubmitStatus* status);
|
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
|
* \brief Waits for resource to become idle
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user