Frame replay: where identical runs diverge; resources dying as a capture starts

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-24 21:29:09 -06:00
1 parent eb50022824
commit bac2b33de2
5 files changed
+1315 -22

No files matched your search

+11 -2
View File
@@ -351,7 +351,10 @@ pub(super) struct Recorder {
/// made are kept alive.
pub(super) watching: AtomicBool,
pub(super) writes: Mutex<Vec<(u32, u32, u32)>>,
pub(super) held: Mutex<Vec<ID3D12Resource>>,
/// Resources kept alive for a capture, by id. One that dies all the same
/// (its last reference was going when ours was taken) is taken out: see
/// `Recorder::gone`.
pub(super) held: Mutex<HashMap<u32, ID3D12Resource>>,
/// What could not be recorded, with how often.
problems: Mutex<BTreeMap<String, u64>>,
/// Submissions and presents, one at a time.
@@ -586,7 +589,7 @@ impl Recorder {
write(&self.resources).insert(id, res);
self.ids.set(p as usize, id);
if late {
lock(&self.held).push(ID3D12Resource::clone(&object));
lock(&self.held).insert(id, ID3D12Resource::clone(&object));
}
self.tell_gone(
&*object,
@@ -602,6 +605,12 @@ impl Recorder {
fn gone(&self, what: &Gone) {
match *what {
Gone::Resource { id, ptr, va } => {
// The memory goes whatever we hold: letting go of it later
// would be a call into what is there then.
if let Some(dead) = lock(&self.held).remove(&id) {
std::mem::forget(dead);
self.problem("a resource died as the frame started: its contents may be missing");
}
self.ids.remove(ptr, id);
write(&self.resources).remove(&id);
if va != 0 {