Merge agent/dlss: DLSS Super Resolution through the title's FidelityFX dispatch (VICTORY_DLSS), DLSS Frame Generation (VICTORY_FRAMEGEN), both off by default; Streamline loaded at run time from outside the repo
Co-Authored-By: Claude Opus 5.5 <[email protected]> # Conflicts: # crates/victory-gpu/src/host.rs
This commit is contained in:
commit
89dca0a59c
16 files changed
+3589
-12
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 =
|
||||
@@ -1217,6 +1223,9 @@ pub(crate) struct HostList {
|
||||
indirect_run: Mutex<Option<(crate::indirect::merge::Run, Option<crate::indirect::merge::Held>)>>,
|
||||
/// Whether an execution is held back.
|
||||
holding: std::sync::atomic::AtomicBool,
|
||||
/// 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
|
||||
@@ -4161,6 +4170,7 @@ impl Host {
|
||||
title_calls: std::sync::atomic::AtomicU64::new(0),
|
||||
indirect_run: Mutex::default(),
|
||||
holding: std::sync::atomic::AtomicBool::new(false),
|
||||
upscale: std::sync::atomic::AtomicU64::new(0),
|
||||
_alive: Counted::new(),
|
||||
#[cfg(feature = "diagnostics")]
|
||||
notes,
|
||||
@@ -5534,6 +5544,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")]
|
||||
@@ -6388,6 +6406,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();
|
||||
@@ -7367,6 +7386,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) {
|
||||
@@ -8859,6 +8888,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);
|
||||
two_queues::line(frames);
|
||||
#[cfg(feature = "diagnostics")]
|
||||
@@ -9201,6 +9231,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
|
||||
@@ -9420,7 +9451,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());
|
||||
@@ -9460,9 +9501,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