GPU: the world stays up; indirect execution behind a switch
The host device was removed seconds into the world because a shader read a descriptor of the wrong kind: empty slots held a null 2D texture view where the shader expected a buffer, which gave a garbage heap index and a read far past the view heap. Null descriptors now have the kind the shader expects (raw buffer, constant buffer, or a texture of the title's own dimension). The world then ran to a 240 s time limit with no removal. Also: - Host lists hold the textures, pipelines, root signatures and heaps they name, and heap slots hold the resource they view (the title releases objects before submitting lists that use them). - The device-removed report places the fault against the host descriptor heaps and names our own uploads; VICTORY_D3D12_GBV turns on GPU-based validation, VICTORY_DUMP_TARGETS works. - Indirect execution (draw, indexed draw, dispatch, mesh dispatch): the world draws most of its geometry this way. Arguments are clamped and charged to a per-list budget by a small compute pass first, so garbage cannot hang the GPU. Off by default (VICTORY_INDIRECT=1): with it on the title's own GPU watchdog ends the run about 30 s into the world. - Shader-written ranges are copied back once per submission and only where they differ; refreshes beside them copy only stale pages. The frame-rate line counts copy-backs and dropped draws. Not working yet: the world's picture is black (indirect draws off, and hundreds of draws per frame have no translated shader). Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
1 parent
0b499d7afd
commit
8c26061f3a
14 files changed
+973
-151
No files matched your search
@@ -34,6 +34,9 @@ macro_rules! once {
|
||||
/// texture's subresources, and what was last detiled.
|
||||
struct Staging {
|
||||
buffer: ID3D12Resource,
|
||||
/// Its bytes.
|
||||
#[cfg(feature = "diagnostics")]
|
||||
size: u64,
|
||||
data: *mut u8,
|
||||
footprints: Vec<D3D12_PLACED_SUBRESOURCE_FOOTPRINT>,
|
||||
rows: Vec<u32>,
|
||||
@@ -113,7 +116,36 @@ pub(crate) fn upload(list: &HostList, resource: This, texture: &ID3D12Resource)
|
||||
};
|
||||
const COPY_DEST: u32 = 0x400;
|
||||
crate::list::ensure_state(list, resource, COPY_DEST);
|
||||
// The staging buffer lives as long as `staging`, which the deferred
|
||||
// refresh below holds until the list is reset.
|
||||
for (i, footprint) in staging.footprints.iter().enumerate() {
|
||||
#[cfg(feature = "diagnostics")]
|
||||
{
|
||||
let f = footprint.Footprint;
|
||||
// SAFETY: live resources.
|
||||
let (gpu, d) = unsafe { (staging.buffer.GetGPUVirtualAddress(), texture.GetDesc()) };
|
||||
let len = u64::from(f.RowPitch) * u64::from(staging.rows[i]) * u64::from(f.Depth);
|
||||
list.note_read(
|
||||
|| {
|
||||
format!(
|
||||
"texture upload {resource:?} ({}x{}x{} f{} mips {}) sub {i} of {} from staging {gpu:#x}+{:#x}: offset {:#x} {}x{}x{} pitch {}",
|
||||
d.Width,
|
||||
d.Height,
|
||||
d.DepthOrArraySize,
|
||||
d.Format.0,
|
||||
d.MipLevels,
|
||||
staging.footprints.len(),
|
||||
staging.size,
|
||||
footprint.Offset,
|
||||
f.Width,
|
||||
f.Height,
|
||||
f.Depth,
|
||||
f.RowPitch
|
||||
)
|
||||
},
|
||||
(gpu + footprint.Offset, len),
|
||||
);
|
||||
}
|
||||
let to = D3D12_TEXTURE_COPY_LOCATION {
|
||||
// SAFETY: a borrowed pointer the location never releases.
|
||||
pResource: unsafe { std::mem::transmute_copy(texture) },
|
||||
@@ -287,9 +319,17 @@ fn staging(resource: This, texture: &ID3D12Resource) -> Option<Arc<Staging>> {
|
||||
);
|
||||
}
|
||||
let (buffer, data) = host.upload_buffer(total)?;
|
||||
crate::host::name(&buffer, || {
|
||||
format!(
|
||||
"staging of {resource:?} {}x{}x{} f{}",
|
||||
d.Width, d.Height, d.DepthOrArraySize, d.Format.0
|
||||
)
|
||||
});
|
||||
tracing::debug!(?desc, total, "texture contents uploaded from title memory");
|
||||
let s = Arc::new(Staging {
|
||||
buffer,
|
||||
#[cfg(feature = "diagnostics")]
|
||||
size: total,
|
||||
data,
|
||||
footprints,
|
||||
rows,
|
||||
|
||||
Reference in new issue
Block a user