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

+73
View File
@@ -1002,6 +1002,27 @@ const COPIED_GRACE: u64 = 4;
/// In [`HostHeap::tabled`]: a draw read the slot in that frame.
const TABLED_READ: u32 = 1 << 31;
/// Whether a slot's table stamp ([`HostHeap::tabled`]: the frame a draw's
/// table last showed it, plus one, in 31 bits; 0 never) is later than frame
/// `cutoff`, seen from frame `frame`. A stamp without [`TABLED_READ`] counts
/// too (a table showed the slot; whether the shader read it then is not
/// known): the answer errs toward "used". For slot eviction
/// (`crate::resource::slot_evict`; memory stack by skornuta,
/// skornuta/victory-memory-stack 57fb136, GPL-3.0).
pub(crate) fn seen_since(stamp: u32, cutoff: u64, frame: u64) -> bool {
let stamp = stamp & !TABLED_READ;
if stamp == 0 {
return false;
}
let mask = !TABLED_READ;
let now = (frame as u32).wrapping_add(1) & mask;
let cut = (cutoff as u32).wrapping_add(1) & mask;
// Ages back from now, in the stamps' 31 bits.
let age = now.wrapping_sub(stamp) & mask;
let limit = now.wrapping_sub(cut) & mask;
age < limit
}
/// Since the start: writes of texture views into slots that count as a
/// table's (due later), and slots that left the queue because a draw read
/// them through a table; of the latter, those a draw read again in the
@@ -3104,6 +3125,58 @@ impl HostHeap {
flipped + late_flipped
}
/// For `crate::resource::slot_evict` (`VICTORY_SLOT_EVICT=1`; memory
/// stack by skornuta, skornuta/victory-memory-stack 57fb136, GPL-3.0):
/// every slot (title or dynamic) showing one of the host textures `raws`
/// (raw pointers), as (index, raw, whether letting it go is safe, whether
/// a draw's table showed it after frame `cutoff`). Safe: a title slot a
/// draw read through a table lately, which that draw makes again by
/// itself (`HostHeap::mirror_after`). Slots only shaders pick by index
/// (nothing would make them again) and dynamic ones (a list not yet
/// reset) are not. The second answer is the slot's table stamp
/// ([`seen_since`]): a texture a draw reads through a table every frame
/// never asks for its host copy again, so its last use says nothing of
/// that.
pub(crate) fn slots_showing(
&self,
raws: &std::collections::HashSet<usize>,
frame: u64,
cutoff: u64,
) -> Vec<(u32, usize, bool, bool)> {
self.kept
.iter()
.enumerate()
.filter_map(|(i, slot)| {
// (A lock to a slot: see `kept`.)
let raw = {
let r = slot.lock().unwrap_or_else(|e| e.into_inner());
windows::core::Interface::as_raw(r.as_ref()?) as usize
};
raws.contains(&raw).then(|| {
let i = i as u32;
let ok = i < self.count && !self.sampler && self.tabled_lately(i, frame);
(i, raw, ok, seen_since(self.tabled_stamp(i), cutoff, frame))
})
})
.collect()
}
/// Title slot `index` goes back to null at once, its host copy about to
/// be let go by `crate::resource::slot_evict` (memory stack by skornuta,
/// skornuta/victory-memory-stack 57fb136, GPL-3.0): as
/// [`HostHeap::texture_slot_gone`] without its wait, for the copy is
/// there and goes now. True if the slot was made.
pub(crate) fn texture_slot_evicted(&self, index: u32) -> bool {
let _made = self.made.lock(index);
if self.made.get(index).is_none_or(|key| key == 0) {
return false;
}
// (A wait of `texture_slot_gone` begun for this slot is over.)
self.texture_slot_here(index);
self.unmake(index);
true
}
/// The memory of the texture title slot `index` views is there (again):
/// see [`HostHeap::texture_slot_gone`].
pub(crate) fn texture_slot_here(&self, index: u32) {