Merge VIctory-7900XTX (0a43566) with RTX 5090 fidelity & 32 GB RAM optimizations: two-plane compose, fallback heaps, TablePlan, residency guard, 256 MiB DirectStorage, and WaitOnAddress fence wakes

This commit is contained in:
codec_d committed 2026-11-25 14:43:52 -08:00
1 parent aebe5a0622
commit f5847e6248
13 files changed
+974 -129

No files matched your search

+55 -16
View File
@@ -801,6 +801,8 @@ impl Written {
} else {
at.cast::<u64>().write_unaligned(value);
}
#[cfg(windows)]
windows_sys::Win32::System::Threading::WakeByAddressAll(at.cast());
}
}
}
@@ -927,29 +929,33 @@ extern "system" fn present(
#[cfg(windows)]
if behind::on() && !this.is_null() {
const COPY_SOURCE: u32 = 0x800;
let texture = if planes > 0
let take_plane = |index: usize| -> Option<(usize, std::sync::Arc<crate::resource::HostTexture>, u32)> {
if planes as usize <= index || plane_parameters.is_null() {
return None;
}
// SAFETY: the title passes `planes` plane descriptions.
&& let Some(plane) = unsafe { plane_parameters.as_ref() }
&& plane.count > 0
&& !plane.resources.is_null()
{
let plane = unsafe { plane_parameters.add(index).as_ref()? };
if plane.count == 0 || plane.resources.is_null() {
return None;
}
// SAFETY: the plane lists `count` resources.
let resource = unsafe { *plane.resources };
// The state the lists recorded so far leave it in (the next
// frame's, recorded before this is shown, go on from there).
crate::resource::host_copy(resource).map(|copy| {
let state = crate::resource::host_transition(resource, COPY_SOURCE).map_or(COPY_SOURCE, |(_, before)| before);
crate::resource::host_transition(resource, state);
// (Lists not translated yet leave it in no state yet: the
// one it is in when its turn in the line comes.)
let state = if crate::list::thin::wanted() { u32::MAX } else { state };
(resource as usize, copy, state)
})
} else {
None
};
let texture = take_plane(0);
let overlay = take_plane(1).filter(|o| texture.as_ref().is_none_or(|t| t.0 != o.0));
let resource = texture.as_ref().map_or(0, |t| t.0);
behind::present(this, texture.map(|(_, copy, state)| (copy, state)), Shown { frame, resource });
behind::present(
this,
texture.map(|(_, copy, state)| (copy, state)),
overlay.map(|(_, copy, state)| (copy, state)),
Shown { frame, resource },
);
called.end();
#[cfg(feature = "diagnostics")]
frame_ends();
@@ -969,8 +975,36 @@ extern "system" fn present(
const COPY_SOURCE: u32 = 0x800;
let state = crate::resource::host_transition(resource, COPY_SOURCE)
.map_or(COPY_SOURCE, |(_, before)| before);
show(texture, state, Shown { frame, resource: resource as usize });
let overlay = if planes > 1
// SAFETY: `planes > 1`, so index 1 is within `plane_parameters`.
&& let Some(over_plane) = unsafe { plane_parameters.add(1).as_ref() }
&& over_plane.count > 0
&& !over_plane.resources.is_null()
{
// SAFETY: `over_plane.count > 0`, so `*over_plane.resources` is valid.
let over_res = unsafe { *over_plane.resources };
if over_res != resource {
crate::resource::host_resource(over_res).map(|over_tex| {
let over_state = crate::resource::host_transition(over_res, COPY_SOURCE)
.map_or(COPY_SOURCE, |(_, before)| before);
(over_res, over_tex, over_state)
})
} else {
None
}
} else {
None
};
show_planes(
texture,
state,
overlay.as_ref().map(|(_, tex, st)| (*tex, *st)),
Shown { frame, resource: resource as usize },
);
crate::resource::host_transition(resource, state);
if let Some((over_res, _, over_state)) = overlay {
crate::resource::host_transition(over_res, over_state);
}
let _ = host;
}
#[cfg(not(windows))]
@@ -1001,13 +1035,18 @@ struct Shown {
resource: usize,
}
/// Shows `texture`, in host state `state`, in our window.
/// Shows `texture` (with optional `overlay` plane blended over it) in our window.
#[cfg(windows)]
fn show(texture: &windows::Win32::Graphics::Direct3D12::ID3D12Resource, state: u32, what: Shown) {
fn show_planes(
texture: &windows::Win32::Graphics::Direct3D12::ID3D12Resource,
state: u32,
overlay: Option<(&windows::Win32::Graphics::Direct3D12::ID3D12Resource, u32)>,
what: Shown,
) {
let Some(host) = crate::host::host() else {
return;
};
let shown = host.present(texture, state, what.frame);
let shown = host.present_planes(texture, state, overlay, what.frame);
#[cfg(feature = "diagnostics")]
blinks(what.frame, what.resource as This, state, shown);
#[cfg(not(feature = "diagnostics"))]