Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
c199e9f
Texture pool off by default on cards with 8 GB or less
Nov 28, 2026
4db0529
Launcher: VICTORY_HELPER_PRIORITY=on, helpers raised and list transla…
Nov 28, 2026
eff56d8
gpu: refresh host copies at the title's submit (VICTORY_REFRESH_AT_SU…
Nov 28, 2026
c10b409
gpu: refresh at submit only kernel-watched copies, and only with the …
Nov 28, 2026
a40ce77
gpu: refresh at submit on several threads, copies in the card's memor…
Nov 28, 2026
61986d6
gpu: the stale-copy warning says how the copy is watched and whether …
Nov 28, 2026
3e9a35f
gpu: freezes in play log 20261128-235457 -- letting go aside, upload …
Nov 29, 2026
038cb61
Launcher: finer host-copy windows on PCs with 16 GB of RAM or less, a…
Nov 29, 2026
b1804c4
Bench tools and the test reports of 2026-11-28/29 (RTX 5060 8 GB, Ryz…
Nov 29, 2026
10a71c5
gpu: windows left to the submission at submit, which side of a stale …
Nov 29, 2026
a7def83
Dropped draws and dispatches by cause, in a line after the frame line
Nov 29, 2026
685c4a8
docs: part E, the ray-tracing builder's dropped dispatches, what is m…
Nov 29, 2026
e2b4666
docs: part E, what v2026.11.29.01 changes (the builder translates on …
Nov 29, 2026
1ed2fbb
gpu: shadow::live_bytes, the memory host copies of title memory take
Nov 29, 2026
a570caf
gpu: frame lines of the refreshes, landing and new memory without the…
Nov 29, 2026
26ccbd4
gpu: texture::unchanged answered by the write watch while the memory …
Nov 29, 2026
4bad751
gpu: texture room as a margin under the budget (VICTORY_TEXTURE_ROOM_…
Nov 29, 2026
00cb3cd
gpu, xmem: process memory beside the census (shared sections, page fa…
Nov 29, 2026
63f6510
Merge port/texture: texture room margin, idle textures make way, memo…
Nov 29, 2026
adc7ac2
Merge port/refresh
Nov 29, 2026
5b0b961
Merge port/pipeline
Nov 29, 2026
6022d84
procmem: say where shadow::live_bytes is logged
Nov 29, 2026
aac8f89
docs: drop the two drafts of single pull requests, now in this one
Nov 29, 2026
da37c74
Run H on v2026.11.29.01 with this branch: report, log and memory samples
Nov 29, 2026
de432ca
bench.py: read the v2026.11.29.01 fps and room lines, and .gz logs
Nov 29, 2026
1db563f
docs: protocole des parties suivantes, repris de G et H
Nov 29, 2026
a13afdf
Textures in run H: cause, hot slots first, cold textures picked by in…
Nov 29, 2026
c763742
shadow: CPU mirrors of card copies committed only where touched (VICT…
Nov 29, 2026
37b8ea6
gpu: refreshes beside the submitting thread (VICTORY_REFRESH_BESIDE=1…
Nov 29, 2026
24a1cd3
Merge claude/base-mesure-299a39 into perf/integration-5
Nov 29, 2026
905ea14
Merge claude/test-rapports-c0246d into perf/integration-5
Nov 29, 2026
42f52eb
Merge claude/envoi-mt-dc6855 into perf/integration-5
Nov 29, 2026
79b7089
Merge claude/ram-prive-a5d3f2 into perf/integration-5
Nov 29, 2026
c7cf453
Merge claude/textures-file-99e9cc into perf/integration-5
Nov 29, 2026
d8c1d38
docs: partie I, v2026.11.29.01 seule, the base of H
Nov 29, 2026
e6efee3
docs: partie I, fix a stray control character in the logs path
Nov 29, 2026
23824e8
Merge claude/base-mesure-299a39 (partie I) into perf/integration-5
Nov 29, 2026
a71b948
docs: partie J, H + VICTORY_WINDOW_KB=4096 VICTORY_WINDOW_TAILS=0
Nov 29, 2026
69fb7e6
docs: partie J, heures des freezes et numéros des copies périmées
Nov 29, 2026
faa1d7c
Keep performance changes and move benchmarking to its own PR
Castyan Nov 29, 2026
0ec7253
Skip flat texture queue snapshots after the frame budget is spent
Castyan Nov 29, 2026
e86a842
Distinguish deferred pipeline compiles from driver failures
Castyan Nov 29, 2026
40f8c3d
Improve opt-in reflections and reduce work under memory pressure
Castyan Nov 29, 2026
7e896f7
gpu: VICTORY_REFRESH_CHECK counts a block stale only while its copy h…
Nov 29, 2026
471c81b
Reflections: VICTORY_RAYMISS_SKY, the miss program run and its sky sc…
Nov 29, 2026
d7a39cc
gpu: held texture slots a shader samples come back without waiting fo…
Nov 29, 2026
f1023c0
Merge branch 'fix/texture-queue' into pr/rtx5060-8gb-perf
Nov 29, 2026
68b786c
Merge branch 'fix/transitions' into pr/rtx5060-8gb-perf
Nov 29, 2026
c670cd1
Merge branch 'fix/reflections' into pr/rtx5060-8gb-perf
Nov 29, 2026
679169d
Test results: run K, the PR with fix/texture-queue, fix/transitions a…
Nov 29, 2026
7742762
memattrs: count title memory by its XMem attributes, and what the CPU…
Nov 29, 2026
e0b7a85
memattrs: label what VirtualProtect sets, and Direct3D's object type …
Nov 29, 2026
36c6eba
Wait for first-scene texture uploads before showing the scene
Castyan Nov 29, 2026
4c20058
Preserve GDKX GPU-read-only XMem allocation types
Castyan Nov 29, 2026
37bce66
Prioritize sampled texture work under VRAM pressure
Castyan Nov 29, 2026
76e6918
docs: A/B of VICTORY_DUE_HOT_FIRST at 37bce66 (run 1 of 4), a placed …
Nov 29, 2026
955c963
Placed views over copied textures' memory: tell reuse apart, forget it
Nov 29, 2026
71daae7
docs: the placed views over copied textures are memory reused, not a …
Nov 29, 2026
7e21186
docs: A/B run 2 and the VICTORY_PORT_CONSTANTS=1 run on the same binary
Nov 30, 2026
8c3bbf5
docs: VICTORY_PORT_CONSTANTS=1 halves the frame rate here (shaders re…
Nov 30, 2026
07ca039
Merge claude/placed-view-copy: forget a copied texture's address when…
Nov 30, 2026
504d07a
docs: VICTORY_REFRESH_BESIDE=1 on the same binary lifts the steady-st…
Nov 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/victory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ tempfile.workspace = true

[target.'cfg(windows)'.dependencies]
# The main monitor's size, for the output size's default (`native_1440p::size`).
windows-sys = { workspace = true, features = ["Win32_UI_WindowsAndMessaging"] }
windows-sys = { workspace = true, features = ["Win32_UI_WindowsAndMessaging", "Win32_System_SystemInformation"] }

[features]
# Debug-level logs and the debugging switches (frame capture, stack dumps,
Expand Down
149 changes: 118 additions & 31 deletions apps/victory/src/play.rs

Large diffs are not rendered by default.

138 changes: 136 additions & 2 deletions crates/victory-gpu/src/ambient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ fn set() -> Set {
/// pipelines).
pub(crate) fn on(role: Role) -> bool {
let set = set();
if set == Set::Off && specular().is_none() {
if set == Set::Off && specular().is_none() && raymiss_sky().is_none() {
return false;
}
let builder = crate::pipeline::builder_runs();
Expand Down Expand Up @@ -271,6 +271,20 @@ fn specular() -> Option<Specular> {
*SET.get_or_init(|| parse_specular(&std::env::var("VICTORY_AMBIENT_SPECULAR").unwrap_or_default()))
}

/// Whether the reflection estimate can use this layer's depth. The alpha
/// layer uses the opaque depth behind glass and can be opted out of.
pub(crate) fn specular_layer(layer: u32) -> bool {
static ALPHA: OnceLock<bool> = OnceLock::new();
layer == MISS_OPAQUE || (layer == MISS_ALPHA && *ALPHA.get_or_init(|| {
!std::env::var("VICTORY_AMBIENT_SPECULAR_ALPHA").is_ok_and(|v| v.trim() == "0")
}))
}

/// The estimate runs after the miss dispatch and needs its output.
pub(crate) fn keep_miss_for_specular(layer: u32) -> bool {
specular().is_some() && specular_layer(layer) && on(Role::Miss)
}

/// `VICTORY_AMBIENT_ONCE=1`: the estimate is one bounce of the light the
/// title's own lighting put there, not of the stand-in's too.
///
Expand Down Expand Up @@ -856,7 +870,12 @@ struct NeutralPass {
}

fn make_neutral(device: &ID3D12Device) -> windows::core::Result<NeutralPass> {
let code = crate::host::compile(NEUTRAL_SOURCE, s!("neutral"), s!("cs_5_1"))?;
make_pass(device, NEUTRAL_SOURCE, s!("neutral"))
}

/// A one-pipeline pass of `source`, whose root signature is in it.
fn make_pass(device: &ID3D12Device, source: &str, entry: windows::core::PCSTR) -> windows::core::Result<NeutralPass> {
let code = crate::host::compile(source, entry, s!("cs_5_1"))?;
// SAFETY: the shader contains its root signature; the code lives through creation.
unsafe {
let root: ID3D12RootSignature = device.CreateRootSignature(0, &code)?;
Expand Down Expand Up @@ -902,6 +921,87 @@ pub(crate) fn neutral_after(list: &HostList, role: Role, desc: &D3D12_RESOURCE_D
true
}

/// `VICTORY_RAYMISS_SKY=<share>` (0 to 1; unset: off): the reflections' miss
/// program runs for opaque and transparent surfaces (as with
/// `VICTORY_RAYMISS_KEEP=1`), and the sky's light it gives is scaled by
/// `share` right after it; 0 leaves those rays black.
///
/// Why: left out (the default), the miss program's image is not written for
/// those rays, and what the screen-space passes do not resolve keeps bytes
/// that are not this frame's reflections (multicoloured patches on glass
/// and car bodies with ray tracing off, RTX 5060 session 2026-11-29). Run,
/// it writes the image of every variant at its own place, but its sky gives
/// grazing floors a white grain (`draw::sky_miss_left_out`). Scaled, the image
/// is this frame's and the grain is as dim as asked. Cheap: one pass over an
/// image of half the picture's size, nothing read but that image.
pub(crate) fn raymiss_sky() -> Option<f32> {
static SHARE: OnceLock<Option<f32>> = OnceLock::new();
*SHARE.get_or_init(|| parse_sky(&std::env::var("VICTORY_RAYMISS_SKY").unwrap_or_default()))
}

fn parse_sky(value: &str) -> Option<f32> {
value.trim().parse::<f32>().ok().filter(|v| v.is_finite()).map(|v| v.clamp(0.0, 1.0))
}

/// The miss program's image: a 2D R11G11B10 texture.
fn sky_image(desc: &D3D12_RESOURCE_DESC) -> bool {
desc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D
&& desc.Format == windows::Win32::Graphics::Dxgi::Common::DXGI_FORMAT_R11G11B10_FLOAT
&& desc.SampleDesc.Count == 1
&& desc.DepthOrArraySize == 1
&& desc.Width > 0
&& desc.Width <= u64::from(u32::MAX)
&& desc.Height > 0
}

const SKY_SOURCE: &str = r#"
#define RS "RootConstants(num32BitConstants=3, b0), DescriptorTable(UAV(u0))"
cbuffer Params : register(b0) { float share; uint width; uint height; };
RWTexture2D<float3> reflected : register(u0);
[RootSignature(RS)]
[numthreads(8, 8, 1)]
void scale_sky(uint3 at : SV_DispatchThreadID) {
if (at.x >= width || at.y >= height) return;
float3 c = reflected[at.xy];
c = any(isnan(c)) || any(isinf(c)) ? 0.0 : max(c, 0.0);
reflected[at.xy] = c * share;
}
"#;

/// After a dispatch of the miss program for opaque or transparent surfaces
/// (`layer`), whose image is `desc` at `image` ([`raymiss_sky`]). Replaces the
/// list's compute root signature and pipeline; false if it recorded nothing.
pub(crate) fn sky_after(list: &HostList, layer: u32, desc: &D3D12_RESOURCE_DESC, image: D3D12_GPU_DESCRIPTOR_HANDLE) -> bool {
let Some(share) = raymiss_sky() else { return false };
if !matches!(layer, MISS_OPAQUE | MISS_ALPHA) || !sky_image(desc) || crate::pipeline::builder_runs() {
return false;
}
static PASS: OnceLock<Option<NeutralPass>> = OnceLock::new();
let Some(pass) = PASS.get_or_init(|| {
make_pass(&host()?.device, SKY_SOURCE, s!("scale_sky"))
.inspect_err(|error| tracing::warn!(%error, "no scaling of the reflections' sky (VICTORY_RAYMISS_SKY)"))
.ok()
}) else {
return false;
};
let words = [share.to_bits(), desc.Width as u32, desc.Height];
let l = &list.list;
// SAFETY: the title's program just wrote this UAV; its heap is still set
// and the dispatch holds the texture. No other view is bound.
unsafe {
uav_barrier(l);
l.SetComputeRootSignature(&pass.root);
l.SetComputeRoot32BitConstants(0, 3, words.as_ptr().cast(), 0);
l.SetComputeRootDescriptorTable(1, image);
l.SetPipelineState(&pass.pipeline);
l.Dispatch((desc.Width as u32).div_ceil(8), desc.Height.div_ceil(8), 1);
uav_barrier(l);
}
static SAID: std::sync::Once = std::sync::Once::new();
SAID.call_once(|| tracing::info!(share, "the reflections' sky scaled after the miss program (VICTORY_RAYMISS_SKY)"));
true
}

/// Whether the light of a frame has been kept: the estimate has something
/// to begin with.
static KEPT: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);
Expand Down Expand Up @@ -1256,6 +1356,40 @@ mod tests {
}
}

/// `VICTORY_RAYMISS_SKY`: a share from 0 (black) to 1, anything else
/// off; only the miss program's 2D R11G11B10 image; the pass compiles.
#[test]
fn the_reflections_sky_share_and_image() {
use windows::Win32::Graphics::Dxgi::Common::{DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_R32_UINT, DXGI_SAMPLE_DESC};
for value in ["", "off", "nan", "inf"] {
assert_eq!(parse_sky(value), None, "{value}");
}
assert_eq!(parse_sky("0"), Some(0.0));
assert_eq!(parse_sky(" 0.25 "), Some(0.25));
assert_eq!(parse_sky("3"), Some(1.0));
assert_eq!(parse_sky("-1"), Some(0.0));
let image = D3D12_RESOURCE_DESC {
Dimension: D3D12_RESOURCE_DIMENSION_TEXTURE2D,
Format: DXGI_FORMAT_R11G11B10_FLOAT,
Width: 960,
Height: 540,
DepthOrArraySize: 1,
SampleDesc: DXGI_SAMPLE_DESC { Count: 1, Quality: 0 },
..Default::default()
};
assert!(sky_image(&image));
for bad in [
D3D12_RESOURCE_DESC { Format: DXGI_FORMAT_R32_UINT, ..image },
D3D12_RESOURCE_DESC { DepthOrArraySize: 2, ..image },
D3D12_RESOURCE_DESC { Height: 0, ..image },
D3D12_RESOURCE_DESC { Dimension: D3D12_RESOURCE_DIMENSION_TEXTURE3D, ..image },
] {
assert!(!sky_image(&bad));
}
let gpu = crate::indirect::tests::WarpHarness::new().expect("a D3D12 WARP adapter");
make_pass(&gpu.device, SKY_SOURCE, s!("scale_sky")).unwrap();
}

#[test]
fn neutral_probe_replaces_colour_without_depth_and_preserves_bounds() {
use crate::indirect::tests::WarpHarness;
Expand Down
10 changes: 7 additions & 3 deletions crates/victory-gpu/src/descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1979,13 +1979,17 @@ pub(crate) fn make_waiting() {
/// the marks. With `VICTORY_SAMPLED_EVICT=1` it does, for those whose
/// other slots are all a draw's to make again: their slots picked by index
/// come with the others, flagged (the third field), and are queued again
/// once a shader reads them (`crate::sampled::evicted`).
/// once a shader reads them (`crate::sampled::evicted`). With `cold_since`
/// (`VICTORY_COLD_EVICT_S`, `crate::resource::cold_evict_ms`) the marks are
/// trusted so too, but a texture is cold only if no shader marked it since
/// frame `cold` (further back than `cutoff`).
#[cfg(windows)]
#[allow(clippy::type_complexity)]
pub(crate) fn evictable_slots(
raws: &std::collections::HashMap<usize, usize>,
frame: u64,
cutoff: u64,
cold_since: Option<u64>,
) -> (std::collections::HashMap<usize, Vec<(usize, u32, bool)>>, u64, u64, Vec<usize>) {
let set: std::collections::HashSet<usize> = raws.keys().copied().collect();
let mut by_texture: std::collections::HashMap<usize, Vec<(usize, u32, bool)>> = std::collections::HashMap::new();
Expand All @@ -2006,7 +2010,7 @@ pub(crate) fn evictable_slots(
if lately {
seen.insert(raw);
}
if crate::sampled::sampled_since(index, cutoff).unwrap_or(true) {
if crate::sampled::sampled_since(index, cold_since.unwrap_or(cutoff)).unwrap_or(true) {
sampled.insert(raw);
}
if ok || indexed {
Expand All @@ -2027,7 +2031,7 @@ pub(crate) fn evictable_slots(
.filter(|raw| !sampled.contains(raw) && !seen.contains(raw))
.filter_map(|raw| raws.get(raw).copied())
.collect();
let trusted = crate::sampled::evict_on();
let trusted = crate::sampled::evict_on() || cold_since.is_some();
by_texture.retain(|raw, _| {
!seen.contains(raw) && (!blocked.contains(raw) || trusted && !other.contains(raw) && !sampled.contains(raw))
});
Expand Down
Loading