Skip to content

GTA VI: the rest of our work to reach the lit world (draft) - #14

Draft
antocorvo3000 wants to merge 13 commits into
DesertGamer:mainfrom
antocorvo3000:gta6-all-work
Draft

antocorvo3000 wants to merge 13 commits into
DesertGamer:mainfrom
antocorvo3000:gta6-all-work

Conversation

@antocorvo3000

Copy link
Copy Markdown
Contributor

The rest of the work we did to get Grand Theft Auto VI 1.0.2.1 into the lit world, on top of this main (c7846f1). It includes #13 (black albedo fix) as its first commit. The same work against Marvisak's main is Marvisak/VIctory#1965 and #1970.

Left out here because this main already has its own version: texture to buffer copies (PR 1583 here) and v_permlanex16_b32. Also left out: three batching and heap-sync speed-ups that conflict with the Batch rewrite here and are not verified in game yet (one run with them ended in a device removal). The VICTORY_TITLE_DIR part of the copy-back commit is dropped too: the configured game directory here already covers it.

What is in it

Rendering and correctness

  • Heap usage feedback: placed-texture heap slots that shaders read are made, so bindless materials get their albedo (same as GPU: make placed-texture heap slots that shaders actually read #13).
  • Copy-back writes only the byte runs the GPU changed, with a cached read-write region and 32-byte diffing. Whole 64 KiB pieces lost the title's own stores and crashed the game at world entry.
  • Translator: v_cvt_f32_f64 in integer arithmetic, implicit compute sampling with validator 1.8 (735 compute shaders that failed validation pass), direct pixel barycentrics and lazy phi inputs.

Speed (each =0 turns it off): VICTORY_INCREMENTAL_SNAPSHOTS, VICTORY_PARALLEL_COPY_BACK, VICTORY_SPARSE_PAGE_BITMAP. In game on Marvisak main, preparing went from ~480 to ~260 ms/frame and copying back from ~300 to ~120 ms/frame.

Diagnostics: compute dispatches and resource addresses in traced frames, scaled GPU clock, pipeline library per build.

Local conveniences, probably not for main: VICTORY_AUTO_A (presses A through the start screens), in-memory patches of the 1.0.2.1 executable (hang detector, audio lock). The patches that switched off the lighting passes are off by default; they made interiors black.

Testing

cargo test --release --lib: victory-gpu 182, victory-hle 177, victory-shader 304 passed. emit::semantics_tests::arithmetic_matches_the_hardware fails here and fails the same way on c7846f1 without these changes (RX 6800 XT).

…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)
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.
Preserve first-seen bytes for each submission. Copy-back stitches boundary pages where needed and uses the same page-ordered changed-byte merge. VICTORY_INCREMENTAL_SNAPSHOTS=0 restores coalesced snapshots.
Scan only unchecked full pages on scoped readers before merging changed bytes in the original order. VICTORY_PARALLEL_COPY_BACK=0 keeps comparisons on the submit thread.
Check set bits directly for missing pages and leave empty words untouched during copy-back. VICTORY_SPARSE_PAGE_BITMAP=0 restores the original scans.
@antocorvo3000

Copy link
Copy Markdown
Contributor Author

An update of this work, now on top of Marvisak's current main (940d32f): branch gta6-lit-world-on-marvisak-main of the fork. It is the build that reaches the lit world of Grand Theft Auto VI 1.0.2.1 on an RX 6800 XT (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.

It does not merge into this main yet: since then this tree was renamed to viport (80 conflicting hunks in 21 files, mostly the rename). A port onto the rename will follow as a separate push here.

Findings that may matter for this tree too:

  • Prologue cutscene crash with Marvisak's view marks (cd94d35, 940d32f): a title read of address -1 in int_prolo_int_prolo_int, reproduced twice on plain 940d32f; without them the scene runs 19 minutes. In the branch they are behind VICTORY_VIEW_MARKS=1 (off).
  • White game window (timing dependent): the swap chain went to the first visible top-level window; when the title presented before showing its window, frames went to a window of our own. Fixed by presenting to the title's stand-in window even before it is shown.
  • Descriptor tables serialized the recording threads (heap made mutex waiting on the VIEWS mutex, 167 us per table in the world). Lock-free fast path for unchanged slots, RwLock for VIEWS and buffer copy lookups.
  • The 20 shaders that did not translate in the world now translate and validate, each class behind a switch.
  • Title patch 6 must stay on for the 1.0.2.1 executable: without it the title takes a render path where the light and tile lists are 1x1 placeholders and the exposure sits at its minimum (black world).
  • Experimental and off by default, not ready: VRAM copies of title memory and async submission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant