Files
d4r/tools/d4r_frame_completion.h
T
ayo 6684888c0b Fix DLSS quality-change corruption and frame completion ordering
- Reprepare enc3 weights each launch to avoid stale caches after feature recreation
- Require per-slot input markers before evaluating recorded frames
- Advance split-frame timelines only through completed frames
- Add cancellation and readiness tests plus recreation consistency checks
- Update architecture and native kernel documentation

ref #8
2026-10-02 19:14:07 -04:00

35 lines
1021 B
C++

#pragma once
#include <cstdint>
#include <deque>
// A timeline signal releases every lower value too. Prep can cancel a later
// frame while the CUDA worker is still producing an earlier one, so only the
// completed prefix of admitted frames may be signalled. The caller serializes
// admission and retirement with the same mutex used for the timeline signal.
class D4rFrameCompletion
{
public:
void admit(uint32_t frame) { pending_.push_back({frame, false}); }
uint64_t retire(uint32_t frame)
{
for (auto& pending : pending_)
if (pending.frame == frame)
{
pending.done = true;
break;
}
while (!pending_.empty() && pending_.front().done)
{
completedThrough_ = pending_.front().frame;
pending_.pop_front();
}
return completedThrough_;
}
private:
struct Pending { uint32_t frame; bool done; };
std::deque<Pending> pending_;
uint64_t completedThrough_ = 0;
};