Upstream graphics state fixes: rectangle attributes, sampler bounds, A8 copies, depth footprints

Ports of 6f36cdf (normalized attributes of rectangle lists), 97c8783
(A8_UNORM is not of the R8 typeless family), b956320 (copy footprints of
depth-stencil textures), c1c3281 (the descriptor ring's wrap), e6fe8ec and
e34cb53 (CreateSamplerX bounds), 691236d (appended elements are aligned).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-24 23:25:15 -06:00
1 parent 011735ff80
commit 75cfb234e5
5 files changed
+344 -30

No files matched your search

+26 -2
View File
@@ -861,8 +861,12 @@ impl HostHeap {
let enough = self.free.load(std::sync::atomic::Ordering::Relaxed) >= n
&& n < self.too_long.load(std::sync::atomic::Ordering::Relaxed);
let n = n as usize;
// Search from `next` on, then from the start.
let starts = (*next as usize..self.dynamic as usize).chain(0..*next as usize);
// Search from `next` on, then from the start (extending past cursor by
// n - 1 so contiguous runs crossing the cursor are not missed).
let cursor = *next as usize;
let end = self.dynamic as usize;
let second_end = cursor.saturating_add(n.saturating_sub(1)).min(end);
let starts = (cursor..end).chain(0..second_end);
let mut run = 0;
let mut found = None;
let mut last = usize::MAX;
@@ -2836,4 +2840,24 @@ mod tests {
assert_eq!(heap.dynamic(50), Some(4));
assert_eq!(heap.dynamic(40), Some(4 + heap.dynamic - 40));
}
/// Contiguous free dynamic slot ranges that cross the search cursor are found.
#[test]
fn dynamic_allocation_finds_contiguous_range_crossing_search_cursor() {
let Some(heap) = HostHeap::new(false, 4) else {
return; // no host GPU
};
// Allocate slots 0..8, advancing cursor to 8.
let a = heap.dynamic(8).unwrap();
// Allocate slots 8..16, advancing cursor to 16.
let b = heap.dynamic(8).unwrap();
assert_eq!((a, b), (4, 12));
// Release slots 10..14 (crossing cursor at 12).
// Before the fix, a request of 4 slots starting search at 12 scanned 12..end then 0..12,
// missing the contiguous run at 10..14.
heap.release(14, 4);
let c = heap.dynamic(4);
assert_eq!(c, Some(14));
}
}