victory-gta6: this fork's changes on top of VIctory main (ffe310e)

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]>
This commit is contained in:
fxcelessandClaude Fable 5.2 committed 2026-11-24 13:02:18 -05:00
1 parent 45c6e80601
commit 6fa814fba5
61 files changed
+32259 -1274

No files matched your search

+18 -3
View File
@@ -129,8 +129,8 @@ impl Tables {
/// alpha 64 B and colour 256 B, BC4 64 B, BC5 64 B), 512 u16 BC7 control
/// words, then 255 dictionary entries per format in format order: BC1
/// 6 + 16 B, BC3 8 + 32 B, BC4 2 + 16 B, BC5 4 + 32 B, BC6H (u8 mode,
/// 12 u16, u8 mode, 16 i16), BC7 (u16 control, 24 u16, 2 u8, 32 i16).
/// Little-endian, no padding. Every model must tile 65536.
/// 12 u16, u8 mode, 16 i16), BC7 (u16 control, 24 u16, 2 u8, 2 B,
/// 16 + 15 i16). Little-endian, no padding. Every model must tile 65536.
pub fn parse(bytes: &[u8]) -> Result<Tables, Error> {
if bytes.len() != TABLES_SIZE {
return Err(Error("table file has the wrong size"));
@@ -222,7 +222,10 @@ impl Tables {
bits: [r.u8(), r.u8()],
..Default::default()
};
for v in ix.ix.as_flattened_mut() {
// Unused: the widths again in all entries but the first.
r.u16();
// Only 15 slots for set 1, which no entry uses (0 bits).
for v in &mut ix.ix.as_flattened_mut()[..31] {
*v = r.u16() as i16;
}
(ep, ix)
@@ -1590,4 +1593,16 @@ mod tests {
}
assert!(n > 0);
}
/// A dictionary entry stands in for a block the decoder made: a set with
/// 0 index bits holds no indices, and pixel 0 is the anchor (top bit clear).
#[test]
fn bc7_dictionary_indices_line_up() {
let t = Tables::builtin().unwrap();
for (k, (_, ix)) in t.bc7.iter().enumerate() {
let anchor = 0..1 << (ix.bits[0] - 1);
let ok = (ix.bits[1] != 0 || ix.ix[1] == [0; 16]) && anchor.contains(&ix.ix[0][0]);
assert!(ok, "entry {k}: {:?}", ix.ix);
}
}
}
+26 -2
View File
@@ -671,6 +671,13 @@ impl Layout {
}
runs.push((first_tiled, first_linear, bytes - first_linear));
}
// A mip can end partway through the last run. Check the other runs
// once so each row can copy them with a compile-time length.
let (body, last) = runs.split_at(runs.len().saturating_sub(1));
let run_len = body
.first()
.map(|run| run.2)
.filter(|&len| body.iter().all(|run| run.2 == len));
for z in 0..depth {
let (s, inner) = self.split(first + z);
let base = u64::from(s) * self.slice_size + m.offset;
@@ -681,9 +688,13 @@ impl Layout {
copy(tiled_row as usize, linear_row, bytes);
} else {
let tiled_row = (base + self.row(m, y, inner)) as usize;
for &(tiled, linear, len) in &runs {
copy(tiled_row + tiled, linear_row + linear, len);
match run_len {
Some(8) => copy_runs::<8>(body, tiled_row, linear_row, &mut copy),
Some(16) => copy_runs::<16>(body, tiled_row, linear_row, &mut copy),
Some(32) => copy_runs::<32>(body, tiled_row, linear_row, &mut copy),
_ => copy_runs::<0>(body, tiled_row, linear_row, &mut copy),
}
copy_runs::<0>(last, tiled_row, linear_row, &mut copy);
}
}
}
@@ -691,6 +702,19 @@ impl Layout {
}
}
/// Copy micro-tile runs inline at a known width, or use each run's length for N = 0.
fn copy_runs<const N: usize>(
runs: &[(usize, usize, usize)],
tiled_row: usize,
linear_row: usize,
copy: &mut impl FnMut(usize, usize, usize),
) {
for &(tiled, linear, len) in runs {
let len = if N == 0 { len } else { N };
copy(tiled_row + tiled, linear_row + linear, len);
}
}
/// What a DXGI format stores per element: bytes, texels per element side
/// (4 for block compression), and whether its stencil is a second plane
/// (the GPU keeps depth and stencil apart).