Ported from Belobug/VIctory-Belobug-AMD 673be0e and a609a2f (renderer
port 7, its heaps' records part; the journal in 64 parts, which shares
the switch VICTORY_PORT_JOURNAL there, is not taken). There the lane
waited 4.5-5.2 ms a frame for the heaps' records and port 7 took 2.4 ms
off it. Here the submitting thread waited 2.7-5.8 ms a frame for them
(release run 233354).
A round of the heap-sync thread is asked for when the title submits
(Lane::push, round_after), so it runs while the submission waits in the
line (12-15 are in it when one is added), and the submitting thread waits
for that round (begin_sync_heaps_after), or for a later one if a wait of
its queue that was met in memory went since (the queue's floor in the
line), or a step of ours wrote, or may have written, a heap's title
memory while preparing an earlier submission (heap_marks::prep_wrote:
buffer copies into a heap, copies at their place, our own steps). Added
here: a submission that waited for flights to land begins a round of its
own after the wait, as without the switch. With the switch off nothing
is marked, asked or counted. VICTORY_HEAP_SYNC_FIRST applies only to a
submission without a mark.
Not behaviour-neutral in timing: a record the title writes for a
submission after submitting it (or after a wait behind which the
submission stands was met) is left to a later round, as the console's
card could miss it too. Off by default. The frame line "the heaps'
records asked for at the title's submit" gives the wait per frame, the
rounds asked at a submit, the preparings that found theirs asked earlier
or had to ask, and those that wrote a heap's memory. Tests: the round
given begins after the call (heap_marks), and the line's marks with
waits and parts taken along (queue::behind).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported from Belobug/VIctory-Belobug-AMD a284ca7 (its per-job timing and
timeline phases are left out; both switches are on by default there and
off here).
VICTORY_SPANS_QUICK=1: a slot written with no placed texture view leaves
the heap's spans of placed views (and their lock) alone when the slot is
not in them (HostHeap::spanned, a bit per slot that may be there). Every
record the round of the heaps' records mirrors went by that one lock,
from its six threads, with the title's threads and the texture passes:
there, 4 of the 16 ms a frame the submitting thread waited for the round
were its threads waiting on that lock (run city4). What is done is the
same: forgetting a slot that is not there does nothing.
VICTORY_SYNC_FINE=1: the round gives its threads 2 pages and 64 records a
job instead of 8 and 256: a round for a submission finds a dozen pages,
which were two jobs on two of six threads while the submission waited.
Neither changes what is mirrored. Off by default. The frame line "writes
of view slots per frame (VICTORY_SPANS_QUICK=1)" counts writes that left
the spans alone and those under their lock, and the job size; the heaps'
records line's "ms waited for" shows the gain.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported from Belobug/VIctory-Belobug-AMD 15ab94e (and the test's type from
8822ed4; that commit's turning it on by default is not taken).
The round of the heaps' records (descriptor::sync_heaps) read each changed
page through the kernel into a copy, then compared the copy with the
records last seen: two passes over every page. With the switch each
record of 32 bytes is read in place once by the fault-safe copy code
(safecopy::changed, AVX2), compared with the one last seen, and put over
it where it differs; a page the title unmaps meanwhile fails the read as
the kernel's read failed, the records before it taken as read. Measured
there: copy 7.4 and compare 5.3 ms a frame of six threads for 35 MB. Here
the round's reading and comparing was 2.6-3.1 ms a frame (release run
233354), and the submitting thread waits 2.7-5.8 ms a frame for rounds.
Changes nothing of what is mirrored (the same records found changed);
reads title memory in place instead of through the kernel. Off by
default. With it on, the frame line "the heaps' records read where they
are" counts pages and those not all there; the heaps' records line's
"reading and comparing" and "ms waited for" show the gain.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The round that mirrors descriptor records the title copied into its
heaps as bytes runs on a thread of its own, begun after the submission
planned its steps done on the card and looked at flights, and waited for
at the end of the preparing. That wait was 2.7-5.8 ms a frame of the
submitting thread in release run 233354 (heaps' records line, "ms waited
for"), 5% of its samples in profile-y-prof60 (SyncedHeaps' drop), while
the planning ahead of the round's start took 2-4 ms a frame.
With the switch a submission sent ahead begins the round as soon as it
holds the submission lock, so it runs beside that planning too. A
submission that waits for flights to land (settle or relay wait) begins
another round after the wait, as the round began there saw what they
landed; the first is then not waited for.
Not behaviour-neutral in timing: the round reads the heaps' pages earlier
by the planning's time. A record the title writes for a submission after
submitting it is left to the next round (the console's card could miss
it as well). Off by default. The frame line "the heaps' records begun as
a submission took the lock" counts the rounds begun first and those begun
again; the heaps' records line's "ms waited for" shows the gain.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
shadow::wide woke every kept thread (4 on 16 hardware threads) for each
call, however few its jobs: a submission's refresh_front with 2 copies to
refresh woke 4 threads, 3 of which found nothing and slept again. Waking
is a system call per thread on the calling thread
(NtAlertThreadByThreadIdEx, 2.4% of the submitting thread's samples in
profile-y-prof60, 1.3% under shadow::wide), and the threads woken for
nothing take processor time from the others on a machine where ready
threads already wait to run ("woken, not running yet" 1.4-6.1 ms of the
frame's chain in timeline tl.170).
Now one thread is woken for each job beyond the one the caller takes,
all of them only when there are jobs for all. A thread busy meanwhile
looks at the queue before it sleeps, and the caller takes every job
nobody took, as before, so no job waits for a thread.
Behaviour-neutral: the same jobs run, on the same threads. On by default,
no switch.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every submission (28 a frame) made its Batch anew: the table of pending
refreshes by copy, the staging buffers seen (with the standard hasher),
the copies refreshed ahead; and three walks over its steps each built a
hash table of the copies from nothing: the spans of the one write-watch
asking, the spans of copies shaders may be writing (stale_under_flights),
and refresh_front's copies. In profile-y-prof60 hash tables growing and
inserting under Host::submit were 2.4% of the submitting thread
(reserve_rehash and HashMap::insert), heap allocation and freeing more.
Now the Batch is kept per thread, emptied with its room, for the next
submission. The per-copy spans of all refreshes are found in one walk
(Batch::copy_spans) and serve the asking (the copies asked ahead, as
before), the stale check behind flights (the copies with writes pending,
as before) and refresh_front, which takes the copies' references from
them instead of a table of its own. The staging buffers seen use the
address hash.
Behaviour-neutral: the same ranges are asked about (in another order;
the asking sorts them), the same spans are looked at in the same order,
the same refreshes are made. On by default, no switch.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
At every submission each of the title's lists gets a new host list, from
the pool of landed lists (reset when they landed) or newly made: open and
empty. It was closed at once on the submitting thread, so that the
title's next call on its list, a reset, found it closed, and that reset
then reset allocator and list once more. About 200 empty closes a frame
on the submitting thread (HostList::close under list::detach, 3% of its
samples in profile-y-prof60, about 1 ms a frame) and 200 needless resets
on the threads that translate lists.
Now the new host list is left open and marked with its title calls and
epoch; the title's reset finds it so and skips the D3D12 reset (the rest
of the reset, scratch memory, states, steps, is done as before). If the
title submits the list again without a reset, the host list is closed
when it is taken to run, as before. If anything was recorded into it
before the reset (its title calls or epoch moved), it is closed and
reset as before.
Behaviour-neutral: the lists that run on the card are the same (these are
empty either way). On by default; VICTORY_FRESH_OPEN=0 closes them at
once as before. The frame line "new host lists for the title's lists
left open per frame" counts them, the resets that had nothing to undo and
those closed after all.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The split of a submission's preparing (write watch, title bytes under
flights' writes, the lists' steps and their refreshes, card copies, the
waits for the heaps' records, sending) was counted in diagnostics builds
only. It is now counted in every build, some forty clock reads a
submission, and logged every second as "preparing per frame, the
submitting thread: N ms in its submissions: ...", with the time after
each sending (the flight noted, landed lists reset and given back). The
line of the thread that does the line says what it spent taking
translated lists out of the line (new host lists closed for the title's
lists), which is outside its "worked" time. Diagnostics builds print the
same line in place of their old first split line; their other split
lines are as they were.
Behaviour-neutral: counting and logging only.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported from Belobug/VIctory-Belobug-AMD 5d6bd84 ("Upload title textures in
submission prelude to fix frame-order & flickering"), where it is the only
way. A list records the upload of a title texture it samples only if the
staging buffer was changed when the list was recorded; the check at
submission may then find the memory changed and detile it, and only the
next list that samples the texture uploads that: a frame late when every
list of the frame was recorded before the check (a video's ring of buffers
shows an older picture, a texture streamed in its last one). A candidate of
the flicker at scene loads (analysis 6.12).
With the switch, `texture::upload_from` records nothing in the list: it
leaves a `PreludeUpload` (staging buffer, host copy, levels on demand) with
the list, and its `Step::Texture` as before, so the checks run where they
ran. At submission, after the list's steps, the staging buffers left pending
are refreshed (`Batch::refresh_textures`), and each texture whose host copy
was never uploaded or whose staging buffer was detiled since its last upload
is claimed (`claim_upload`; once per change, whichever lists of the
submission sample it) and copied on the list's prelude (`HostList::prelude`):
aliasing barrier for a pooled texture's first upload, to the copy
destination state and from there to the state the list starts with. What
the list's own upload did after the copy (a host copy grown, levels on
demand given memory, what the host copy holds) is done at the claim.
Kept as before: bakes (they record their copies whatever the check finds)
and movie planes. Left out of the port: the texture store's prefill (this
tree has none), the fork's refreshes before every copy and run step (here
`title_written` flushes the textures due already), the fork's change of
`Step::Texture`'s payload (the upload is held beside it instead, so the steps'
other readers, `card_steps` and `place`, are untouched), and its panel
change (unrelated).
Off by default (not behaviour-neutral: when textures are uploaded changes).
Tests (from the fork): a claim per change, in the same submission; a ring of
three buffers never shows an older picture.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported from Belobug/VIctory-Belobug-AMD 4cd2d13 and 91018a5, where it is on
by default. Every device loss with the texture pool in that fork's report
(n08, n11, n15, steps-ab2, start-3, a user's play-1125-2107 without ray
tracing) was a page fault at the first byte of a texture in a block made
that millisecond, its title slot changed "at once" (`mirror`) while lists
sent before read that slot by index; VICTORY_SHOW_AFTER covers only some
paths (a draw's table, the texture pass's own uploads). We run the pool.
With the switch, `HostHeap::mirror` holds a slot whose new view shows a
pooled texture made while a submission begun before it may still run
(`pool::begun_before`: the submissions begun when it was made, noted in
`pool::made_now`) on what it showed, or the neutral texture if that cannot
stand for it (`keep_shown`), and flips it when every such submission has
finished (`FLIPS`, `texture_slots_flip`); a slot held back is held once, not
again at each draw or pass that reads it (`NEW_PENDING`, 91018a5). A line
says how many slots were held back since the start (with the switch on).
Also an A/B switch in diag builds (VICTORY_AB).
Off by default (not behaviour-neutral: a slot shows its new texture one or
more submissions later); with it off, `made_now` notes nothing more than
before and nothing else changes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported from Belobug/VIctory-Belobug-AMD c278f0d. That fork places pooled
textures of 64 KiB and less at 64 KiB multiples by default (4 KiB multiples
only with VICTORY_POOL_SMALL=1): its two device losses with the pool on the
night of 2026-11-25 faulted in 256x256 block-compressed textures with 7
levels placed at a 4 KiB multiple that is no 64 KiB one, whose descriptor
base lay 0xa000 into the piece and whose first level ended 0x2000 past it,
read by the card the moment the slot was made. Not proven to be the cause.
Here the switch keeps its name and meaning, with our default: unset or 1,
4 KiB multiples where the host allows it, as before; VICTORY_POOL_SMALL=0,
64 KiB multiples (at most 60 KiB more card memory per small texture). Also
an A/B switch in diag builds (VICTORY_AB). Diag builds with the address book
say loudly when a pooled texture's first level lies past the end of its
piece (`where_the_card_reads`, `book::address`), and where the first levels
of the first 40 lie.
The fork's test of a placed texture's reference to its heap is left out
(a measurement of the host; the fork weakened it in 4cd2d13).
Off by default: changes where pooled textures lie and how much card memory
they take.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Run fps-1 (our clock at 16.667 ms, the title left at 30): the menus ran at
16.7 ms until the title's own limiter came up at 30 s (then 33.3 ms), and
meanwhile five of its seven timers stepped 33.3 ms a frame: game time ran
at twice the wall clock. The timer update (+0x2226040) takes the real time
since the last frame but at least 1/rate (+0x6849844), and that rate comes
from +0x2241fd0, a third read of the same setting. It now returns the rate
asked for (1000 for no limit), the original bytes checked first.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 08b88b8266c2d0294d483d29b15534872ebc7da9)
The title asks for 33,333 us (SetFrameIntervalX) because its graphics
settings hold a frame rate of 30 (settings +0x210): +0x1e0fb30 and
+0x22434a0 turn it into a frame time (+0x98f84ac), +0x247ab10 picks the
interval from it and the display's 60/120 Hz (a 120 Hz mode alone changes
nothing at 30), and +0x120530 is a QueryPerformanceCounter limiter of its
own at the same rate.
VICTORY_FRAME_INTERVAL_MS=<ms> (16.667, 8.333, 0 = no wait): frame.rs ticks
at that interval whatever the title sets; the loader makes the two loads of
the setting "mov eax, rate; nop" (rate = 1000/ms rounded, 0 = the title's
own "no limit"), with the original bytes checked. VICTORY_TITLE_FPS=<n>|off
overrides the rate or leaves the title alone. Diagnostics:
VICTORY_TIMER_LOG=1 logs the title's timers once a second and frame pacing
bands every 5 s.
Ported from Belobug/VIctory-Belobug-AMD 49cb83b (author: local); the descriptor-site module of renderer port 2 left out. Our VICTORY_FRAME_INTERVAL_US (our clock alone) still works; VICTORY_FRAME_INTERVAL_MS is read first.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The pass reads the view a slot holds at the start of the slot's turn (under
the views table's read lock: the record, the view by its number, a copy of
it). For a slot shown after its upload (VICTORY_SHOW_AFTER=1, in the
launcher) or flipped from an earlier view of the same texture, it read the
same record and view again a few microseconds later to make the host
texture and its upload. It uses the first read now. Other threads waited
86-383 ms per 5 s of a cutscene for the views table's lock
(coolfox-20261126-233017).
Behaviour-neutral: the record may change between two reads, and using the
first is as if the second had come that much earlier; a write of the slot
meanwhile queues it again, as before. Slots made at once (the other path)
are unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A slot's record of a texture object the host renders to or writes (a
target, depth or unordered access texture) is queued for the pass over
textures picked by index like any texture. The pass takes such a slot,
finds nothing to bring up to date (it makes and uploads nothing for it) and
takes it out; the title writes such views into its tables' slots every
frame, so they come back, each time a take of the queue's lock, a place
among the slots due and a few microseconds of the pass (58,978 of 90,699
slots taken in 5 s of a cutscene found nothing to do,
coolfox-20261126-233017 18:02:23; 18ff932 says how many were such views).
With the switch, such a record takes the slot out of the queue as a buffer
view's does (`note_buffer`; with the queue's marks, without its lock when it
is not queued). Counted since the start in the lock line.
Off by default (not behaviour-neutral, though the pass did nothing for these
slots): fewer slots are due, so a pass reaches others sooner, the catch-up
budget (VICTORY_TEXTURE_CATCHUP, started by the count due; off in the
launcher) starts less often, and a bake's pass is asked for less often (it
runs when the queue's write count changed).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A slot draws read through a table leaves the queue of textures picked by
index at its first table read of a frame only (`tabled_in`, once per slot
and frame; and the draws of a recording tell of a record once,
`Listed::tabled`). The title rewrites tables' slots while it records: a
slot written after that read is queued due `TABLED_GRACE` (8) frames on, the
draws that read it later in the same frame leave it there, and the pass
takes it 8 frames later and finds it uploaded by those draws or nothing to
do: 17,000-58,000 slots in 5 s of a cutscene (coolfox-20261126-223059,
analysis 6.6; "read through tables" and much of "nothing to bring up to
date" in the pass's split line).
With the switch, such a later read takes the slot out when the queue's marks
(b5b7806) say it holds it, a lock-free look (without the marks it does
nothing: every read would take the lock), and the recording's gate lets a
slot the queue holds through, so the draw also makes the title's slot in
place as at a first read (`mirror_after`). Counted in the lock line: slots
taken out by a table read after the first of their frame, since the start.
Off by default (not behaviour-neutral): a shader that picks such a slot by
index then sees what the draw made of it at once, not what the pass makes 8
frames later; that lateness is a candidate of the flicker at scene loads
(analysis 6.12).
Test: written after its frame's first read, a slot waits for its grace
frames; a later read takes it out with the switch only.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The pass over textures picked by index took the queue's lock once or twice
for every slot it took: to ask what is known of the slot (a texture uploaded
whole, waiting for a look again) and to tell what came of it. In 5 s of a
cutscene it took 90,000-250,000 slots, and its "telling the queue" was
143-400 ms, about all of it waiting for the lock (152-355 ms by the pass;
coolfox-20261126-233017 18:02:18-18:02:23).
- What it found of a slot (done, uploaded in part, uploaded whole and looked
at again, nothing to upload now, held for room) is told 16 slots at a time
under one take of the lock (`HostHeap::texture_slots_told`), the rest when
the pass ends, on every way out. A slot's entry is told of a few slots'
work later, as it would be if the pass's thread were held up for that
long; what is told of a write the queue no longer holds is dropped as
before (`TextureQueue::same`).
- What the queue knows of a slot waiting for a look again is read while the
slots due are taken, in the same take of the lock
(`HostHeap::texture_slots_due_known`), and used if the queue's marks
(b5b7806) say it still holds the write handed out; else it is asked as
before.
Behaviour-neutral: the queue ends as it would with each slot told at its
turn (test), only some microseconds later. On by default;
`VICTORY_QUEUE_BATCH=0` tells and asks each slot at its turn, as before.
The lock line (18ff932) counts the lock taken by the pass apart.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every slot record a recording thread, the heaps' records thread or a draw
makes is noted in the queue of textures picked by index under its one lock
(`HostHeap::queue_texture`), and so is every first table read of a slot in a
frame (`tabled_in`) and every slot a newer view makes stale. Most of these
change nothing: a buffer view, a sampler or a null taken out of a queue that
does not hold the slot; a slot a draw or the pass made from the record the
queue holds already (`seen`, kept as it is); a table read of a slot not
queued. Other threads waited 33-44 s for the lock in a run of 150 s
(coolfox-20261126-232343, -233017), up to 3.3 s in 5 s of a cutscene.
The queue now marks, per title slot, the write of the entry it holds (0:
none; `QueueMarks`, set by the queue itself under its lock). These three
places read the mark first and do not take the lock when it says nothing
would change. Behaviour-neutral: a mark read while the queue changes it
says what the queue held just before or just after, as if the lock had been
taken a moment earlier or later, which any of these threads may always do;
writes (not `seen`) always take the lock. Counted as "not taken" by place
in the lock line (18ff932). On by default; `VICTORY_QUEUE_MARKS=0` takes the
lock every time, as before (for comparing).
Tests: the queue marks what it holds through writes, makes, looks, uploads
in part, memory made due and removals; notes that change nothing leave the
queue (and its marks) as they were.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The split line of 7d8d56a found, per run of ~150 s, 3.8-5.2 s of the pass
and 33-44 s of other threads waiting for the lock of the queue of textures
picked by index, and 5.0-7.0 s in "slots shown after their upload, flipped
or made at once" (coolfox-20261126-232343, -233017). Two more 5-second lines
say where:
- the queue's lock by place (`descriptor::queue_site`: the pass asking of or
telling of a slot, taking the slots due, making slots due, noting a slot's
record, table reads, stale views, else): the times it was taken, the waits,
how long the places that hold it for many slots held it (the slots due,
slots made due, stale views), and the times it was not taken (none yet);
- the pass's parts: slots made at once, shown after their upload and
flipped (time and count); the slots with nothing to bring up to date by
why (views of textures the host writes, no texture, the host's own
texture) and how many of them the pass made at once; the work before the
loops (slots made due, views made again and flips, taking the slots due).
A lock taken is counted by one relaxed add under it; hold times are timed
only at the places that hold it for many slots. Nothing else changes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
With VICTORY_FRAMEGEN=1 and presents through Streamline's swap chain:
"DLSS Frame Generation, time per frame: the presenting thread N ms
before the present call, N ms in it (the longest N ms), N ms after it;
of those N ms in the latency markers and N ms asking frame generation's
state; an upscaling recorded in N ms (N ms of it waiting for the lock it
shares with the present); the copy of the colour without the interface
recorded in N ms". Counting and logging only; nothing is timed without
frame generation.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
VICTORY_FRAMEGEN=1 without VICTORY_DLSS=1 leaves the upscaling to the
title's FidelityFX, whose shipping FSR4 is made for 1920x1080 only; at
another output its context is not made and the title fails at its first
upscaling. The log now names the cause and the switch to add. Logging
only.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
On Series X the title blends its interface target over the frame itself:
one triangle (vertex 0602c2384acbb3b2, pixel a78d088fa55aa495), the last
draw into the texture it presents. With VICTORY_FRAMEGEN=1 the target is
copied into a texture of ours in front of that draw, at its place in the
title's list, and the present tags the copy as kBufferTypeHUDLessColor
(VICTORY_FRAMEGEN_HUDLESS=0: not). Log: the first copy, each other
pipeline that draws into a presented texture, and counts every ten
frame-rate lines.
Found reading the in-game path:
- Frame generation's constants get the camera's planes in order (the
title names the far plane first; the projection took 10000 for the
near plane of an endless range). DLSS Super Resolution's are as before.
- With Streamline's swap chain the system's Alt+Enter is not taken.
- Video memory is logged before the first present with frame generation
on and 240 presents later.
upscaler-check: a stand-in colour without the interface is tagged with
--present; with a device the check ends with frame generation off, the
swap chain let go and slShutdown (VICTORY_CHECK_TEARDOWN=0: not): the
exit code is 0, where the process failed fast at its exit before
(0xC0000409, shown as 9). VICTORY_STREAMLINE_PRESENT=1 (off): with DLSS
and no frame generation our swap chain is Streamline's proxy of it, which
ends "presentCommon() was not observed" (the check runs it with
--present: 120 upscalings and presents).
With VICTORY_FRAMEGEN off and the new switches unset the title runs as
before.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
VICTORY_SOFT_VIEWS=1 (pool: the title's XMemMapPhysicalPages views alone;
copies: those of CopyPageMappingsBatchX alone): a view is noted in the
runtime's books and told to the GPU side as mapped, its addresses are one
placeholder of their own, and the host maps nothing. Each view of the host's
was a MapViewOfFile3 (45 us) and later an UnmapViewOfFile2 (93 us), both
behind a lock of the kernel's that the guards' protection changes take too:
445,503 maps (20.1 s) and 349,175 unmaps (32.6 s) in 143 s of run stream2,
359,969 mapping calls 23.8 s, 3,294 page-mapping copies 33.7 s, one of them
467 ms of a 608 ms frame (timeline tl.120).
Who gets the bytes of such a view, and how:
- DirectStorage writes pages by number through the section's own view, and
page-mapping copies read the pool from the books: as before.
- The GPU side's reads of title memory (host::read, read_sparse) take them
from the pages through the section's view (xmem::soft_read); a texture
with such views is read through a copy, not in place; texture::committed
takes such views for committed.
- The guards keep such a view in their books (watch::protect_here,
protect_alias): no VirtualProtect, no question to the host. A write the
runtime tells of, or one through another view of the page, opens it as
before.
- Any touch of the memory itself (the title's CPU, a direct read of ours)
faults; the GPU side's handler has the runtime map the view and the access
is made again; the guards then open it and every other view of its page
(title_memory_made_real). Our writes through the kernel, announced kernel
writes, and the title's XMemVirtualQuery, XMemVirtualAlloc, VirtualFree
and (with the switch) VirtualQuery and VirtualProtect ask first.
Why VICTORY_LAZY_VIEWS=1 ran at 2 fps (run xw-lazy, 2.4 to 3.4 GB of copies
a frame): a view guarded together with a lazy view of the same page was
never clean, because the host refuses to protect a placeholder
(protect_alias), so it was copied again at every asking; and every guarded
range made its lazy views real. Both are what the books replace here. Also
for both switches: a view is known as lazy before the GPU side is told of
it (a refresh in between noted the block absent), and its pages are
committed when it is noted (the GPU side writes them through its own view
of the section).
Counted: the streaming log's M line gets twelve more fields with either
switch (noted, let go untouched, made real; noted by mapping calls, by
copies; made real by a fault of the title's code, of other code, asked for
by the GPU side, by a call of the title's; reads served from the pages,
their KiB; such views now), and with VICTORY_SOFT_VIEWS the log has a line
of the same every 10 s, with the last faulting address and code.
Tests: xmem and host views_in_the_books_alone_are_read_from_their_pages, watch
a_view_in_the_books_alone_is_guarded_there. Not run in the game yet.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
GameInput in this layer offered four XInput pads, a stand-in pad driven by the
keyboard, and the keyboard, but no mouse. The title polls GameInput for mouse
movement, reads nothing, and never turns the camera while the keyboard works.
The new device reports position deltas taken from the host cursor inside our own
window and the three buttons. It exists only while our window is in the
foreground and goes away with a disconnect callback when focus leaves, so
moving the pointer elsewhere does not spin the camera. Wheel rotation is not
reported: the host call used here cannot see it.
`VICTORY_GAMEPAD_MOUSE=0` leaves the device out entirely, which is what the
layer did before. Verified in a run: with the window in front the device appears
(kind 0x20) and it does not appear while another window has focus.
Runs y-texA-a/b (this branch) vs y-base-a/b, y-texB (VICTORY_STAGED_ASK_ALL=1 = old cost), 2026-11-26 23:20-23:47:
asking Windows whether a staged texture is all there cost 271 ms per whole run with the old behaviour, 91-189 ms
with these commits: a real but small saving, not the 400-700 ms per 5 s expected. The pass's "rest" did not drop
beyond run-to-run noise (whole-run sums 14.9-21.3 s vs 16.3-18.2 s). The new split line shows where it goes:
slots shown after their upload or flipped 5.0-7.0 s per run, telling the queue what came of each slot 4.0-5.6 s,
waiting for the queue's lock 3.8-5.2 s by the pass and 33-44 s by other threads. Gameplay frame unchanged
(33.8/34.0 vs 33.2/33.5 ms); fixed frames match. 4c58bf2 (VICTORY_TEXTURE_FRAME_MS) is left out: run y-texC no
better.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
PR #8 made VICTORY_WINDOWS_BAR_MB opt-in (-WindowsBarMB). Without the
switch, a 16 GB PC was back to the 0x8007000E crash about a minute into
the world that PR #6 fixed: Windows lets the card share at most half the
RAM, and the windows fill that. Now, when -WindowsBarMB is not given, PCs
with under 24 GB of RAM get 3072 and larger ones keep the runtime default
(off). -WindowsBarMB (0 included) and -More still decide when given; if
the RAM can't be read, nothing is set.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Expose the cap in MiB as a launcher parameter and keep the existing More override. Restore the runtime default for launches that omit the cap.
Refs: #6
The texture pass's question whether a staged texture's memory is all there
is still put to Windows for textures made at an address the title mapped
(the console's usual placed textures; a question per 256 pages). The
runtime's views of physical pages answer it where they cover the memory, as
they already answer `mapped_bytes` for placed views: one look, under a
microsecond where Windows took 3 us (350 KB), 135 us (22 MB) and 647 us (22 MB,
1 MB there) (look_costs on this PC). Windows is asked only where no view
lies. `VICTORY_MAPPED_BY_VIEWS=0` asks Windows, as for `mapped_bytes`;
`VICTORY_STAGED_ASK_ALL=1` still asks Windows of every texture.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The census counted a slot uploaded whole and waiting for its looks again
(RECHECK_FRAMES 4, 12, 40, 120, 400 frames: in the queue up to 576 frames
after its upload) as "waiting for their memory", and its old write as "the
oldest". In coolfox-20261126-223059 at 17:02:04 the queue line said 19,277
waiting for their memory when the looks that had found memory not there
numbered 1,700 in the whole run (17:01:45: 6,842 vs 104; 17:01:59: 19,023 vs
471): nine in ten or more of them were uploaded textures waiting for a look
again, not streaming. They are counted apart now ("uploaded whole and waiting
to be looked at again"), and "the oldest" is of slots not uploaded yet.
A new 5-second line says how late first uploads are: slots served for the
first time at their first look, with the frames they had been due before the
pass took them (the pass's own lateness: its time cap), and slots served
after their memory was found not there, with the frames since their write
(streaming: mapping that came late).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
`texture::staged(_, ask)` asked Windows whether every page of the texture's
memory is there (QueryWorkingSetEx per 256 pages, and a one-byte read of each
page not in the working set) for every texture object the pass took: 20,000 to
57,000 every 5 seconds, most of them slots read through tables, which the pass
only marks done. A whole run found 66 not all there. The pass's unattributed
time followed their count: rest = 400 ms + 12.7 us x tabled slots per 5 s over
the run's lines (coolfox-20261126-223059, e.g. 17:02:57 57,760 -> 1,136 ms,
17:03:58 17,786 -> 629 ms). Measured here (pass_costs): 18-111 us for 1-16 MB
resident, 0.9-15 ms when the pages had been trimmed.
Only a resource made at an address the title mapped can lose its memory while
it lives; a committed resource's memory and a heap's are allocated and zeroed
whole when made. So the question is asked of those alone
(`resource::at_title_address`); `VICTORY_STAGED_ASK_ALL=1` asks of every
texture, as before. Expected: the cutscene's 846 ms "rest" per 5 s drops by
about 13 us x the tabled slots (400-700 ms), gameplay's ~690 ms by ~250 ms.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The pass over textures picked by index logged 846 of 1,408 ms (cutscene,
coolfox-20261126-223059) as "the rest". A second line now splits it:
telling the queue what came of each slot, reading the slots' records,
fingerprints after uploads and same-looks, handing first uploads to the
copy queue ahead, slots shown after their upload / flipped / made at once,
asking whether a staged texture's memory is all there, other checks; the
waits for the queue's and the views table's locks (by the pass and by other
threads, counted only when the lock was held: try_lock first); the work
before the loops (not in "all"); passes by kind (frame, early, bake) with
their time and how many stopped at their time or bytes; and the slots taken
by outcome.
The existing parts are summed in nanoseconds now: in microseconds each short
call lost what it took below the next whole one.
The pass reads the slot's view once for its placed and object checks (it
read it twice).
pass_costs (ignored test, a measurement): on this PC asking whether 1/4/16
MB of resident memory is all there takes 18/23/111 us, 0.9-15 ms when the
pages were trimmed from the working set; a fingerprint 3-7 us.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
With VICTORY_WC_NO_BACK=1 for every write-combined copy, cutscenes on the
4070 SUPER went near black (run xd-wcnoback): small results the title reads
back came back stale. 3,245 write-combined copies, median 4 KB, 82 of 1 MB
or more, 7 of 16 MB or more (largest 90 MB). Leaving only copies of 1 MB or
more on the card keeps the image (fixed frames equal to the plain run) and
the saving: with DLSS Quality, gameplay 38.3 -> 33.3 ms, cutscene median
47.3 -> 36.3 ms, p95 205 -> 142 ms, title's busiest thread 57 -> 47% of a
core (runs xd-base-b, xd-wc1m; 16 MB: 35.3 ms, xd-wc16m).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
On a PC with 16 GB of RAM (RTX 3060 12 GB, i5-12400F, Series S at 540p)
every run with play-nvidia.ps1 ended a minute or so into the world: the
card's shared memory (the PC's, capped by Windows at half the RAM) reached
7.5 GB, a host list failed to close or be made with 0x8007000E, and the
driver faulted in CopyTextureRegion. About two thirds of that memory were
the windows of title memory outside buffers.
VICTORY_WINDOWS_BAR_MB=3072 puts them in card memory the CPU maps
(D3D12_HEAP_TYPE_GPU_UPLOAD) while the card has room. Same machine: no
crash in 5+ minute runs, shared memory flat at about 4.4 GB, 10-12 fps in
the world instead of 1.6-3. Without a resizable BAR, mapped_card_buffer
returns None and windows stay where they were.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The title's shipping FSR4 carries only the Series S fixed-resolution quality
tables (1280x720 in, 1920x1080 out). At the 1440p output with the FidelityFX
path patched in, its context creation failed ("Shipping FSR4 configuration
mismatch"), our hook saw no context, and the title divided by zero at its
first upscaling (0xc0000094, runs x1440-dlssq, -dlssq2). With DLSS taking the
upscalings, the context is now made at the shipping sizes and DLSS gets the
sizes the title asked for; a dispatch DLSS does not take on such a context
runs no upscaling instead of the title's FSR4 at a size it cannot do.
Run x1440-dlssq3 (VICTORY_DLSS=1, quality, 1706x960 -> 2560x1440): 1.00 DLSS
upscalings a frame, none failed; gameplay 43.8 -> 38.1 ms, cutscene median
50.3 -> 41.3 ms, p95 319 -> 108 ms against x1440-base2.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
"read-backs and lists" in the landing line is split into texture
read-backs, buffer read-backs and the flights' card plans and own work.
On a 16 GB machine with an RTX 3060 (Series S, 540p) the texture part
stood at 1-2 ms a frame, and at 124-416 ms in the frames where the world
streamed: texback::land waits for the lock against mapping changes
(watch::title_memory_reading), which the title changes all the time
then, and the landing of every submission waited with it.
The landing thread now only copies a read-back's texels out of its
buffer; waiting for the locks, tiling and writing into title memory go
to a thread of their own, which writes only the newest of several
copies of one allocation (the title reads the frame before at most).
VICTORY_TEXBACK_ASYNC=0 writes them where they land, as before. A new
line gives the writer's waits and work per frame.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Add a per-kind breakdown to the periodic descriptor memory log. Report
occupied and free table slots and their flat memory footprint for all
six view kinds (constant buffer, shader resource, unordered access,
sampler, console sampler, placed memory). Free slots retain their last
occupant's kind until reuse. Both the existing summary and the new
breakdown come from one read of the table, in one pass over `list`
plus one over `free`, with no extra lock acquisition and no temporary
allocation sized by the table.
Two isolated tests (their own local table, no shared state, no raw
pointers, no unsafe code) verify the counts, byte attribution, and
cross-kind reuse: that a freed slot reused for a different kind moves
its count from the old kind's total to the new kind's without
affecting the table's overall size.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Allow local paired compute bytecode on the supported Wave32 host when the normal translation confirms that the shader bindings match. Keep the normal translator and cache as the fallback.
The image is patched to the FidelityFX path at VICTORY_DLSS_MODE's scale
as for DLSS, without Streamline: on Series X what that path looks like
and costs by itself, so that a fault seen with DLSS can be put on the
path or on DLSS.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
With VICTORY_DLSS=1 or VICTORY_FRAMEGEN=1 and Streamline available, the
executable's imports of amd_fidelityfx_loader_xbox.dll (ffxCreateContext,
ffxDestroyContext, ffxQuery, ffxDispatch) are bound to ours, which call
the title's own DLL for everything and give an upscale dispatch to
victory_gpu::streamline: DLSS takes it (the title's is not called), or,
with frame generation alone, its inputs are noted and the title's runs.
The title's upscaler context stays its own, so its upscaling runs again
on any frame DLSS does not take; each reason is logged once.
Series X never uses that path by itself: no Series X run (stock or
1440p) loaded amd_fidelityfx_upscaler_xbox.dll, every Series S run did.
The renderer selection (title+0x7e9421) takes the FidelityFX path,
renderer 7, only on a Series S (title+0x75140 tests the device type for
6); Series X takes renderer 6, the title's own temporal pass. The title
sizes the FidelityFX path's scene itself (title+0x28ef69a: its scale
times the output size), not through ffxQuery. So with DLSS or frame
generation available, native_1440p::prepare_upscaler patches renderer 7
in and the scaled branch to VICTORY_DLSS_MODE's scale (dlaa 1, quality
2/3, balanced 0.58, performance 1/2, ultraperformance 1/3; noted as the
FidelityFX quality mode), and the temporal scene scale to the same, with
the 1440p output kept (images/native-1440p-upscaler-<mode>-sdr) or on
its own (images/upscaler-<mode>). Each instruction is checked against
the stock bytes first; the test does so with the retail executable.
Without Streamline the image is patched as before.
`victory upscaler-check [--device] [--present]` checks Streamline, DLSS
and frame generation on this PC without the title.
The FidelityFX description layouts and the image patch of the FidelityFX
path are ported from DexNom/VIctory (crates/victory-hle/src/modules/
fidelityfx.rs, apps/victory/src/native_1440p.rs prepare_fsr_4k,
GPL-3.0-or-later); here the title's DLL keeps serving the API and the
1440p output stays.
Co-Authored-By: Claude Opus 5.5 <[email protected]>