Run Grand Theft Auto VI from first boot into the world

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]>
This commit is contained in:
MarvisandClaude Fable 5.2 committed 2026-11-23 23:10:01 +01:00
1 parent bc3070991a
commit 2849477415
107 files changed
+42526 -868

No files matched your search

+51 -4
View File
@@ -308,6 +308,12 @@ pub struct Structured {
pub guards: Vec<Vec<Option<Bool>>>,
/// The lane's bit of each lane-mask value, by its low dword's value.
pub masks: HashMap<Value, Bool>,
/// Wave64 masks: low dword's value by the high dword's.
pub highs: HashMap<Value, Value>,
/// Masks (low dwords) set only in lanes whose EXEC bit is set where
/// they are written: every such lane reaches the writing block, so a
/// ballot there gives the mask as data.
pub active: HashSet<Value>,
}
/// Builds the per-lane form of `program`.
@@ -356,6 +362,8 @@ struct Lanes<'a> {
first: Vec<Bool>,
/// Per block ending in a branch: when a lane takes it.
when: Vec<Option<Bool>>,
/// See [`Structured::active`].
active: HashSet<Value>,
}
/// A mask join taken as `value` in every lane that reaches `block`: each
@@ -418,6 +426,7 @@ impl<'a> Lanes<'a> {
joins: Vec::new(),
first: vec![Bool::FALSE; blocks.len()],
when: vec![None; blocks.len()],
active: HashSet::new(),
})
}
@@ -429,6 +438,7 @@ impl<'a> Lanes<'a> {
self.joins.clear();
self.first.fill(Bool::FALSE);
self.when.fill(None);
self.active.clear();
}
/// Lane masks, branch conditions and forward-edge knowledge, block by
@@ -443,6 +453,7 @@ impl<'a> Lanes<'a> {
lo
};
self.masks.insert((lo, hi), Bool::TRUE);
self.active.insert(lo);
}
let mut execs: Vec<Vec<Option<Bool>>> =
p.blocks.iter().map(|b| vec![None; b.insts.len()]).collect();
@@ -457,11 +468,24 @@ impl<'a> Lanes<'a> {
}
}
self.first[b] = c;
// EXEC joined at the block's entry holds the lanes that arrive.
for phi in &p.blocks[b].phis {
if phi.reg == Reg::S(EXEC) {
self.active.insert(phi.value);
}
}
// EXEC where known in this block (read or written so far).
let mut now = None;
for (i, inst) in p.blocks[b].insts.iter().enumerate() {
if inst.read(Reg::S(EXEC)).is_some() {
execs[b][i] = Some(self.exec(inst));
let e = self.exec(inst);
execs[b][i] = Some(e);
now = Some(e);
}
self.step(inst, now);
if let Some(k) = self.key(|r| inst.write(r), EXEC) {
now = self.masks.get(&k).or(self.other.get(&k)).copied();
}
self.step(inst);
}
if let Exit::Branch { .. } = p.blocks[b].exit
&& let Some(last) = p.blocks[b].insts.last()
@@ -553,6 +577,13 @@ impl<'a> Lanes<'a> {
}
Ok(Structured {
masks: self.masks.iter().map(|(&(lo, _), &m)| (lo, m)).collect(),
highs: self
.masks
.keys()
.filter(|(lo, hi)| lo != hi)
.map(|&(lo, hi)| (hi, lo))
.collect(),
active: self.active,
bools: self.b,
exits,
guards,
@@ -828,8 +859,8 @@ impl<'a> Lanes<'a> {
})
}
/// Records the masks `inst` defines.
fn step(&mut self, inst: &Inst) {
/// Records the masks `inst` defines; `exec` is EXEC there, if known.
fn step(&mut self, inst: &Inst, exec: Option<Bool>) {
let name = inst.name();
match &inst.fields {
Fields::Sop { src, .. } => {
@@ -850,6 +881,12 @@ impl<'a> Lanes<'a> {
{
for (k, m) in r.dst.into_iter().chain(r.exec) {
self.masks.insert(k, m);
// EXEC itself holds the lanes that run here.
if r.exec.is_some_and(|e| e.0 == k)
|| exec.is_some_and(|e| self.b.implies(m, e))
{
self.active.insert(k.0);
}
}
if let (Some(scc), Some(m)) = (inst.write(Reg::Scc), r.scc) {
self.scc_lane.insert(scc, m);
@@ -883,7 +920,17 @@ impl<'a> Lanes<'a> {
let a = l.b.atom(Atom::Lane(k.0), born);
let m = l.b.and(exec, a);
l.masks.insert(k, m);
l.active.insert(k.0);
};
// A select reads a mask nothing else may: a join of compare
// results is resolved here, as for EXEC.
if name == "v_cndmask_b32"
&& let Some(&Operand::Scalar { code, .. }) = v.src.get(2)
&& code != NULL
&& let Some(k) = self.key(|r| inst.read(r), code)
{
self.mask(k);
}
if name.starts_with("v_cmpx") {
if let Some(k) = self.key(|r| inst.write(r), EXEC) {
lane(self, k);