Skip to content

Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.

C++

diag(present): date earlier VSync presents through the bound only in bursts

Veyra Goal Agent4844dce57698
diff --git a/src/gfx/PresentSink.cpp b/src/gfx/PresentSink.cpp
index c409fa4f..47bcf64a 100644
--- a/src/gfx/PresentSink.cpp
+++ b/src/gfx/PresentSink.cpp
@@ -514,10 +514,18 @@ void PresentSink::sampleDisplayLatency(){
// newest one: under VSync each holds at least one vblank, so present p was
// on screen no later than (PresentCount - p) vblanks earlier. Counting them
// with that bound keeps bursts of late frames in the sample instead of
- // keeping only the newest (and least delayed) one of each burst.
+ // keeping only the newest (and least delayed) one of each burst. The
+ // bound is only tight for a burst: presents issued at most about one
+ // refresh apart. After an idle gap the older present's vblank is unknown
+ // and it is skipped; dating it through the bound reported a 60 fps frame
+ // on a 320 Hz panel, shown ~5 ms after its Present, as ~19 ms (31 ms) when
+ // the statistics trailed by one (two) presents (2026-10-14).
+ double newestQpc=0;
+ for(const auto& pending:pendingPresents_)if(pending.qpc&&pending.id==stats.PresentCount)newestQpc=double(pending.qpc);
for(const auto& pending:pendingPresents_){
if(!pending.qpc||pending.id>stats.PresentCount||(previous&&pending.id<=previous)||stats.PresentCount-pending.id>=pendingPresents_.size())continue;
if(pending.replaceable&&pending.id!=stats.PresentCount)continue;
+ if(pending.id!=stats.PresentCount&&(!newestQpc||newestQpc-double(pending.qpc)>double(stats.PresentCount-pending.id)*period*1.25))continue;
const double ms=(scanout-double(stats.PresentCount-pending.id)*period-double(pending.qpc))*1000.0/frequency;
if(ms>=0&&ms<1000&&displayLatencyMs_.size()<4096)displayLatencyMs_.push_back(ms);
}