mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-06 20:58:37 +01:00
[dxvk] Removed redundant frameId tracking in frame pacer
This commit is contained in:
parent
869cf25f7f
commit
3720d3e0e8
3 changed files with 6 additions and 13 deletions
|
@ -128,7 +128,8 @@ namespace dxvk {
|
||||||
virtual void notifyCpuPresentEnd(
|
virtual void notifyCpuPresentEnd(
|
||||||
uint64_t frameId) = 0;
|
uint64_t frameId) = 0;
|
||||||
|
|
||||||
virtual void notifySubmit() { }
|
virtual void notifySubmit(
|
||||||
|
uint64_t frameId) { }
|
||||||
virtual void notifyPresent(
|
virtual void notifyPresent(
|
||||||
uint64_t frameId) { }
|
uint64_t frameId) { }
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace dxvk {
|
||||||
DxvkLatencyInfo latencyInfo,
|
DxvkLatencyInfo latencyInfo,
|
||||||
DxvkSubmitStatus* status) {
|
DxvkSubmitStatus* status) {
|
||||||
if (latencyInfo.tracker)
|
if (latencyInfo.tracker)
|
||||||
latencyInfo.tracker->notifySubmit();
|
latencyInfo.tracker->notifySubmit(latencyInfo.frameId);
|
||||||
std::unique_lock<dxvk::mutex> lock(m_mutex);
|
std::unique_lock<dxvk::mutex> lock(m_mutex);
|
||||||
|
|
||||||
m_finishCond.wait(lock, [this] {
|
m_finishCond.wait(lock, [this] {
|
||||||
|
|
|
@ -55,8 +55,8 @@ namespace dxvk {
|
||||||
m->csFinished = std::chrono::duration_cast<microseconds>(now - m->start).count();
|
m->csFinished = std::chrono::duration_cast<microseconds>(now - m->start).count();
|
||||||
}
|
}
|
||||||
|
|
||||||
void notifySubmit() override {
|
void notifySubmit( uint64_t frameId ) override {
|
||||||
LatencyMarkers* m = m_latencyMarkersStorage.getMarkers(m_lastSubmitFrameId+1);
|
LatencyMarkers* m = m_latencyMarkersStorage.getMarkers(frameId);
|
||||||
m->gpuSubmit.push_back(high_resolution_clock::now());
|
m->gpuSubmit.push_back(high_resolution_clock::now());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,6 @@ namespace dxvk {
|
||||||
// dx to vk translation is finished
|
// dx to vk translation is finished
|
||||||
if (frameId != 0) {
|
if (frameId != 0) {
|
||||||
auto now = high_resolution_clock::now();
|
auto now = high_resolution_clock::now();
|
||||||
m_lastSubmitFrameId = frameId;
|
|
||||||
LatencyMarkers* m = m_latencyMarkersStorage.getMarkers(frameId);
|
LatencyMarkers* m = m_latencyMarkersStorage.getMarkers(frameId);
|
||||||
LatencyMarkers* next = m_latencyMarkersStorage.getMarkers(frameId+1);
|
LatencyMarkers* next = m_latencyMarkersStorage.getMarkers(frameId+1);
|
||||||
m->gpuSubmit.push_back(now);
|
m->gpuSubmit.push_back(now);
|
||||||
|
@ -76,7 +75,6 @@ namespace dxvk {
|
||||||
}
|
}
|
||||||
|
|
||||||
void notifyQueueSubmit( uint64_t frameId ) override {
|
void notifyQueueSubmit( uint64_t frameId ) override {
|
||||||
assert( frameId == m_lastQueueSubmitFrameId + 1 );
|
|
||||||
auto now = high_resolution_clock::now();
|
auto now = high_resolution_clock::now();
|
||||||
LatencyMarkers* m = m_latencyMarkersStorage.getMarkers(frameId);
|
LatencyMarkers* m = m_latencyMarkersStorage.getMarkers(frameId);
|
||||||
m->gpuQueueSubmit.push_back(now);
|
m->gpuQueueSubmit.push_back(now);
|
||||||
|
@ -86,7 +84,6 @@ namespace dxvk {
|
||||||
void notifyQueuePresentBegin( uint64_t frameId ) override {
|
void notifyQueuePresentBegin( uint64_t frameId ) override {
|
||||||
if (frameId != 0) {
|
if (frameId != 0) {
|
||||||
auto now = high_resolution_clock::now();
|
auto now = high_resolution_clock::now();
|
||||||
m_lastQueueSubmitFrameId = frameId;
|
|
||||||
LatencyMarkers* m = m_latencyMarkersStorage.getMarkers(frameId);
|
LatencyMarkers* m = m_latencyMarkersStorage.getMarkers(frameId);
|
||||||
LatencyMarkers* next = m_latencyMarkersStorage.getMarkers(frameId+1);
|
LatencyMarkers* next = m_latencyMarkersStorage.getMarkers(frameId+1);
|
||||||
m->gpuQueueSubmit.push_back(now);
|
m->gpuQueueSubmit.push_back(now);
|
||||||
|
@ -97,14 +94,13 @@ namespace dxvk {
|
||||||
|
|
||||||
void notifyGpuExecutionEnd( uint64_t frameId ) override {
|
void notifyGpuExecutionEnd( uint64_t frameId ) override {
|
||||||
auto now = high_resolution_clock::now();
|
auto now = high_resolution_clock::now();
|
||||||
LatencyMarkers* m = m_latencyMarkersStorage.getMarkers(m_lastFinishedFrameId+1);
|
LatencyMarkers* m = m_latencyMarkersStorage.getMarkers(frameId);
|
||||||
m->gpuReady.push_back(now);
|
m->gpuReady.push_back(now);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void notifyGpuPresentBegin( uint64_t frameId ) override {
|
virtual void notifyGpuPresentBegin( uint64_t frameId ) override {
|
||||||
// we get frameId == 0 for repeated presents (SyncInterval)
|
// we get frameId == 0 for repeated presents (SyncInterval)
|
||||||
if (frameId != 0) {
|
if (frameId != 0) {
|
||||||
m_lastFinishedFrameId = frameId;
|
|
||||||
auto now = high_resolution_clock::now();
|
auto now = high_resolution_clock::now();
|
||||||
|
|
||||||
LatencyMarkers* m = m_latencyMarkersStorage.getMarkers(frameId);
|
LatencyMarkers* m = m_latencyMarkersStorage.getMarkers(frameId);
|
||||||
|
@ -172,10 +168,6 @@ namespace dxvk {
|
||||||
|
|
||||||
std::unique_ptr<FramePacerMode> m_mode;
|
std::unique_ptr<FramePacerMode> m_mode;
|
||||||
|
|
||||||
uint64_t m_lastSubmitFrameId = { DXGI_MAX_SWAP_CHAIN_BUFFERS };
|
|
||||||
uint64_t m_lastQueueSubmitFrameId = { DXGI_MAX_SWAP_CHAIN_BUFFERS };
|
|
||||||
uint64_t m_lastFinishedFrameId = { DXGI_MAX_SWAP_CHAIN_BUFFERS };
|
|
||||||
|
|
||||||
std::array< std::atomic< uint16_t >, 8 > m_gpuStarts = { };
|
std::array< std::atomic< uint16_t >, 8 > m_gpuStarts = { };
|
||||||
static constexpr uint16_t queueSubmitBit = 1;
|
static constexpr uint16_t queueSubmitBit = 1;
|
||||||
static constexpr uint16_t gpuReadyBit = 2;
|
static constexpr uint16_t gpuReadyBit = 2;
|
||||||
|
|
Loading…
Add table
Reference in a new issue