Merge branch 'night/light' into local/next

This commit is contained in:
local committed 2026-11-25 06:21:08 -06:00
commit 35d4815d37
14 files changed
+1557 -246

No files matched your search

+44 -7
View File
@@ -996,10 +996,17 @@ impl State {
dword: u32,
memory: Option<&crate::memory::Ready>,
) -> u32 {
use victory_shader::emit::{USER_MEMORY_BASE, USER_VIEW_ADDRESS, USER_VIEW_BIAS};
use victory_shader::emit::{USER_MEMORY_BASE, USER_ROOT_ADDRESS, USER_VIEW_ADDRESS, USER_VIEW_BIAS};
if kind == USER_MEMORY_BASE {
return memory.map_or(0, |m| m.base);
}
if kind == USER_ROOT_ADDRESS || kind == USER_ROOT_ADDRESS + 1 {
return match self.roots_ref(compute).get(usize::from(slot)) {
Some(&Root::View(address)) if kind == USER_ROOT_ADDRESS => address as u32,
Some(&Root::View(address)) => (address >> 32) as u32,
_ => 0,
};
}
if kind == USER_VIEW_BIAS {
// The view begins on 16 bytes of the copy the address finds
// (`root_uav`, `root_srv_table`).
@@ -1057,16 +1064,28 @@ impl State {
list: &HostList,
t: &crate::pipeline::Translated,
compute: bool,
writes: bool,
use_: crate::memory::Use,
) -> Option<crate::memory::Ready> {
let heap = match self.heaps[0] {
0 => None,
h => crate::descriptor::heap(h as This).host(),
}?;
let (mut addresses, mut constants) = (Vec::new(), Vec::new());
// (What it may write: its root views of unordered access.)
let written: Vec<u64> = t
.used
.iter()
.filter(|u| u.kind == ResourceType::Uav && u.root == RootType::Descriptor)
.filter_map(|u| match self.roots_ref(compute).get(usize::from(u.slot)) {
Some(&Root::View(address)) => Some(address),
_ => None,
})
.collect();
for root in self.roots_ref(compute) {
match root {
Root::View(address) => addresses.push(*address),
// (Of a program that only walks structures, the structures'
// views below: its root views are constants and tables.)
Root::View(address) if use_ != crate::memory::Use::Reads => addresses.push(*address),
Root::Constants(values) => constants.extend_from_slice(values),
_ => {}
}
@@ -1076,7 +1095,7 @@ impl State {
addresses.push(self.view_address(compute, u.slot, u.dword));
}
}
crate::memory::ready(list, heap, &addresses, &constants, writes)
crate::memory::ready(list, heap, &addresses, &written, &constants, use_)
}
/// The bound heap holding `handle`.
@@ -1197,6 +1216,15 @@ impl State {
if crate::host::walls_trace() {
self.walls_census(p, compute);
}
// A list without a view heap: one of the title's for the views the
// host itself puts into heap slots.
if self.heaps[0] == 0
&& p.stages.iter().any(|s| !s.root_uavs.is_empty() || !s.root_srvs.is_empty())
&& let Some(heap) = crate::descriptor::lent_heap()
{
once!("a dispatch without a view heap that needs one gets the title's");
self.heaps[0] = heap;
}
// Heaps first: a root signature with directly indexed heaps must be
// set after them.
if self.host_heaps != self.heaps {
@@ -1264,8 +1292,12 @@ impl State {
let memory = if t.host.root_srvs.contains(&victory_shader::emit::SLOT_MEMORY) {
// Only through a store by address: what it stores through
// views is declared with them.
let writes = writes && t.stores_by_address;
let Some(ready) = self.memory_ready(list, &t, compute, writes) else {
let use_ = if crate::pipeline::is_builder(self.pipeline as This) || writes && t.stores_by_address {
crate::memory::Use::Builds { back: writes }
} else {
crate::memory::Use::Reads
};
let Some(ready) = self.memory_ready(list, &t, compute, use_) else {
once!("a shader that reads title memory by address without a view heap to hold its views: the draw is dropped");
return false;
};
@@ -2450,12 +2482,17 @@ impl State {
// A stage of the structure builder that cannot be bound is a
// dropped stage: the others stop too.
if crate::pipeline::is_builder(self.pipeline as This) {
crate::pipeline::builder_off("one of its dispatches could not be bound");
crate::pipeline::builder_rests("one of its dispatches could not be bound");
}
return;
}
#[cfg(feature = "diagnostics")]
list.note_op(|| self.op_text(format!("dispatch {x}x{y}x{z}"), true));
#[cfg(feature = "diagnostics")]
if crate::pipeline::is_builder(self.pipeline as This) {
crate::capture::op(list as *const _ as usize, || format!("builder {}", p.name));
self.list_dropped_roots([x, y, z]);
}
// SAFETY: an open list with everything set.
unsafe { list.list.Dispatch(x, y, z) };
self.buffers_written();