DLSS and DLSS Frame Generation through NVIDIA Streamline (switches, GPU side)
VICTORY_DLSS=1: an upscaling the title asks for is recorded by DLSS Super Resolution at the same place of the title's command list, from the same colour, depth, motion vectors, exposure and reactive mask into the same output: a step of ours in the list (list::external; with VICTORY_THIN=1 an op in the list's stream, run where it is translated), the inputs prepared as a compute shader's would be, moved to the states the title gave, handed to slEvaluateFeature as local tags, the title's draw state set again after. The DLSS mode follows the render and output sizes (the smallest whose optimal size holds the render); preset from VICTORY_DLSS_PRESET; constants from the dispatch (jitter, motion-vector scale, near, far, field of view, reset, context flags). VICTORY_FRAMEGEN=1 (needs the line of submissions): the device is handed to Streamline, the direct queue is made through its device proxy and our swap chain through its factory proxy (manual hooking, nothing hooked globally). A host list that recorded an upscaling is noted; at its submission its depth and motion vectors become the latest, and the next present tags them (states the submissions left them in), sets constants and the latency markers, and switches frame generation on; off on presents without an upscaling. Series S's interface plane is tagged as the interface over the scene plane. Streamline is loaded at run time from VICTORY_STREAMLINE_DIR (default C:\dev\sdk\streamline-sdk-v2.14.16\bin\x64) after an Authenticode check, with no downloads; anything missing leaves the title's upscaling and our present as they were. The C ABI is written by hand from the SDK 2.14 headers (offsets asserted as the SDK asserts them); no NVIDIA file is in the repository. Log lines: support and requirements, feature versions, the first recording and every change of mode or size, per second the upscalings done, failed and left to the title, frame generation on/off, frames shown and status. streamline::check backs `victory upscaler-check`. The external-work helpers (host textures in a given state, inputs prepared as for a compute view, output written on the host) are ported from DexNom/VIctory (crates/victory-gpu/src/external.rs, GPL-3.0-or-later); the FidelityFX state mapping is from its fidelityfx.rs. Not run with the title yet: `victory upscaler-check` (no device) loads Streamline 2.14.16 on the RTX 4070 SUPER, driver 621.01: DLSS, DLSS Frame Generation and Reflex supported. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
717687b43f
commit
fc8b9caeb3
9 files changed
+2805
-8
No files matched your search
@@ -954,10 +954,16 @@ fn create() -> windows::core::Result<Host> {
|
||||
let messages = debug
|
||||
.then(|| device.cast::<ID3D12InfoQueue>().ok())
|
||||
.flatten();
|
||||
let queue: ID3D12CommandQueue = device.CreateCommandQueue(&D3D12_COMMAND_QUEUE_DESC {
|
||||
Type: D3D12_COMMAND_LIST_TYPE_DIRECT,
|
||||
..Default::default()
|
||||
})?;
|
||||
// Streamline is given the device (DLSS, `VICTORY_DLSS`); for frame
|
||||
// generation (`VICTORY_FRAMEGEN`) the direct queue is made through
|
||||
// its device proxy.
|
||||
let queue: ID3D12CommandQueue = match crate::streamline::device_made(&device) {
|
||||
Some(queue) => queue,
|
||||
None => device.CreateCommandQueue(&D3D12_COMMAND_QUEUE_DESC {
|
||||
Type: D3D12_COMMAND_LIST_TYPE_DIRECT,
|
||||
..Default::default()
|
||||
})?,
|
||||
};
|
||||
let fence: ID3D12Fence = device.CreateFence(0, D3D12_FENCE_FLAG_NONE)?;
|
||||
let event = CreateEventW(None, false, false, None)?;
|
||||
let rtvs: ID3D12DescriptorHeap =
|
||||
@@ -1210,6 +1216,9 @@ pub(crate) struct HostList {
|
||||
/// depends on ([`HostList::changed_something`]); no two lists have the
|
||||
/// same.
|
||||
epoch: std::sync::atomic::AtomicU64,
|
||||
/// The upscaling (`crate::streamline`) recorded in the list, noted for
|
||||
/// the present after its submission; 0 for none.
|
||||
upscale: std::sync::atomic::AtomicU64,
|
||||
/// Counts the list in [`ALIVE`] while it lives.
|
||||
_alive: Counted,
|
||||
/// The texts of the markers `note_op` set, in order (for device-removed
|
||||
@@ -4118,6 +4127,7 @@ impl Host {
|
||||
batch_args: Mutex::default(),
|
||||
coming: Mutex::default(),
|
||||
epoch: std::sync::atomic::AtomicU64::new(next_epoch()),
|
||||
upscale: std::sync::atomic::AtomicU64::new(0),
|
||||
_alive: Counted::new(),
|
||||
#[cfg(feature = "diagnostics")]
|
||||
notes,
|
||||
@@ -5491,6 +5501,14 @@ impl Host {
|
||||
// and the ranges shaders write are per host copy, not per submission.
|
||||
let mut stage = crate::timeline::span("submit: the submission lock");
|
||||
let mut submitted = self.submitted.lock().unwrap_or_else(|e| e.into_inner());
|
||||
// Upscalings these lists recorded, in submission order: the next
|
||||
// present tags the latest (frame generation).
|
||||
for run in runs {
|
||||
let id = run.take_upscale();
|
||||
if id != 0 {
|
||||
crate::streamline::submitted(id);
|
||||
}
|
||||
}
|
||||
let was_working = working(true);
|
||||
submitting(1, runs.len());
|
||||
#[cfg(feature = "diagnostics")]
|
||||
@@ -6335,6 +6353,7 @@ impl HostList {
|
||||
let started = std::time::Instant::now();
|
||||
let _resetting = crate::timeline::span("resetting a host list");
|
||||
self._alive.used();
|
||||
self.upscale.store(0, Ordering::Relaxed);
|
||||
*self.coming.lock().unwrap_or_else(|e| e.into_inner()) = None;
|
||||
*self.deferred() = Deferred::default();
|
||||
self.states.lock().unwrap_or_else(|e| e.into_inner()).clear();
|
||||
@@ -7267,6 +7286,16 @@ impl HostList {
|
||||
self.deferred().textures.contains(&key)
|
||||
}
|
||||
|
||||
/// The list recorded upscaling `id` (`crate::streamline`).
|
||||
pub(crate) fn mark_upscale(&self, id: u64) {
|
||||
self.upscale.store(id, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
/// The upscaling the list recorded, taken (0 for none).
|
||||
pub(crate) fn take_upscale(&self) -> u64 {
|
||||
self.upscale.swap(0, Ordering::Relaxed)
|
||||
}
|
||||
|
||||
/// Runs `work` when the list is submitted, in order with its copies.
|
||||
/// `work` may write title memory (refreshes after it copy again).
|
||||
pub(crate) fn defer(&self, work: impl Fn() + Send + 'static) {
|
||||
@@ -8752,6 +8781,7 @@ impl Meter {
|
||||
crate::descriptor::sync_line(frames);
|
||||
late_line(frames);
|
||||
crate::queue::behind_line(frames);
|
||||
crate::streamline::line(frames);
|
||||
card_clock_line(frames, ms);
|
||||
#[cfg(feature = "diagnostics")]
|
||||
spans::line(frames);
|
||||
@@ -9093,6 +9123,7 @@ impl Host {
|
||||
if (p.width, p.height, p.format) != (width, height, format) {
|
||||
// Presents sent ahead hold back buffers until they have run.
|
||||
settle_now(WHY_SYNC);
|
||||
crate::streamline::resizing();
|
||||
// SAFETY: no back buffer is held; every submission was waited for.
|
||||
let resized = unsafe {
|
||||
p.swap_chain
|
||||
@@ -9312,7 +9343,17 @@ impl Host {
|
||||
#[cfg(feature = "diagnostics")]
|
||||
crate::replay::record::present(texture, state);
|
||||
let mut showing = crate::timeline::span("the host's Present");
|
||||
// Frame generation: the frame's markers, constants and tags.
|
||||
let presenting = crate::streamline::present_begins(
|
||||
frame,
|
||||
crate::streamline::Planes {
|
||||
base: (texture, state_u32),
|
||||
overlay: overlay.filter(|_| composed),
|
||||
size: [width, height],
|
||||
},
|
||||
);
|
||||
let _ = p.swap_chain.Present(0, DXGI_PRESENT(0));
|
||||
crate::streamline::present_ends(presenting);
|
||||
showing.next("the frame meter");
|
||||
#[cfg(feature = "diagnostics")]
|
||||
p.panel.frame(p.meter.line_due());
|
||||
@@ -9352,9 +9393,24 @@ impl Host {
|
||||
SwapEffect: DXGI_SWAP_EFFECT_FLIP_DISCARD,
|
||||
..Default::default()
|
||||
};
|
||||
let swap_chain = factory
|
||||
.CreateSwapChainForHwnd(&self.queue, hwnd, &desc, None, None)?
|
||||
.cast::<IDXGISwapChain3>()?;
|
||||
// With frame generation, through Streamline's factory proxy and
|
||||
// on its queue proxy: the swap chain is its proxy.
|
||||
let proxied = crate::streamline::swap_chain_factory(&factory).map(|(proxy, queue)| {
|
||||
proxy
|
||||
.CreateSwapChainForHwnd(&queue, hwnd, &desc, None, None)
|
||||
.and_then(|s| s.cast::<IDXGISwapChain3>())
|
||||
});
|
||||
let swap_chain = match proxied {
|
||||
Some(Ok(swap_chain)) => {
|
||||
crate::streamline::swap_chain_made(true, None);
|
||||
swap_chain
|
||||
}
|
||||
Some(Err(e)) => {
|
||||
crate::streamline::swap_chain_made(false, Some(&e));
|
||||
factory.CreateSwapChainForHwnd(&self.queue, hwnd, &desc, None, None)?.cast::<IDXGISwapChain3>()?
|
||||
}
|
||||
None => factory.CreateSwapChainForHwnd(&self.queue, hwnd, &desc, None, None)?.cast::<IDXGISwapChain3>()?,
|
||||
};
|
||||
let copy = self.new_list()?;
|
||||
copy.close();
|
||||
tracing::info!(width, height, format = format.0, "presenting to a window");
|
||||
|
||||
Reference in new issue
Block a user