1058 Commits

Author SHA1 Message Date
821654fe9a residency: memory pressure from the card's share of the PC's memory (VICTORY_SHARED_PRESSURE=0: off)
Every buffer the CPU maps and the card reads counts against DXGI's
non-local budget, which Windows caps at half the RAM, not against free RAM.
On 16 and 24 GB PCs it ran out with gigabytes free, every such buffer was
refused from then on, down to 256 bytes, and the run ended when a host
command list could not close (0x8007000E; #156, #206).

The once-a-second sweep now reads that budget: pressure from 85 % (off
under 75 %), critical from 95 %, the same levels the RAM sample sets, so
spares, staging and texture prefetch shrink before the cap is reached.

The limit and its ending are VIctory-NVIDIA's issue 1520 (trustno1-coder),
whose fix scaled its own L0 caches down on PCs under 24 GiB.
v2026.12.02.01
2026-12-02 15:11:54 +01:00
133f7d088a victory-gpu: undo the formatting of f867ce7d outside the sampler change
f867ce7d ran cargo fmt over the whole crate; only its five files of the
static-sampler change are kept.
2026-12-02 15:07:16 +01:00
f867ce7d06 pipeline: static samplers made in one order in every process (VICTORY_SAMPLER_ORDER=0: off)
The driver keeps static samplers in a table in the order a process first
makes them, and a compiled pipeline holds their places in it; its disk
cache finds a pipeline again only where those places match. Pipelines are
made by several threads in the title's order, so the places changed from
run to run and the driver compiled again at every start. Every distinct
sampler is now listed in pipelines/static-samplers.txt and made in that
order when the device is made, and before each pipeline's root signature.

Ported from trustno1-coder/VIctory-NVIDIA (pipeline/samplers.rs), without
its pipeline-library and warm-fingerprint hooks.
2026-12-02 15:05:14 +01:00
0f7539b008 Merge PR #197: Texture blocks are emptied and given back while the card is over its budget (VICTORY_TEXTURE_COMPACT=1, opt-in) 2026-12-02 14:37:24 +01:00
c71e39f2d4 Merge PR #198: watch: split GetWriteWatch by AllocationBase on refusal 2026-12-02 14:37:21 +01:00
abf442a6c4 Merge PR #201: Under Wine: fewer questions to the host and no fault for copies with holes, by the views' own record (VICTORY_COMMITTED_BY_VIEWS, VICTORY_COPY_BY_VIEWS) 2026-12-02 14:37:18 +01:00
1029f47821 Merge PR #205: VICTORY_ALIAS_VIEW=1 (opt-in): a view placed in the memory of a texture the host writes is a view of that texture, not of a copy 2026-12-02 14:37:16 +01:00
7f9f61252d Merge PR #208: VICTORY_GUARD_LATER=1 (opt-in, with VICTORY_PORT_GUARD=1): written blocks are made read-only by a thread beside the askings 2026-12-02 14:37:13 +01:00
e37834ff10 Merge PR #209: Shader: retire inactive wave halves in the fast-profile decal reduction 2026-12-02 14:37:11 +01:00
deb6f675e0 Merge PR #207: Shader: lower divergent wave64 LDS on wave32 hosts by default 2026-12-02 14:37:08 +01:00
d2fe115f1a Merge PR #199: Title buffers' card copies are made within their limit although the card is over its line (VICTORY_CARD_BUFFERS_OVER_LINE) 2026-12-02 14:37:05 +01:00
f4b719cd2e Merge PR #202: VICTORY_KEYS_UNTIL=<file>: the scripted keys end once the file is there 2026-12-02 14:37:02 +01:00
09483bf4b2 shader: retire empty wave halves in the skinned decal reduction 2026-12-02 15:39:38 +08:00
eb19b673f9 fix CI error 2026-12-02 04:41:19 +08:00
=
2a1d681a44 VICTORY_GUARD_LATER=1 (opt-in, with VICTORY_PORT_GUARD=1): written blocks are made read-only by a thread beside the askings
A refresh asks what was written, guards it and copies it, on the threads the
submitting thread waits for. Under Wine a change of protection is some 13 us
with its one lock for all of memory held, and every other thread's wait
behind it. A timeline of the prologue (RTX 5060, Proton) has 69 ms a frame
of all threads' time in the refreshes of copies, 47 of it waiting for the
guards' lock, which the title's write faults hold through a VirtualProtect
as the refreshes do; all threads together wait 145 ms a frame for it. With
port 6 the same time shows as VirtualProtect inside the refreshes: 51 and
20 ms a frame in two samples, 133 to 146 us a call.

With the switch an asking changes no protection:
- a block found written and open is told as written and named to a thread
  beside ("victory-guard"), which makes it and its pages' other views
  read-only a moment later and does not note it clean: what the title wrote
  between the asker's copy and the guard is in no copy yet;
- the next asking finds it read-only and not clean, tells it as written
  once more and notes it clean, by the path that was there for a block made
  read-only for another view's sake;
- a read-only block that is not clean and has a view still open (the title
  wrote through the other view) is named too, not covered by the asker.
The thread takes the guards' lock shared for four blocks at a time: held
for whole runs, the askings queued behind what takes the lock alone. It
guards only what is still view memory, open, and neither left alone nor
resting. What it costs is a second look at each written block.

Measured (diagnostics timelines, port 6 without and with it, two samples
each): the refreshes of copies 93.7 and 50.0 ms a frame of thread time
against 44.0 and 28.4; the submitting thread's last refreshes 20.9 and 13.4
ms against 12.0 and 10.9; all threads' changes of protection 62.8 ms a
frame against 37.5; 50 MB a frame copied against 44. Release, runs taken in
turn: frames 58.5 and 61.0 ms by default, 58.8 and 67.7 with port 6, 68.2
and 57.3 with this too: no frame gain that shows, the card holds the frame
where the submitting thread let go of it. Off unless asked for.

The many-askers test runs with it (no write is lost between an asker's
copy and the guard).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-12-01 21:24:50 +01:00
3aff512ad8 shader: lower divergent wave64 LDS in lockstep on wave32 hosts 2026-12-02 04:13:32 +08:00
=
c7772ff4c6 VICTORY_ALIAS_VIEW=1 (opt-in): a view placed in the memory of a texture the host writes is a view of that texture, not of a copy
The title packs light as R9G9B9E5 into R32_UINT textures with compute and
samples them through R9G9B9E5 views placed at the same address (sky, probes,
bounced light). The host has two textures for the two, and texture::alias
copies the written one into the view's own, texture to buffer to texture, at
every read after a write: 75 copies a frame in the prologue (RTX 5060 under
Proton, timing run: 3.8 ms of the card a frame, 51 us each).

With the switch, on a host that reads one texture in two formats (relaxed
format casting, ID3D12Device10):
- a colour texture the host writes as R32_UINT is made by
  CreateCommittedResource3 with R9G9B9E5 as a second format to read it in
  (shader reads allowed whatever the title's flags say);
- the slot of a placed R9G9B9E5 view in its memory is made as a view of
  that texture's own host copy, which the slot keeps as it keeps whatever
  it views;
- a draw that reads the view brings that texture to the read state and
  copies nothing.
The title writes the view's slot before the texture the host writes there
exists, so the slot is first made of the view's own texture and the first
read is a copy as before; that read asks once for the placed texture's slots
to be made again, and from the next texture pass they are views of the
written texture. If that texture gets another host copy, or goes, the slots
are made again the same way.

Measured: 800 to 1,100 reads a frame of the texture itself and none of a
copy; the picture as before (captures of two scenes with and without). The
"alias copy" commands are gone from the timing run, but the card's commands
together take as long as they did (43.2 ms a frame against 42.6, one run
each): most of a copy's time was the wait for the pass that wrote the
texture, which the command after it pays now. Frames 61.6 ms with it, 62.7
without. So it saves the copies and their buffers and no time that shows:
off unless asked for.

A line with the frame lines counts both kinds of reads. Tests on a real
device (run with the variable set): the slot shows the written texture, and
no longer once that texture is gone.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-12-01 20:27:19 +01:00
=
3115a291e0 VICTORY_KEYS_UNTIL=<file>: the scripted keys end once the file is there
VICTORY_KEYS presses keys at set seconds, focus or not, but a script that
wants Enter pressed until the world draws cannot know those seconds: the
start screen takes Enter after a time that depends on the cache and the
disk, and a press that comes late lands in the world. With this a script
has Enter pressed every few seconds and makes the file when it sees the
world draw (the window's title has the draws a frame); from then on no
scripted key is pressed. The file is looked for only while a key of the
script is due.

Under Proton on a Wayland desktop this is what lets a measuring run start
with nobody at the keyboard: a key sent from outside reaches the title
only while its window has the focus.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-12-01 19:03:12 +01:00
=
0199c67799 A copy of title memory with holes the views tell of is read view by view (VICTORY_COPY_BY_VIEWS)
copy_mapped read its source whole and, where a page was not there, took
the fault at the first hole, then asked the host region by region and read
again. The windows of title memory mostly have holes (blocks of the
placeholder the title has not mapped), and under Wine such a fault is a
signal, its one lock for all of memory and an exception sent to our
handler: 1,050 of them a second in the prologue (RTX 5060 under Proton).

For a copy into host memory of 4 KiB or more, the runtime's record of the
views is looked at first: a source it shows in part is read run by run
(read_around), and only what lies between the runs is asked about, as
read_sparse does (a hole reads as zeros, memory of another kind beside the
views is read). A run that fails (a mapping changed since the look) is
read by pieces as before. A source no view shows, or one shown whole, goes
the old way; so do the small copies (10,000 fills a frame of some hundred
bytes each), for which the look would cost more than it saves.

Same scene: 480 such faults a second where there were 1,050. Two pairs of
runs taken in turn: frames 77.0 and 72.3 ms with this and the change before
it against 78.8 and 74.1 without. VICTORY_COPY_BY_VIEWS=0: as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-12-01 19:01:57 +01:00
=
dd9a5fdde5 Whether a texture's memory is there is answered by the views that show it whole (VICTORY_COMMITTED_BY_VIEWS)
texture::committed asked the host about every texture due, and with
VICTORY_COMMITTED_QUERY=1 (what the Proton launcher sets: QueryWorkingSetEx
is the costly one under Wine) that is one VirtualQuery for each view the
texture lies across. Each takes Wine's one lock for all of memory, which
the protection changes of the guards and the title's page mappings hold a
third of the time: 7,000 questions a second in the prologue, each holding
the lock 0.5 us and waiting 7 to 40 us for it (an ntdll that counts the
lock's takings by caller, RTX 5060 under Proton).

What views of physical pages show whole, of sections made committed, is
there by the runtime's own record (inplace::shown_committed): then the host
is not asked. Anything else is asked as before: a part no view shows, or a
section whose pages are committed one by one. Same scene: 1,000 questions a
second from there, 388 questions a frame of all kinds where there were 735.
VICTORY_COMMITTED_BY_VIEWS=0 asks every time, as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-12-01 19:01:57 +01:00
=
fb56148739 Title buffers' card copies are made within their limit although the card is over its line (VICTORY_CARD_BUFFERS_OVER_LINE)
The copies are asked for in the world's first frame, in a race with its
render targets and the textures' burst, and one turned down stays in the
PC's memory for the run: what shaders write there is looked for by the CPU
and copied back every frame. Of 23 runs of one scene (RTX 5060 8 GB under
Proton, a budget of 4,483 MB, 5.6 GB in use) the 14 with 14-24 MB turned
down copied 2.3-2.5 MB a frame back and ran at 73-100 ms; the 6 with
147-312 MB turned down copied 4.3-32 MB back and ran at 88-168 ms. With
this, five runs of five had every copy on the card (527-528 MB, as the good
runs had) and copied 2.2-3.3 MB back; two of them would have had 129 and
168 MB turned down.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-12-01 15:28:25 +01:00
4e0871c747 watch: split GetWriteWatch by AllocationBase on refusal
Keep the single-reservation GetWriteWatch fast path unchanged, and on refusal fall back to querying each MEM_PRIVATE AllocationBase reservation non-destructively (flags = 0) before resetting slices per reservation/chunk. Any non-write-watched sub-range (MEM_FREE, MEM_MAPPED, MEM_IMAGE, or ordinary MEM_PRIVATE / placeholder) aborts and returns None without wiping dirty bits so ask_run can bisect and writes() can fall back cleanly. Multi-chunk fast-path runs also reset per chunk so ResetWriteWatch never crosses a chunk-aligned AllocationBase boundary.

Signed-off-by: ending3729 <Leverage7601@proton.me>
2026-12-01 17:54:27 +03:30
=
78ceb76505 Texture blocks can be emptied and given back while the card is over its budget (VICTORY_TEXTURE_COMPACT=1)
While the card is over its budget, the texture blocks with the least in
them are drained: the host copies in them are made again elsewhere, the
slots that show them flip to the new copy once its upload has run, and
the empty block goes back. On an 8 GB card the blocks came down from 2.7
to 2.0 GB (4 MiB blocks) and from 3.3 to 2.1 GB (16 MiB).

Off by default: the copies made again cost about 10 ms of a frame's
preparing in two pairs of runs, and the driver's failures on a full card
came with it as without.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-12-01 13:33:39 +01:00
75b1568280 draw: VICTORY_SKIP_DRAWS=1 sends no draw to the card, to measure the CPU's side
Every draw is still translated, bound and has its data copied; only the
DrawInstanced, DrawIndexedInstanced, DispatchMesh and non-dispatch
ExecuteIndirect calls are left out. Compute runs, as the title reads some of
it back. The frame rate is then the most a faster card could give.
v2026.12.01.01
2026-12-01 12:11:38 +01:00
f7b2e1cf83 hle: the title's question of the CPU's cores logged, VICTORY_REPORT_CORES to tell it fewer
GetLogicalProcessorInformation is the title's only question of the CPU's
size and went to the host unseen. It is now answered through us, logged once,
and VICTORY_REPORT_CORES=<n> keeps the first n cores. Told 2 of 6 cores, the
title still made 49 threads, as with all 6: it does not size its worker pools
by the cores it is told, so more cores cannot be given to its render-command
recording this way.
2026-12-01 12:11:33 +01:00
c205bd9198 shader: regression test for #174, a buffer size query and its load in separate blocks (#175)
The synthetic program from #175 (MalfoyDraco99's, fxceless/victory-fork#452)
is lowered, validated, made into a pipeline on the card and on WARP, and its
DXIL checked for a branch between the size query and the load: what kept
amdxc64.dll from crashing on an RX 9070 XT (#161). It fails with #174's
change turned off.

Co-authored-by: omar-akermi <36206214+omar-akermi@users.noreply.github.com>
2026-12-01 11:31:32 +01:00
b0906d4820 ambient: VICTORY_AMBIENT_CLEAN=1, the near-surface probe fix and clamps of #151
Without ray tracing, stale probe tiles stay on faces and hair through
max(was, found); with the switch, near surfaces take the estimate. The
clamps on lamps, cells and air come with it. Opt-in: it changes what every
VICTORY_AMBIENT run shows, and there are no before/after logs yet.

Co-authored-by: NoLogicAlan <88591830+NoLogicAlan@users.noreply.github.com>
2026-12-01 11:24:25 +01:00
2c7a83fd84 residency: staging keeps at most its own count, 2 blocks on 32 GB or less, and holds still under host pressure (#150)
Staging was kept by the card's count (up to 64 blocks, 4 GiB of the PC's
memory). Under host memory pressure, outside the bake, no new staging
blocks, and idle textures go as without a limit. The PR's trigger on more
than 256 MB of shared card memory is left out: most 8 GB cards cross it.

Co-authored-by: NoLogicAlan <88591830+NoLogicAlan@users.noreply.github.com>
2026-12-01 11:24:24 +01:00
504bcbc253 docs/linux: Wine/Proton gotchas and RADV settings measured in #192 2026-12-01 11:07:16 +01:00
5c2570ce8a Merge PR #195: land, shadow: coalesce copy-back landing batches, scratch buffers, and direct guard spans 2026-12-01 10:58:55 +01:00
ae8530428a Merge PR #191: Add NixOS development shell 2026-12-01 10:55:37 +01:00
7159425097 Merge PR #189: gameinput: the keyboard's keys from its raw input, not 240 askings every 8 ms 2026-12-01 10:55:34 +01:00
9df537aa7a Merge PR #190: Windows: add optional fast profile and coalesce consecutive GPU page mappings 2026-12-01 10:51:43 +01:00
149fe5d197 Merge PR #186: host: the lists of a submission's steps keep their memory for the next 2026-12-01 10:51:40 +01:00
8703081e62 Merge PR #188: descriptor: a slot that holds its resource already is seen to without its lock 2026-12-01 10:51:37 +01:00
7b56d2d4d0 Play-VIctory-AMD: port 1 on with batched clamps on CPUs of 16 threads or fewer (#180, #171)
With port 1 off, an 8-core 5700X3D lost more on CPU copies than the card
gained (16.2 -> 14.4 fps); with port 1 on and its clamps batched after the
last buffer-writing shader, the GPU went 42.6 -> 26 ms and 16.8 -> 18-19 fps.
Larger CPUs keep port 1 off. An explicit VICTORY_PORT_CONSTANTS still wins.
2026-12-01 10:50:29 +01:00
2572553724 Merge PR #182: descriptor: move list views' unaligned twins instead of nulling them (tree flicker on AMD) 2026-12-01 10:42:29 +01:00
ddedaddbd2 land, shadow: coalesce copy-back landing batches, scratch buffers, and direct guard spans
Prepare CardLanding and BackLanding once per Shadow in relay_card_back and RelayBack::merge, pre-coalesce dirty/sent skip ranges, reuse thread-local scratch buffers (Notes, Batch, parts, addressed), scale job sizes by worker count, and coalesce contiguous differing 4 KiB page spans into fewer watch::landing calls on beside.is_none().

Signed-off-by: ending3729 <Leverage7601@proton.me>
2026-12-01 10:27:13 +03:30
3fc5d611f5 nix: dev shell for building the Windows executable on NixOS 2026-11-30 19:15:58 +01:00
f628fda319 Use scene-dependent indoor lighting in the experimental fast preset 2026-12-01 00:24:23 +08:00
e65e0857a9 Offer opt-in fast Windows launcher with coalesced GPU page mappings 2026-11-30 23:31:47 +08:00
2263ef8426 gameinput: the keyboard's keys from its raw input, not 240 askings every 8 ms
The input poll asked GetAsyncKeyState about each of 240 keys every 8 ms:
30,000 calls a second, 0.4 of a core while driving (wpr profile), on an
8-core CPU whose cores the title's recording threads, the pipelines and
the streaming already fill.

A message-only window of the polling thread's now takes the keyboard's
raw input (RIDEV_INPUTSINK); shift, control and alt are told by side as
before. At each poll only the keys held are asked about, so a release
raw input missed does not stick; every 32 polls (256 ms), and when focus
comes back, every key is asked about. A key held that raw input never
told of, three such times in a row, turns raw input off for the run.
VICTORY_RAW_KEYS=0 asks every key at every poll, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 16:14:56 +01:00
4bf0ab95d8 descriptor: a slot that holds its resource already is seen to without its lock
Every draw's table slot made from a view the list made before
(make_listed) cloned the resource (an AddRef), took the slot's lock,
found the slot held it already, and let go of the clone (a Release):
four atomic writes to cache lines the title's recording threads share,
0.2 of a core of theirs while driving through the city (wpr profile,
HostHeap::keep the largest leaf under State::bind).

Each slot's interface pointer is now also kept in an atomic beside its
lock, written under the lock. keep() and the new keep_ref() look at it
first and return when the slot holds that resource already; keep_ref
clones only when it does not. A held resource stays alive while the slot
holds it, so its pointer cannot be another's while seen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 15:47:58 +01:00
164e130fe7 HLE: fill GDKX-documented vtable gaps in dstorage, speech and accessibility
Factory SetCpuAffinity and SetDebugFlags as S_OK no-ops, file Close
(release) and GetHandle (raw Win32 handle), queue Query returning
empty-slot count and auto-submit threshold from the Lane state,
and accessibility stubs for closed captions, high contrast and
speech-to-text that all report the feature disabled.
v2026.11.30.01
2026-11-30 15:29:44 +01:00
5328a19566 Play-VIctory-4GB: VICTORY_WAVE_WIDE=last for the 3 compute shaders that fail 2026-11-30 15:29:39 +01:00
bb070ded0f Play-VIctory-4GB: four more optimizations from source analysis
PORT_CBV on (saves ~4.7 ms/frame, ~22k constant buffer fills eliminated).
CARD_ROOM_FOR_TARGETS_MB=1024: default 3072 MB reserves nearly all 4 GB VRAM
for render targets, leaving the texture queue almost nothing; 1024 gives the
queue ~2 GB of headroom while loading.
WC_NO_BACK=1 + WC_NO_BACK_MIN_KB=1024: skip write-back of shader writes in
write-combined copies >= 1 MB — saves ~360 of 730 MB/frame of compare/fetch/
merge work (from trustno1-coder/VIctory-NVIDIA).
PIPELINE_BOOK=1: record pipelines as the 6 fps Whiplash run did, keeping the
pipeline book current for future warm runs.
2026-11-30 15:29:35 +01:00
b2c0275a79 host: the lists of a submission's steps keep their memory for the next
refresh_ahead's touches and card_steps' does/steps hold an entry per step
of a submission, some 20,000: a megabyte, which Windows' heap takes from
and gives back to the system. Every growth and release was a
NtAllocateVirtualMemory/NtFreeVirtualMemory on the submit thread (half
of those it made in a drive through the city, 2.5% of a core), each
waiting for the process's address-space lock that the title's page
mapping and the GPU's page-mapping copies wait for too. The lists now go
back to a thread-local and are used again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:28:50 +01:00
8409c251a1 README: Windows 10 and the release, launchers by card size, this week's defaults and fixes, VIctory-NVIDIA credited
- Quick Start: the prebuilt release needs Windows 11 (Windows 10's D3D12
  has no SM 6.6 bindless heaps; build with the Agility SDK there); the
  launchers listed by the card's memory, the 16 GB one first for 16 GB+;
  the first start after an update translates the shaders again.
- -SkipRayWork is scripts\play.ps1's, not the 4 GB launcher's.
- This week's fixes (#59, #161, #80, #140, #139, #180) and changed
  defaults (hair on, early list off, relay off on RDNA 2 under Windows,
  idle textures on large cards, the watchdog poke).
- Launch section names Play-VIctory-16GB.cmd.
- Ports table: port 1 off everywhere (AMD: #180), port 5 on in the AMD
  launcher.
- Credits: trustno1-coder/VIctory-NVIDIA and its contributors.
2026-11-30 10:34:23 +01:00
6cab3a2877 README: the antivirus warning goes; the download check stays
Releases are no longer flagged by Defender since the launchers stopped
starting PowerShell and the archive dropped its scripts. The checksum and
build-provenance check is kept, without the warning around it.
2026-11-30 10:32:36 +01:00
0ae860235a Merge PR #183: cores: VICTORY_OWN_CPUS keeps our threads off the title's die (Ryzen X3D)
cores: VICTORY_OWN_CPUS keeps our threads off the title's die (Ryzen X3D)
2026-11-30 09:56:03 +01:00