mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-23 19:54:16 +01:00
[dxvk] Add latency tracker to context
This commit is contained in:
parent
fa6c32684a
commit
1dee62ebfc
@ -110,9 +110,45 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::beginLatencyTracking(
|
||||
const Rc<DxvkLatencyTracker>& tracker,
|
||||
uint64_t frameId) {
|
||||
if (tracker && !m_latencyTracker) {
|
||||
tracker->notifyCsRenderBegin(frameId);
|
||||
|
||||
m_latencyTracker = tracker;
|
||||
m_latencyFrameId = frameId;
|
||||
|
||||
m_endLatencyTracking = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::endLatencyTracking(
|
||||
const Rc<DxvkLatencyTracker>& tracker) {
|
||||
if (tracker && tracker == m_latencyTracker)
|
||||
m_endLatencyTracking = true;
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::flushCommandList(DxvkSubmitStatus* status) {
|
||||
// Need to call this before submitting so that the last GPU
|
||||
// submission does not happen before the render end signal.
|
||||
if (m_endLatencyTracking && m_latencyTracker)
|
||||
m_latencyTracker->notifyCsRenderEnd(m_latencyFrameId);
|
||||
|
||||
m_device->submitCommandList(this->endRecording(),
|
||||
nullptr, 0, status);
|
||||
m_latencyTracker, m_latencyFrameId, status);
|
||||
|
||||
// Ensure that subsequent submissions do not see the tracker.
|
||||
// It is important to hide certain internal submissions in
|
||||
// case the application is CPU-bound.
|
||||
if (m_endLatencyTracking) {
|
||||
m_latencyTracker = nullptr;
|
||||
m_latencyFrameId = 0u;
|
||||
|
||||
m_endLatencyTracking = false;
|
||||
}
|
||||
|
||||
this->beginRecording(
|
||||
m_device->createCommandList());
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "dxvk_bind_mask.h"
|
||||
#include "dxvk_cmdlist.h"
|
||||
#include "dxvk_context_state.h"
|
||||
#include "dxvk_latency.h"
|
||||
#include "dxvk_objects.h"
|
||||
#include "dxvk_queue.h"
|
||||
#include "dxvk_util.h"
|
||||
@ -68,6 +69,30 @@ namespace dxvk {
|
||||
*/
|
||||
void endFrame();
|
||||
|
||||
/**
|
||||
* \brief Begins latency tracking
|
||||
*
|
||||
* Notifies the beginning of a frame on the CS timeline
|
||||
* an ensures that subsequent submissions are associated
|
||||
* with the correct frame ID. Only one tracker can be
|
||||
* active at any given time.
|
||||
* \param [in] tracker Latency tracker object
|
||||
* \param [in] frameId Current frame ID
|
||||
*/
|
||||
void beginLatencyTracking(
|
||||
const Rc<DxvkLatencyTracker>& tracker,
|
||||
uint64_t frameId);
|
||||
|
||||
/**
|
||||
* \brief Ends latency tracking
|
||||
*
|
||||
* Notifies the end of the frame. Ignored if the
|
||||
* tracker is not currently active.
|
||||
* \param [in] tracker Latency tracker object
|
||||
*/
|
||||
void endLatencyTracking(
|
||||
const Rc<DxvkLatencyTracker>& tracker);
|
||||
|
||||
/**
|
||||
* \brief Flushes command buffer
|
||||
*
|
||||
@ -1421,6 +1446,10 @@ namespace dxvk {
|
||||
std::vector<util::DxvkDebugLabel> m_debugLabelStack;
|
||||
bool m_debugLabelInternalActive = false;
|
||||
|
||||
Rc<DxvkLatencyTracker> m_latencyTracker;
|
||||
uint64_t m_latencyFrameId = 0u;
|
||||
bool m_endLatencyTracking = false;
|
||||
|
||||
void blitImageFb(
|
||||
Rc<DxvkImageView> dstView,
|
||||
const VkOffset3D* dstOffsets,
|
||||
|
Loading…
x
Reference in New Issue
Block a user