Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
4111946
GPU: zero PSO stream padding bytes and avoid duplicate pipeline libra…
gabrielcruzg3 Nov 24, 2026
15322c4
GPU: drop unsupported UAV and render-target flags on host textures
gabrielcruzg3 Nov 24, 2026
08e4c89
GPU: skip CreateRenderTargetView when host texture lacks ALLOW_RENDER…
gabrielcruzg3 Nov 24, 2026
0d918ce
Shaders: 16-bit compares ignore VOP3 op_sel
CUBE-Hugo-Viaud Nov 24, 2026
af4fef4
GPU: detile only the subresources a texture's changed pages hold
talakasse Nov 24, 2026
f23c493
VICTORY_PATCH: refine hex crate support for full hex decoding
CUBE-Hugo-Viaud Nov 24, 2026
21d1b46
Shaders: scalar buffer loads from a UAV read it raw
adamdotpy Nov 24, 2026
417f4e3
Shaders: scalar loads from a root view's address read its memory
adamdotpy Nov 24, 2026
038503c
GPU: order shader writes on command list pipeline syncs (#732)
Ctrl-Alt-Haze Nov 24, 2026
ad33015
Shaders: write canonical DXIL system-value names in ISG1 and OSG1
gabrielcruzg3 Nov 24, 2026
7b4cb23
victory-shader: handle redundant partial descriptor writes and lane-p…
Ctrl-Alt-Haze Nov 24, 2026
bb65bc3
GPU: release descriptor tables after a rejected bind
EatCodeSleep2 Nov 24, 2026
98f073d
Shaders: a descriptor read only as data takes the kind of its entry's…
claude Nov 24, 2026
3a00856
Shaders: path-sensitive reachability for missing values across phi jo…
Ctrl-Alt-Haze Nov 24, 2026
ea633e7
Shaders: fix duplicate latch folding, unreachable phi edges, and repl…
hamdog0203 Nov 24, 2026
e8fd20f
GPU: no blending on integer render targets in host pipelines
pablogonz12 Nov 24, 2026
67c4f53
victory-shader: resolve Structured::other and constant masks in v_cnd…
bartikele Nov 24, 2026
b00573d
Shaders: trace a code-table address read from the first lane of a uni…
LooperSalty Nov 24, 2026
8996aeb
Shaders: uniform phis (loop counters) under v_readfirstlane addresses
LooperSalty Nov 24, 2026
0db9f1e
pr-1225
Personed Nov 24, 2026
8dddddc
pr-1231
Personed Nov 24, 2026
a56afa2
pr-1230
Personed Nov 24, 2026
866a9ac
pr-1229
Personed Nov 24, 2026
4deb0cd
pr-1221
Personed Nov 24, 2026
f562d14
pr-1145
Personed Nov 24, 2026
91cb975
pr-1130
Personed Nov 24, 2026
cb9ab51
pr-1042
Personed Nov 24, 2026
26ad329
pr-1130
Personed Nov 24, 2026
ead7938
pr-1056
Personed Nov 24, 2026
958fdcb
pr-1055
Personed Nov 24, 2026
861ebe6
pr-1043
Personed Nov 24, 2026
6f42f61
pr-1228
Personed Nov 24, 2026
7524f89
pr-1152
Personed Nov 24, 2026
b779dfd
pr-1135
Personed Nov 24, 2026
b5584bd
pr-1126
Personed Nov 24, 2026
e013378
pr-1040
Personed Nov 24, 2026
dec0f2d
pr-1041
Personed Nov 24, 2026
f92502a
fix valu_tests unclosed test from pr-1055 merge; cargo fmt
Personed Nov 24, 2026
78fa853
wave-4 clippy/fmt fixes
Personed Nov 24, 2026
a1f786d
fix rustdoc invalid HTML tag in prepare.rs
Personed Nov 24, 2026
48eb8af
Refuse a live missing interpolation half or descriptor word at joins
Personed Nov 24, 2026
6814bdb
Assert unsupported-flag drops against the host's own feature query
Personed Nov 24, 2026
28329a2
Place the safety comment directly above the unsafe block
Personed Nov 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

127 changes: 127 additions & 0 deletions crates/victory-formats/src/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,54 @@ impl Layout {
)
}

/// The byte ranges of tiled memory that [`Layout::detile`] reads for
/// mip `mip` of array slice `slice` (3D: every depth slice of the mip,
/// `slice` 0): sorted, disjoint, one per depth slice or slab at most.
/// A mip in the tail gets the part of the tail block its elements span,
/// which other tail mips may share; a write outside every range leaves
/// the subresource's detiled contents as they were.
pub fn extents(&self, mip: u32, slice: u32) -> Result<Vec<std::ops::Range<u64>>, Error> {
let m = self.mips.get(mip as usize).ok_or(Error::Invalid)?;
let bytes = m.width as usize * self.desc.element_bytes as usize;
let depth_pitch = bytes * m.height as usize;
let mut spans: Vec<std::ops::Range<u64>> = Vec::new();
let z_of = |linear: usize| linear / depth_pitch;
let mut current: Option<(usize, std::ops::Range<u64>)> = None;
self.walk(
self.size as usize,
mip,
slice,
usize::MAX,
bytes,
depth_pitch,
|tiled, linear, len| {
let z = z_of(linear);
let run = tiled as u64..(tiled + len) as u64;
match &mut current {
Some((at, r)) if *at == z => {
r.start = r.start.min(run.start);
r.end = r.end.max(run.end);
}
_ => {
if let Some((_, r)) = current.replace((z, run)) {
spans.push(r);
}
}
}
},
)?;
spans.extend(current.map(|(_, r)| r));
spans.sort_by_key(|r| r.start);
let mut merged: Vec<std::ops::Range<u64>> = Vec::with_capacity(spans.len());
for r in spans {
match merged.last_mut() {
Some(last) if r.start <= last.end => last.end = last.end.max(r.end),
_ => merged.push(r),
}
}
Ok(merged)
}

/// The reverse of [`Layout::detile`]: linear rows into tiled memory.
pub fn tile(
&self,
Expand Down Expand Up @@ -984,6 +1032,85 @@ mod tests {
}
}

/// A subresource's extents hold every element it detiles, and bytes
/// outside them do not change what it detiles to.
#[test]
fn extents_hold_what_a_subresource_detiles() {
let cases = [
desc(64, 64, 7, 16, Swizzle::SW_64KB_D),
desc(100, 60, 7, 4, Swizzle::SW_64KB_D),
desc(250, 175, 8, 8, Swizzle::SW_4KB_S),
desc(33, 17, 6, 1, Swizzle::SW_4KB_D),
desc(30, 20, 5, 4, Swizzle::LINEAR),
desc(83, 31, 6, 1, Swizzle::SW_256B_S),
Desc {
depth: 3,
..desc(70, 70, 4, 16, Swizzle::SW_4KB_S)
},
Desc {
depth: 4,
..desc(30, 20, 3, 4, Swizzle::LINEAR)
},
Desc {
dimension: Dimension::Tex3d,
depth: 16,
..desc(64, 32, 7, 4, Swizzle::SW_4KB_S)
},
];
for d in cases {
let l = Layout::new(&d).unwrap();
let size = l.size as usize;
let tiled: Vec<u8> = (0..size).map(|i| (i * 31 + i / 251) as u8).collect();
let slices = if d.dimension == Dimension::Tex3d {
1
} else {
d.depth
};
for slice in 0..slices {
for mip in 0..d.mips {
let e = l.extents(mip, slice).unwrap();
assert!(!e.is_empty(), "{d:?} mip {mip} slice {slice}");
for w in e.windows(2) {
assert!(w[0].end < w[1].start, "{d:?} mip {mip}: {e:?}");
}
assert!(e.iter().all(|r| r.start < r.end && r.end <= l.size));
let inside = |at: u64| e.iter().any(|r| r.contains(&at));
let m = l.mips[mip as usize];
let n = u64::from(d.element_bytes);
// Outside the tail a 2D mip's extent is its own blocks.
if m.tail.is_none() && d.dimension != Dimension::Tex3d {
let total: u64 = e.iter().map(|r| r.end - r.start).sum();
let own = u64::from(m.pitch) * u64::from(m.rows) * n;
assert!(total <= own, "{d:?} mip {mip}: {total} > {own}");
}
for z in 0..m.depth {
for y in 0..m.height {
for x in 0..m.width {
let at = l.offset(mip, x, y, slice + z).unwrap();
assert!(inside(at) && inside(at + n - 1), "{d:?} mip {mip}");
}
}
}
let row = m.width as usize * n as usize;
let plane = row * m.height as usize;
let mut before = vec![0; plane * m.depth as usize];
l.detile(&tiled, mip, slice, &mut before, row, plane)
.unwrap();
let mut changed = tiled.clone();
for (i, b) in changed.iter_mut().enumerate() {
if !inside(i as u64) {
*b = !*b;
}
}
let mut after = vec![0; before.len()];
l.detile(&changed, mip, slice, &mut after, row, plane)
.unwrap();
assert_eq!(before, after, "{d:?} mip {mip} slice {slice}");
}
}
}
}

/// Hand-checked: in a 64 KiB `D` block of 4-byte elements, x bits go to
/// address bits 2, 3, 6, 9, 11, 13, 15 and y bits to 4, 5, 7, 8, 10, 12,
/// 14; a 4 KiB `S` block of 16-byte elements is 16x16 with y first.
Expand Down
25 changes: 25 additions & 0 deletions crates/victory-gpu/src/descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,9 @@ static FUNCTIONS: Table<24> = {
Table(f)
};

#[cfg(all(test, windows))]
pub(crate) use tests::test_view_heap;

#[cfg(test)]
mod tests {
use super::*;
Expand All @@ -738,6 +741,28 @@ mod tests {
create_heap(std::ptr::null(), &extended.0, &HEAP_IIDS[0], out)
}

#[cfg(windows)]
pub(crate) fn test_view_heap(count: u32) -> This {
let mut heap = std::ptr::null();
assert_eq!(
create(
HeapDesc {
kind: VIEWS_KIND,
count,
flags: SHADER_VISIBLE,
nodes: 0,
},
Placement {
address: 0,
size: 0,
},
&mut heap,
),
S_OK
);
heap
}

#[test]
fn heaps_hold_count_descriptors_from_their_start() {
let null = std::ptr::null();
Expand Down
Loading
Loading