Repository navigation
GTA VI: all local work to reach the lit world, on current main (draft) - #1965
antocorvo3000 wants to merge 37 commits into
Conversation
16cdc20 to
c68d6fb
Compare
|
More of the same work, for reference:
|
|
Automated triage for the maintainers. Needs work; needs the maintainer's decision. The branch now merges cleanly, but CI
Generated by Claude Code |
|
Independent check on NVIDIA: as it stands, this branch still removes the device at frame 64 here — and that is the AMD/NVIDIA difference, not a criticism of the work I ran your branch as it is ( So on an NVIDIA card it does not reach the world: it stops at the same frame 64 that Why yours works and mine does not, as far as I can tell from the numbers: On your card the same call is legal and the boot goes on to the world; here it removes the device. That is why the same tree gives two completely different reports. The two fixes that make it survive on NVIDIA are already open against
With those two on What stops that measurement right now: your branch conflicts with today's which is also why GitHub reports it as not mergeable. I did not attempt the rebase: it is 3,262 lines across 28 files and the conflicts are in the page-marking and heap ground where guessing does more harm than good. If it helps, I can measure the rebased tree the moment it exists — same scenario, numbers in a comment, on the card where the failure is reproducible. No game data is involved: counts, warnings and a format name. Written with an AI assistant. |
…tor, heavy passes, audio lock), applied only where the expected bytes are found
… changed (whole 64 KiB pieces lost the title's stores: game crashes at world entry)
… with D-pad down)
…y in copy_back_page
Port 90d2128 to upstream-try. Use PSV runtime info v3 for implicit compute samples on quad-compatible thread groups. The four-source offline corpus gains 735 DXIL validations and retains every existing emission and validation.
Port 03978e5 to upstream-try. Use SV_Barycentrics for direct reads and materialize entry inputs consumed by live phi edges. The four-source offline corpus gains three validating pixel shaders and retains all previous emissions and validations.
Check set bits directly for missing pages and leave empty words untouched during copy-back. VICTORY_SPARSE_PAGE_BITMAP=0 restores the original scans.
…destination)
- Add CopyLocationData union so CopyLocation matches D3D12_TEXTURE_COPY_LOCATION
exactly (subresource index and placed footprint share the same 36 bytes).
- Route dst=FOOTPRINT, src=SUBRESOURCE to new copy_texture_to_buffer(), which:
* validates format compatibility, row-pitch alignment (256 B) and source box;
* uses host.shared_buffer() as a D3D12 staging buffer;
* emits CopyTextureRegion on the host list (texture -> staging, offset 0);
* barriers the staging buffer to COMMON and defers a TextureReadback so the
next same-list buffer->texture upload that overlaps the same title range
can compose the GPU-written bytes over the CPU-written bytes;
* in defer_after(), opens the watched title pages and writes the texel rows
back via write_mapped(), leaving row padding and out-of-box bytes alone.
- Extend the buffer->texture path: check for overlapping prior readbacks and,
when found, compose them into the upload buffer via compose_texture_upload()
before recording the copy, so round-trip title reads see GPU output.
- PlacedFootprint fields made pub(crate); bytes() now uses checked arithmetic
and rejects footprints where the last row exceeds the pitch.
- Deferred struct gains a readbacks Vec; HostList exposes defer_texture_readback
and texture_readbacks helpers.
- Unit tests: PlacedFootprint::bytes (1x1, two-row, full-row, BC1, invalid,
unknown format) and CopyRows::new (full 2x2, sub-box, x-offset, volume
two-slice, zero-size, out-of-bounds): 100 passed 0 failed.
… (integer rounding, no host doubles)
…_HEAVY=1: they left interiors black
Shaders that take descriptors from the resource heap itself (bindless materials) read placed-texture slots that the heap mirror leaves null until a draw reads them through a table (the shortcut that keeps ~20,000 host textures from being made at once). In Grand Theft Auto VI most world materials sample that way, so their G-buffer albedo came out black and the lit scene stayed dark. Translated shaders now mark each heap slot they take a shader resource view from in a bitmap (u1 in the memory space, an atomic OR per lane), bound per list like the written-pages bitmap. After the list ran, each marked slot still holding a placed texture left for later is made, so it reads from the next list on. Only the textures in use are made. VICTORY_HEAP_USAGE=0 turns the marks off (shaders as before). The frame line reports slots marked, views made, and why marked slots were not made. Unit tests leave the marks off (the hardware harness binds only the parameters each test names). Measured in the world: albedo coverage from ~20% to 99% of the screen; about 10-20 views made per 5 s once streamed in; no view failed to make.
Resolve paired timestamp queries on the recorded lists and aggregate completed measurements by pipeline and command kind. Enable with VICTORY_GPU_PROFILE=1 in diagnostics builds.
With VICTORY_HEAP_USAGE_VRAM=1, clear private GPU-local bitmaps at submission, then copy marked bits to readback after each list. Preserve feedback across repeated list executions and fall back to the shared bitmap if allocation fails.
…HEAVY=1: some passes ran at 1280x720 in 2560x1440 targets and the GPU took twice as long
…er next; the title-filled texture debug line only in captured frames
… own copy" This reverts commit 940d32f.
…hed with them); the shader cache keys on view marks and heap usage
…n (VICTORY_CPU_PROFILE=1) Timers summed per stage (draw prepare, bind, heaps, pipeline, tables, table entries, readable, user data, root views, vertex/index buffers, target states; submission: sync heaps, bindless uploads, run deferred by step kind, batch flush, preludes, vram sync) and counters of lookups and locks on the path, logged every 5 s per frame. Off by default; off, each timer is one relaxed atomic load. Adds an ignored micro-benchmark, draw::tests::draw_sequence_bench, that replays 5000 world-like draws (tables of constant buffers, raw buffer views and placed textures, vertex and index buffers, a root constant buffer) and one submission. The vertex/index part of prepare_for moves into State::vertex_index, unchanged, so the benchmark can call it.
…ets, per-lane fetches, slots no UsedResource names) mark their slots too, so placed textures read that way are made (VICTORY_HEAP_TABLE_MARKS=0 turns it off; part of the shader cache key)
…RROR_FAST, default on) The in-game profile showed ~167 us per table (12 entries). A benchmark with six threads recording at once over one shared heap, 5,000 registered buffers and a thread writing view records meanwhile (draw_threads_bench) reproduces it: 168.6 us per table, 9.8 us per entry spent waiting for the heap's made-slots mutex, held by each mirror while it waited for the global view-records mutex that the title's view creation keeps taking. - Host heap slots keep their record keys in atomics; a slot already made from the record a draw finds returns its view without the heap's lock (VICTORY_MIRROR_FAST=0 takes the lock every time as before). A slot being remade shows key 0 until its view is written. - View records sit behind an RwLock: lookups share it, and recording a view already known takes only the shared lock. - Buffer copy lookups share an RwLock; only making a copy takes it exclusively. - Finer profile stages inside table entries (mirror, its lock waits, descriptors made, placed textures, copy lookup and its lock, deferred refresh, texture state) and counts of slots remade. Benchmark per table: 168.6 us before, 31.7 us with the switch off (the RwLocks alone), 19-23 us with it on; recording wall time 341 ms -> 45 ms.
…ult off); note_use without a key per draw VICTORY_BATCH_PRECISE_COPIES=1: a title copy at submission flushes only the pending refreshes whose ranges reach the pages it writes and drops only the current ranges there, instead of flushing every copy and making every copy due again (the world has 60-90 title copies per frame, each of which made every later list check its big buffers again). VICTORY_BATCH_FLUSH_ONE=1: a range shaders write (not marked) flushes only its own copy's pending refresh before its snapshot. Both default off: with fewer flushes a copy's ranges merge into wider hulls, and a range a list asked for before a title copy rewrote it in the same submission may then hold the copy's bytes (the old path does the same where its hulls reach it). Every other asked range holds the same bytes: precise_flushes_give_shaders_the_same_bytes runs one step script both ways on identical memory and compares them (228 copy updates against 172 with both on). Adds title_copies_per_submission, an ignored benchmark, and a copy-update count to the CPU profile. memory::note_use finds a pipeline counted before by name instead of making an owned String key on every draw reading title memory (VICTORY_NOTE_USE_LOOKUP, default on; same counts, unit-tested). The CPU profile counts views made readable instead of timing each one (the timer alone cost about 1 us per draw).
…M copies are on The VRAM copy port changed indirect::done to leave the argument buffer in the common state for every run. With VICTORY_VRAM_COPIES unset it goes back to unordered access again, as before the port, so the switch off records the same barriers as the build without VRAM copies.
…ws it The presenter took the first visible window of the process. When the title presented its first frame before it showed its window, there was none: the presenter made a window of its own and kept presenting there, while the title's window (the stand-in victory-hle shows for it) stayed white for the whole run. Boot timing decides that race, so unrelated changes moved builds from one side of it to the other. The swap chain now goes to the stand-in (class VIctory.title) whether it is shown yet or not, a shown one first (VICTORY_PRESENT_STAND_IN, default on; =0 takes only a visible window, as before). The "presenting to a window" line names the window (hwnd, stand_in, visible, own), and a failing swap chain Present is logged (first 8). frames_presented_before_the_title_shows_its_window_reach_it (ignored: it opens a window) presents before showing a hidden stand-in, then reads the stand-in back as composed (PrintWindow with full content): red with the switch on; white with VICTORY_PRESENT_STAND_IN=0.
…out it the world came out black (light lists bound as placeholders, exposure at its minimum)
c68d6fb to
2c16ed2
Compare
Updated: the branch is now on top of current main (940d32f). This is the build that reaches the lit world of Grand Theft Auto VI 1.0.2.1 on an RX 6800 XT (Series X mode): exteriors and interiors lit, ~1.1-1.2 fps, about 5,000 draws/frame. Textures are still missing in places and some geometry is broken (hair as spikes); that is the next work. Opened as a draft so you can take what is useful; #1962 is the focused heap-usage change.
Findings on current main
int_prolo_int_prolo_int, a title read of address -1, reproduced twice on plain 940d32f with only the run conveniences below). Without those two commits the same scene runs 19 minutes. Here view marks are behindVICTORY_VIEW_MARKS=1(off) and 940d32f is reverted; the shader cache key includes the setting.VICTORY_PRESENT_STAND_IN, default on), with a window test that reproduces it.mademutex, which waited on theVIEWSmutex: 167 us per table in the world (~2.3 s of thread time per frame). Lock-free fast path for unchanged slots,RwLockforVIEWSand buffer copy lookups (VICTORY_MIRROR_FAST, default on).What is in it (beyond the earlier description)
VICTORY_HEAP_TABLE_MARKS).CopyTextureRegionto placed footprints,v_permlanex16_b32,v_cvt_f32_f64.VICTORY_GPU_PROFILE=1), per-stage CPU profile (VICTORY_CPU_PROFILE=1), capture on demand (capture-nowin the capture folder).VICTORY_VRAM_COPIES=1, with async it removed the device at the start screens) and overlapping CPU preparation with GPU completion (VICTORY_ASYNC_SUBMIT=1, reaches the world but the lighting disappears).VICTORY_TITLE_DIR,VICTORY_AUTO_A, in-memory patches of the 1.0.2.1 executable. The patches that switch off lighting passes (4, 5, 7-9) are off by default; patch 6 (world render resolution mode) is on: without it the title takes a render path where the light and tile lists are bound as 1x1 placeholders and the exposure sits at its minimum (black world).Testing
cargo test --release --lib: victory-gpu 182, victory-shader 258 passed on this machine.