The host FidelityFX path (VICTORY_FIDELITYFX_DIR) and what the console upscaler's shaders need (dot4 instructions, packed f16, typed clears, feature queries). 64-bit typed atomics for the alpha prepasses. The BVH intersection instruction on the host (boxes, triangles, sorting). Lane masks in mesh and pixel programs: stale registers behind dead edges, masks spilled to VGPR lanes, fire-light loops over the host wave. A per-slot stride table for structured buffers taken from the heap. image_gather4_l, LDS byte and half accesses, hardware SGPR inputs. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
49 lines
1.8 KiB
Rust
49 lines
1.8 KiB
Rust
//! Host work that a host library records into a title's command list in
|
|
//! place of a console one (the host's FidelityFX upscaler, say): the host
|
|
//! device, a title texture's host copy in the state the library is told,
|
|
//! and the host list itself.
|
|
|
|
use windows::Win32::Graphics::Direct3D12::{
|
|
ID3D12Device, ID3D12GraphicsCommandList, ID3D12Resource,
|
|
};
|
|
|
|
use crate::object::Object;
|
|
|
|
/// The host D3D12 device, created on first use; `None` without a host GPU.
|
|
pub fn host_device() -> Option<ID3D12Device> {
|
|
crate::host::host().map(|h| h.device.clone())
|
|
}
|
|
|
|
/// A title texture's host copy, moved to the host resource `state` in the
|
|
/// title list `list`, and the state it is in: `state` without the bits the
|
|
/// host copy cannot take (see `host::legal_state`). What the list records
|
|
/// next finds it there and must leave it there. The list holds the texture
|
|
/// until it is reset. `None` for a buffer, or without a host list.
|
|
pub fn host_texture(
|
|
list: *const Object,
|
|
resource: *const Object,
|
|
state: u32,
|
|
) -> Option<(ID3D12Resource, u32)> {
|
|
let host = crate::list::host_list(list)?;
|
|
let texture = crate::resource::host_resource(resource)?.clone();
|
|
crate::list::ensure_state(host, resource, state);
|
|
let state = crate::host::legal_state(&texture, state);
|
|
Some((texture, state))
|
|
}
|
|
|
|
/// Runs `f` with the host list behind the title list `list` (open for
|
|
/// recording); `None` without one. What `f` binds (descriptor heaps, root
|
|
/// signatures, pipeline) is replaced before the list's next draw or
|
|
/// dispatch.
|
|
pub fn record<R>(
|
|
list: *const Object,
|
|
f: impl FnOnce(&ID3D12GraphicsCommandList) -> R,
|
|
) -> Option<R> {
|
|
let mut out = None;
|
|
crate::list::with_state(list, |host, state| {
|
|
out = Some(f(&host.list));
|
|
state.host_state_lost();
|
|
});
|
|
out
|
|
}
|