Placed textures are read, kept on the card and uploaded from the first level their views show (VICTORY_HELD_LEVELS=0: whole;
after victory-amd 4436f8f1's spans). An upload of the bytes a host copy holds is left out (VICTORY_TEXTURE_SAME=0). A slot
shows its new view once that view's upload has run. A decoration bake takes slots due a few frames later too and waits for
memory being remapped (VICTORY_BAKE_EXACT=0). Host copies go only past 88 % of the budget, the longest idle first
(VICTORY_TEXTURE_KEEP=1: the rule before). A slot rewritten with other filler words keeps its view.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
mirror() previously dropped the SHADER_HEAPS lock inside shader_slot() before using the returned &Heap, allowing a concurrent Heap::drop to free the heap while mirror() accessed it. Also guards copy_simple() against invalid descriptor kinds, rejects placed heaps whose address+size wraps u64, and checks offset+count*bytes in resolve_queries() against overflow (with a regression test).
(cherry picked from commit 628b95da5e738046d00995743e07137e48936ba6)
Descriptor records the title copies as bytes are mirrored before each
submission. Views off their copy's elements: our rule (raw views too, and
now typed views on 16 bytes), the fork's copies. Wave sums of halves: ours
(the fork's test passes with it). Sizes of descriptors nothing uses: ours,
then the fork's for 2D images. The fork's count of cut indirect groups is
left out: up to WIDEST groups run as asked here.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Descriptor records the title copies into its heap as bytes are mirrored
before each submission (pull request #305 by Flyander, after upstream
VIctory 86a5ed6), with a per-slot fingerprint so only records that
changed are mirrored, the page read through the kernel, a switch
(VICTORY_HEAP_SYNC=0) and a counter: about 40,000 records a frame on the
test machine.
- A buffer view off its copy's elements gets a copy of its own bytes
(after upstream 86a5ed6; VICTORY_VIEW_OWN_COPY=0: refused as before).
- Room on the card for the world's first-frame bursts: buffer copies
(VICTORY_CARD_ROOM_FOR_BUFFERS, now on) and render targets
(VICTORY_CARD_ROOM_FOR_TARGETS_MB, 3,072); a copy turned down gives its
room up and is logged; the texture pass asks again every 32 MiB. 98
buffer copies made (945 MB) where earlier runs made 1; 25 MB compared
on the processor a frame where it was 550 to 710.
- Levels on demand: the fixes of pull request #747 by AscilCH. First run
on a card (RTX 4070, VICTORY_LEVELS_ON_DEMAND=1): no device loss, 3.1 GB
not allocated for levels the title does not hold. Still off by default.
- The guarded blocks under storage writes into physical pages are opened
by default (VICTORY_PAGE_WRITES=0: counted only).
- Shaders: a program is translated with first-half interpolation pairs
only if it was refused for one (with it on for every program 8,551
working pixel programs came out changed); parked lane-mask pairs,
f64 conversions and sums, lane permutations: 14 more programs translate.
- Counted, not fixed: an indirect compute pass asks for about 77,500
groups in x and is cut to 65,535.
One five-minute game run of these changes on the test machine: no device
loss, no failed request. This merged tree was built; its test suites
were not run.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The fork's guard over every view of a physical page is kept on our own block
bits, known holes, kernel writes and changing blocks; what both had, ours.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Memory sync:
- The guard over every view of a physical page (code by myokex, victory-amd
c6dc4d8, after pull request #115 by Spexivus, its correction by joroyt and
a part of VIctory #1122 by tightfall): the title shows one page at several
addresses and a copy was guarded at one only. 0.8 to 1.0 million writes
through another view in a five-minute run on the test machine.
VICTORY_VIEW_GUARD=0 turns it off.
- Kernel reads into title memory are read beside and copied in (Joshua Odom,
10ea38e).
- Writes of the storage layer into physical pages are counted where the
title has the pages mapped and can open the guards there
(VICTORY_PAGE_WRITES, off: counted only). Failed page-destination reads
are retried.
Card memory:
- Levels on demand, off unless VICTORY_LEVELS_ON_DEMAND=1: a texture the
title fills takes card memory for the levels the title holds; held levels
get memory only while the card has room and are asked for again. Its test
runs on the software adapter; not run on a card yet.
- Refused texture slots are held back so a pass reaches the slots behind
them; room can be kept for card copies of title buffers (off).
Tools: translate --warm all; the shader cache is keyed on the translator's
source; counters for copy-back races, page writes and the copies the
texture sweep never lets go; a walls trace.
Game runs of these changes on an RTX 4070: five five-minute runs without a
device loss or a failed request. This merged tree was built; its test
suites were run on the tree the changes come from (gpu 129, hle 97).
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Ports of 6f36cdf (normalized attributes of rectangle lists), 97c8783
(A8_UNORM is not of the R8 typeless family), b956320 (copy footprints of
depth-stencil textures), c1c3281 (the descriptor ring's wrap), e6fe8ec and
e34cb53 (CreateSamplerX bounds), 691236d (appended elements are aligned).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two fixes for textures that shaders pick by index, both proven with a
slot listing before they were made:
- The title keeps only a texture's small levels and places the next
texture in the address range of the absent large ones. Described at full
size every neighbour overlapped, and each view written took the textures
beside it out of the upload queue and made their host slots null (tens
of thousands of slots a run). A newer view now makes an older one stale
only when it starts within that one's first 4 KiB.
VICTORY_STALE_TEXTURES=overlap: the old rule; =0: never. Unit tests on
the span table alone. The first room is lit with its walls and the
characters' textures in the first launch with it.
- With the card at its limit, a texture that already has its host copy is
uploaded again when the title changed its memory (it took no new card
memory, and was refused all the same).
VICTORY_REUPLOAD_WHEN_FULL=0: as before.
Logging only, off unless asked for: both video memory groups and budget
moves; card accounting (VICTORY_CARD_ACCOUNTING=1); the slots a listed
draw's shaders read, with their state (VICTORY_LIST_SLOTS=); a trace for
the missing first-room walls (VICTORY_WALLS_TRACE=1 or 2). A card test of
what a bare command costs (ignored by default):
cargo test -p victory-gpu --release -- --ignored bare_command_cost --nocapture
Known: about 3 to 5 frames a second; more than half of the texture memory
on the card is held for levels the title has not loaded yet (next).
Co-Authored-By: Claude Fable 5.2 <[email protected]>
- The depth bounds test (#82 by Kaivyyy, as is): a pipeline that enables
it is made from a DEPTH_STENCIL1 stream under its own library name, and
the title's OMSetDepthBounds reaches the host list. Before, such draws
passed at every depth. On the test machine (RTX 4070) the first room is
lit by its lamp for the first time: walls, table, bunks.
- Defaults: what shaders wrote is copied back by a thread of its own
(stage 2), wide copy-back, card copies from 1 MiB up to 1,024 MB, and
256 lists in the air. About 230 ms a frame where it was about 400.
Off: VICTORY_RELAY=0, VICTORY_WIDE_BACK=0, VICTORY_CARD_BUFFERS_MIN_MB=16
VICTORY_CARD_BUFFERS_MB=512, VICTORY_LATE_WAIT_LISTS=128.
- Textures picked by index are uploaded while loading and before a draw of
the title's decoration bake, which samples them by index and runs once
(VICTORY_EARLY_TEXTURES_MS, VICTORY_BAKE_TEXTURES_MS; 0 turns each off).
- Placed textures are keyed without the filler words of their description:
two views that differed only there each had a host copy
(VICTORY_PLACED_FILLER=1 keeps the old key).
- VICTORY_TEXTURE_ROOM_PERCENT (90, unchanged) sets how full the card may
get before textures picked by index wait.
Known: the first room's walls are still missing in some launches, and
shaded areas are too dark (the bounce light has no ray-tracing structure
to trace yet).
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Textures and staging cut from 64 MB blocks; a kept view per page section and
page lists read again until the title has filled them in; the GPU side told
when streamed bytes land; results fetched over the copy queue
(VICTORY_RELAY_COPY=1); the write-watch journal behind a reader-writer lock;
the shader cache keyed by the translator's sources and `victory shaders`;
helper lanes as in upstream 1733 (VICTORY_HELPER_OWN).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Double-precision shader instructions (v_cvt_f32_f64, v_add_f64 sums, the
makeDouble overload name and flag), a first half of a paired interpolation
read as data, sooner eviction of idle textures and caches under memory
pressure, a retried DirectStorage destination write, the texture catch-up
budget, VICTORY_FIRSTLANE_OWN, and zlib-rs in place of miniz_oxide.
Left out: the fork's personal launcher scripts and its readme.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
World rendering, lighting, frame-rate and memory work for Grand Theft Auto VI
(Xbox Series X profile) on one Windows PC with an NVIDIA RTX 4070. The README
describes the state, the changes and the credits. Based on VIctory by Marvisak
and contributors (GPL-3.0-or-later); XCL by ivall and contributors was used as
a reference. No game files are included.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The host device was removed seconds into the world because a shader read
a descriptor of the wrong kind: empty slots held a null 2D texture view
where the shader expected a buffer, which gave a garbage heap index and
a read far past the view heap. Null descriptors now have the kind the
shader expects (raw buffer, constant buffer, or a texture of the title's
own dimension). The world then ran to a 240 s time limit with no removal.
Also:
- Host lists hold the textures, pipelines, root signatures and heaps they
name, and heap slots hold the resource they view (the title releases
objects before submitting lists that use them).
- The device-removed report places the fault against the host descriptor
heaps and names our own uploads; VICTORY_D3D12_GBV turns on GPU-based
validation, VICTORY_DUMP_TARGETS works.
- Indirect execution (draw, indexed draw, dispatch, mesh dispatch): the
world draws most of its geometry this way. Arguments are clamped and
charged to a per-list budget by a small compute pass first, so garbage
cannot hang the GPU. Off by default (VICTORY_INDIRECT=1): with it on
the title's own GPU watchdog ends the run about 30 s into the world.
- Shader-written ranges are copied back once per submission and only
where they differ; refreshes beside them copy only stale pages. The
frame-rate line counts copy-backs and dropped draws.
Not working yet: the world's picture is black (indirect draws off, and
hundreds of draws per frame have no translated shader).
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The title now boots through every first-boot and menu screen at its own
30 fps, drawing with translated shaders, with input, sound, saves and
loading served; it reaches the world, where the host GPU path still
fails (see "Not working yet").
Loader and runtime
- Crash reports unwind properly, name C++ throws and host GPU failures,
carry the title's last debug lines and are appended to crashes.log.
- Thread notices on our own threads, reentrant late DLL loading, exit in
the console's order, relaunch on a launch-new-game request.
- Offline guard: the title cannot reach the network (sockets, name
lookups, WinHTTP, the media source resolver); by-name lookups and
loads follow the import rules.
- Every runtime area the title calls is served (networking hint,
packages, store, saves, display, UI, speech stubs, user, async pool).
Saves persist; an update is one rename and survives a kill at any step.
- DirectStorage reads for real: shared worker pool, priorities, zlib and
BCPack. BCPack is our own decoder; the format's constant tables ship in
crates/victory-formats/src/bcpack-tables.bin (the asset policy's one
exception, see docs/asset-policy.md).
- GameInput from XInput pads and the keyboard, with a keyboard stand-in
pad; console timers (1 ms) for the whole process.
- Audio: XMA2 decoding on the emulated contexts, Opus on the decoder
queues, the DSP interface as a stub; title memory placed below 2^40.
- Console texture layouts (sizes, tiling, detiling) and the layout
library's imports.
GPU
- Draws, mesh dispatches and compute dispatches run on the host with
shaders translated at first use and cached on disk; descriptor heaps,
views, root signatures, barriers and host texture states; rectangle
lists; comparison samplers.
- Title memory reaches the host through persistent mirrors that copy
only pages written since the last copy; shader-written buffers are
copied back.
- Presentation with frame pacing per event kind; framerate in the window
caption.
Shaders
- DXIL emission for vertex, pixel, compute and mesh programs from the
console's native code, with a differential test suite against the PC
compile. World set: mesh 8,191 of 8,506, vertex/pixel 10,617 of
12,346, compute 1,643 of 2,539; utility set complete.
Build
- Debugging aids (debug logs, frame capture, stack dumps, scripted keys,
the host debug layer, the software adapter) exist only with the
`diagnostics` feature; `[profile.diag]` keeps that build apart.
Not working yet
- In the world the host device is removed within seconds (descriptor
handling fixes are in, unproven by a surviving run) and frames present
black.
- 64-bit image atomics, merged geometry stages and the BVH builder's own
shaders do not translate; reverb is silent.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Loader: map title-shipped DLLs, patch static TLS loads to slot 0, crash
reporter, title paths for GetModuleFileName*.
HLE: task queue and async, XUser (one offline user), system ids,
title id, features, invites, game events, persistent local storage,
GameInput with no devices, xmem, console audio hardware queues, life
cycle (close suspends, then terminates), and a file layer with virtual
drives rewritten in path-taking imports.
GPU: D3D12.X device, DXGI chain, heaps, resources, fences, queues and
command lists translated onto a host D3D12 device; clears, barriers,
copies, resolves and PresentX into the title's window.
Shaders: SGD5 reader and `victory translate`; SSA IR with node
splitting for irreducible flow; structurisation removing EXEC.
Co-Authored-By: Claude Opus 5.5 <[email protected]>