Water light on, PS4 pads, F1 menu saves at once, long-session memory, memory switches

Rendering and memory (GPL-3.0 code ported in; credits in the source):
- Water: 64-lane compute programs on 32-lane waves keep each wave
  together through loops and set up shared memory from the first
  thread, so the water's tiled light no longer leaves dark blocks. It
  runs by default now (VICTORY_WATER_LIGHT=0 leaves it out; an empty
  value, an earlier version's saved OFF, runs it). Also cloud tiles and
  the screen probes' ray activation.
- Placed views: their padding cleared as before; folding a buffer
  view's first element into its address is VICTORY_PLACED_FOLD=1, off:
  with it on, clothing and caps swapped to other variants for single
  frames in the boat cutscene.
- Texture sweep: textures whose copy was let go leave the looks until
  used again. Static samplers made first, in one order. Small buffers
  made ahead of the first 3D frame.
- play mode: VICTORY_TEXSPK_PASS_MS=8, VICTORY_PASSES_HOT=1,
  VICTORY_HELPER_PRIORITY=1.
- Memory switches, all off: VICTORY_SLOT_EVICT, VICTORY_ALLOCATOR_TRIM,
  VICTORY_BUDGET_PACK (and VICTORY_LIST_POOL_IDLE_S).

Input: DualShock 4 (0x05C4, 0x09CC, 0x0BA0 adapter) read over HID, USB
and Bluetooth, beside the DualSense; PlayStation pads rumble, and stop
when the game ends (issue #352).

F1 menu: every change is saved at once; it saves to
victory-settings.txt in VICTORY_HOME or %LOCALAPPDATA%\victory however
the game was started (no more "NO SETTINGS FILE").

Warm-up start: its 30 s count from the first frame of 100 draws or
more, not from the start: waiting at the title screen restarted it too
early and the next run still sat at 14 fps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
trustno1-coderandClaude Opus 5.5 committed 2026-11-27 15:03:27 -08:00
1 parent df2daafeb1
commit 64d4931b3d
44 files changed
+4664 -952

No files matched your search

+77 -1
View File
@@ -625,7 +625,7 @@ pub fn emit(
// Both archived kernels use one logical wave per group and have
// validated wave32 PSOs on RTX. Explicit policy wins.
// The volumetric light's two tiled programs (`CS_TransmissionVolumetrics_Tiled`
// and `_Tiled_LocalLights`, GTA VI 1.0.2.1) are of that shape too: groups of 64,
// and `_Tiled_LocalLights`, the game, build 1.0.2.1) are of that shape too: groups of 64,
// an LDS read and write in one lane-branch region, so no other form translates
// them on 32-lane hosts and their dispatches were dropped (no volumetric light
// or fog on NVIDIA). Widened, they translate (4 and 7 branches taken wave-wide).
@@ -897,6 +897,35 @@ fn widen(
}
/// The translated program, and the wave size it requires of the host.
/// Which programs get the branches that close or leave their loops taken by each host wave
/// together where cross-lane code depends on the wave ([`emit_program`]):
/// - unset or `1`: console wave64 compute programs on a host of 32-lane waves;
/// - `2`: every compute program;
/// - `0`: none, as before.
fn loops_wave(native: &NativeProgram) -> bool {
if native.stage != HwStage::Cs {
return false;
}
match std::env::var("VICTORY_LOOPS_WAVE").ok().as_deref().map(str::trim) {
Some("0") => false,
Some("2") => true,
_ => native.wave64 && lower::host_max_wave() == 32,
}
}
/// [`emit_program_plain`]; a program that comes out depending on the host's waves is
/// translated once more with the per-lane branches that close or leave its loops taken by
/// each host wave together ([`structure::structure_wide_host`]), and that translation is the
/// one given if it needs no wider waves.
///
/// Why: the lowering turns the console's wave loops into loops each lane leaves on its own,
/// and takes the code behind a loop as code the whole wave runs together. On NVIDIA the lanes
/// that left a loop early run on as a wave of their own, so a ballot, a first-lane read or an
/// exchange between the halves of a console wave behind the loop saw a part of the wave.
/// Seen in `water_shading:CS_TransmissionVolumetrics_GenerateTiles` (the game, build 1.0.2.1, capture
/// water2): the tiles with local lights never counted themselves in (the lanes without one
/// arrived later and wrote "no lane" over their ballot), their list stayed empty and those
/// tiles of the water kept no light: dark rectangles beside lit objects.
fn emit_program(
c: &Container,
native: &NativeProgram,
@@ -904,6 +933,53 @@ fn emit_program(
st: &structure::Structured,
io: &io::Io,
res: &resource::Resources,
) -> Result<(HostShader, Option<u32>), ShaderError> {
let first = emit_program_plain(c, native, p, st, io, res);
let Ok((_, Some(wave))) = &first else {
return first;
};
if !loops_wave(native) || !st.host_wide.is_empty() {
return first;
}
let loops = lower::loop_branches(p, st);
if loops.is_empty() {
return first;
}
let needs = lower::take_needs();
let again = structure::structure_wide_host(p, &st.wide, &loops).and_then(|st| {
let res = resource::track(p, &native.layout, native.stage, Some(&st))?;
emit_program_plain(c, native, p, &st, io, &res)
});
let why = std::env::var_os("VICTORY_WAVE_WHY").is_some();
match again {
Ok((shader, Some(w))) if w <= *wave => {
if why {
eprintln!("WAVE-LOOPS {} loop branches taken by each host wave together", loops.len());
}
lower::take_needs();
Ok((shader, Some(w)))
}
other => {
if why {
let what = match &other {
Ok((_, w)) => format!("wave {w:?}"),
Err(e) => e.to_string(),
};
eprintln!("WAVE-LOOPS not taken ({} loop branches): {what}", loops.len());
}
lower::set_needs(needs);
first
}
}
}
fn emit_program_plain(
c: &Container,
native: &NativeProgram,
p: &ir::Program,
st: &structure::Structured,
io: &io::Io,
res: &resource::Resources,
) -> Result<(HostShader, Option<u32>), ShaderError> {
let sig = |fourcc| -> Result<Vec<container::SigElement>, ShaderError> {
match c.part(fourcc) {