Don't put the mapped-at-creation staging buffer in the registry

This commit is contained in:
Nicolas Silva
2024-02-26 17:49:14 +01:00
committed by Erich Gubler
parent c77b4d3f56
commit ed852c4774

View File

@@ -217,7 +217,7 @@ impl Global {
mapped_at_creation: false,
};
let stage = match device.create_buffer(&stage_desc, true) {
Ok(stage) => stage,
Ok(stage) => Arc::new(stage),
Err(e) => {
to_destroy.push(buffer);
break e;
@@ -230,14 +230,10 @@ impl Global {
Ok(mapping) => mapping,
Err(e) => {
to_destroy.push(buffer);
to_destroy.push(stage);
break CreateBufferError::Device(e.into());
}
};
let stage_fid = hub.buffers.request();
let stage = stage_fid.init(stage);
assert_eq!(buffer.size % wgt::COPY_BUFFER_ALIGNMENT, 0);
// Zero initialize memory and then mark both staging and buffer as initialized
// (it's guaranteed that this is the case by the time the buffer is usable)