From 8a39262627194dad79d92b1564f0ea6b0be2369b Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Wed, 18 Nov 2026 03:53:42 -0800 Subject: [PATCH] replay: a second copy's synchronizeResource: takes its buffer from the resource argument The argument is a {Buffer: #id} variant, not an object: the two-copy play of r3 on the 780M stopped at frame 203 on 'argument 0 is {Buffer: #3081}, not an object'. --- .../src/replay/new_runtime/encoders.rs | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/crates/metal2vulkan-validation/src/replay/new_runtime/encoders.rs b/crates/metal2vulkan-validation/src/replay/new_runtime/encoders.rs index 2e87da2a6..3e17e4a05 100644 --- a/crates/metal2vulkan-validation/src/replay/new_runtime/encoders.rs +++ b/crates/metal2vulkan-validation/src/replay/new_runtime/encoders.rs @@ -3,7 +3,7 @@ //! whose bindings hold a skipped object, and a blit command the runtime does not build or that //! names a skipped object, are skipped and counted. -use super::super::args::{arg, data, index, list, range, refuse, uint, Fields}; +use super::super::args::{arg, data, index, list, range, refuse, uint, variant, Fields}; use super::{failed, Held, NewRuntime, Object}; use crate::replay::player::{Made, PlayError}; use crate::replay::stream::Call; @@ -517,16 +517,22 @@ impl NewRuntime { // A skipped resource is counted above, with the blits that name a skipped object. "synchronizeResource:" => match self.resource(call, 0)? { // A buffer with a second copy: the GPU's copy into the CPU's, its whole words. - Held::Buffer(buffer) => match self.seconds.cpu(Self::id(call, 0)?).cloned() { - Some(cpu) => { - let words = buffer.length() / 4 * 4; - self.blit(id) - .copy_from_buffer_to_buffer(&buffer, 0, &cpu, 0, words) + Held::Buffer(buffer) => { + let (_, object) = variant(call, arg(call, 0)?)?; + let second = object + .as_object() + .and_then(|object| self.seconds.cpu(object)); + match second.cloned() { + Some(cpu) => { + let words = buffer.length() / 4 * 4; + self.blit(id) + .copy_from_buffer_to_buffer(&buffer, 0, &cpu, 0, words) + } + None => self + .blit(id) + .synchronize_resource(rt::Resource::Buffer(&buffer)), } - None => self - .blit(id) - .synchronize_resource(rt::Resource::Buffer(&buffer)), - }, + } Held::Texture(texture) => self .blit(id) .synchronize_resource(rt::Resource::Texture(&texture)),