Merge commit 'f61ecf3b' into night/light

# Conflicts:
#	crates/victory-gpu/src/shadow.rs
This commit is contained in:
local committed 2026-11-25 05:50:06 -06:00
commit be085e5385
20 files changed
+1452 -96

No files matched your search

+14 -6
View File
@@ -6890,11 +6890,17 @@ impl<'a> Lower<'a> {
}
/// The heap index to read descriptor `src` at, `index` being the title's:
/// for a buffer picked from the heap itself and read as raw bytes (or as
/// a constant buffer), the host's raw twin of that slot
/// ([`super::shader::raw_views`]), whose reads end where the view does.
/// Everything else (tables, textures, typed buffers) stays in place.
/// And whether it is a twin's (inside the host's heap).
/// for a buffer read as raw bytes, through a table or picked from the
/// heap itself (or picked and read as a constant buffer), the host's raw
/// twin of that slot ([`super::shader::raw_views`]), whose reads end where
/// the view does. Everything else (textures, typed buffers, tables'
/// constant buffers) stays in place. And whether it is a twin's (inside
/// the host's heap).
///
/// Tables too: a view that does not begin on 16 bytes cannot be raw, and
/// a pixel program of the main pass (3711fdad456538a1, stopped at in the
/// device losses of runs n03 and n04) reads a structured one of 8 byte
/// elements at 8 as raw bytes per lane.
fn raw_twin(&mut self, src: &Source, index: V, sampler: bool, props: (u32, u32)) -> (V, bool) {
// Raw and constant buffers (DXIL resource kinds 11 and 13).
const RAW: u32 = 11;
@@ -6907,7 +6913,9 @@ impl<'a> Lower<'a> {
self.scalar
.get(load)
.and_then(|a| self.x.native.layout.get(a.param))
.is_some_and(|p| p.root == RootType::ResourceHeap)
.is_some_and(|p| {
p.root == RootType::ResourceHeap || (p.root == RootType::Table && props.0 & 0xFF == RAW)
})
};
if first == 0 || sampler || !matches!(props.0 & 0xFF, RAW | CONSTANT) || !src.leaves().iter().all(picked) {
return (index, false);
+4 -3
View File
@@ -149,9 +149,10 @@ pub fn view_heap_limit() -> u32 {
/// entry nothing wrote. On AMD a raw load through a view that is not raw (typed, structured, a
/// constant buffer's) has no end: it reads whatever lies there, up to 4 GiB on, and loses the
/// device where nothing does; and a texture's descriptor read as a buffer's is a wild address.
/// So the host keeps, for title slot `i`, a raw view of the same bytes at this place + `i`
/// (a constant buffer view of a constant buffer, a null raw view of everything else and of every
/// slot past the title's), and shaders translated while this is set read picked buffers there.
/// So the host keeps, for slot `i`, a raw view of the same bytes at this place + `i` (a constant
/// buffer view of a constant buffer in a title slot, a null raw view of everything else), and
/// shaders translated while this is set read picked buffers there, and tables' buffers that they
/// read as raw bytes.
/// A power of two above every slot index.
static RAW_VIEWS: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(0);
+30 -4
View File
@@ -322,15 +322,17 @@ fn a_picked_buffer_is_read_at_its_raw_twin() {
};
let (title, twin, last, texel) = ([1u32, 2, 3, 4], [5u32, 6, 7, 8], [9u32, 10, 11, 12], [[0.0; 4]; 1]);
let raw = |data| View::Buffer { data, stride: Stride::Raw };
let views = || {
// (The store goes through the table's third entry: its twin, too.)
let views = |twins: bool| {
let uav = |here: bool| if here { View::RawUav(2) } else { View::Texture(1, 1, &texel) };
[
View::Texture(1, 1, &texel),
raw(&title),
View::RawUav(2),
uav(!twins),
View::Texture(1, 1, &texel),
View::Texture(1, 1, &texel),
raw(&twin),
View::Texture(1, 1, &texel),
uav(twins),
raw(&last),
]
};
@@ -338,8 +340,32 @@ fn a_picked_buffer_is_read_at_its_raw_twin() {
super::shader::RAW_VIEWS_HERE.set(Some(first));
let shader = build(&program(at), (8, 0)).expect("translates");
super::shader::RAW_VIEWS_HERE.set(None);
for (label, got) in run(&shader, &views()) {
for (label, got) in run(&shader, &views(first != 0)) {
assert_eq!(got[..2], [0, expected], "{label}: twins from {first}, byte {at}");
}
}
}
/// A table's buffer read as raw bytes is read at its raw twin too.
#[test]
fn a_tables_raw_buffer_is_read_at_its_raw_twin() {
let load = [
0xF408_0201u32, // s_load_dwordx4 s[8:11], s[2:3], 0
0xFA00_0000,
0xE030_0004, // buffer_load_dword v5, off, s[8:11], 0 offset:4
0x8002_0500,
0x7E0A_0505, // v_readfirstlane_b32 s5, v5
0xBE84_0380, // s_mov_b32 s4, 0
];
let words = [TABLE, &load, STORE].concat();
let (title, twin, texel) = ([1u32, 2, 3, 4], [5u32, 6, 7, 8], [[0.0; 4]; 1]);
let raw = |data| View::Buffer { data, stride: Stride::Raw };
super::shader::RAW_VIEWS_HERE.set(Some(4));
let shader = build(&words, (4, 0)).expect("translates");
super::shader::RAW_VIEWS_HERE.set(None);
let other = || View::Texture(1, 1, &texel);
let views = [raw(&title), other(), other(), other(), raw(&twin), other(), View::RawUav(2)];
for (label, got) in run(&shader, &views) {
assert_eq!(got[..2], [0, 6], "{label}");
}
}