mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-21 22:33:49 +00:00
pass BufferId
to unmap
for tracing
This commit is contained in:
parent
1a4f6aca6f
commit
eeb57e1cee
@ -496,7 +496,10 @@ impl Global {
|
||||
trace.add(trace::Action::FreeBuffer(buffer_id));
|
||||
}
|
||||
|
||||
let _ = buffer.unmap();
|
||||
let _ = buffer.unmap(
|
||||
#[cfg(feature = "trace")]
|
||||
buffer_id,
|
||||
);
|
||||
|
||||
buffer.destroy()
|
||||
}
|
||||
@ -519,7 +522,10 @@ impl Global {
|
||||
t.add(trace::Action::DestroyBuffer(buffer_id));
|
||||
}
|
||||
|
||||
let _ = buffer.unmap();
|
||||
let _ = buffer.unmap(
|
||||
#[cfg(feature = "trace")]
|
||||
buffer_id,
|
||||
);
|
||||
|
||||
let last_submit_index = buffer.info.submission_index();
|
||||
|
||||
@ -2634,7 +2640,10 @@ impl Global {
|
||||
drop(snatch_guard);
|
||||
|
||||
buffer.device.check_is_valid()?;
|
||||
buffer.unmap()
|
||||
buffer.unmap(
|
||||
#[cfg(feature = "trace")]
|
||||
buffer_id,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -623,8 +623,14 @@ impl<A: HalApi> Buffer<A> {
|
||||
}
|
||||
|
||||
// Note: This must not be called while holding a lock.
|
||||
pub(crate) fn unmap(self: &Arc<Self>) -> Result<(), BufferAccessError> {
|
||||
if let Some((mut operation, status)) = self.unmap_inner()? {
|
||||
pub(crate) fn unmap(
|
||||
self: &Arc<Self>,
|
||||
#[cfg(feature = "trace")] buffer_id: BufferId,
|
||||
) -> Result<(), BufferAccessError> {
|
||||
if let Some((mut operation, status)) = self.unmap_inner(
|
||||
#[cfg(feature = "trace")]
|
||||
buffer_id,
|
||||
)? {
|
||||
if let Some(callback) = operation.callback.take() {
|
||||
callback.call(status);
|
||||
}
|
||||
@ -633,7 +639,10 @@ impl<A: HalApi> Buffer<A> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn unmap_inner(self: &Arc<Self>) -> Result<Option<BufferMapPendingClosure>, BufferAccessError> {
|
||||
fn unmap_inner(
|
||||
self: &Arc<Self>,
|
||||
#[cfg(feature = "trace")] buffer_id: BufferId,
|
||||
) -> Result<Option<BufferMapPendingClosure>, BufferAccessError> {
|
||||
use hal::Device;
|
||||
|
||||
let device = &self.device;
|
||||
@ -652,7 +661,7 @@ impl<A: HalApi> Buffer<A> {
|
||||
std::slice::from_raw_parts(ptr.as_ptr(), self.size as usize)
|
||||
});
|
||||
trace.add(trace::Action::WriteBuffer {
|
||||
id: self.info.id(),
|
||||
id: buffer_id,
|
||||
data,
|
||||
range: 0..self.size,
|
||||
queued: true,
|
||||
@ -716,7 +725,7 @@ impl<A: HalApi> Buffer<A> {
|
||||
std::slice::from_raw_parts(ptr.as_ptr(), size as usize)
|
||||
});
|
||||
trace.add(trace::Action::WriteBuffer {
|
||||
id: self.info.id(),
|
||||
id: buffer_id,
|
||||
data,
|
||||
range: range.clone(),
|
||||
queued: false,
|
||||
|
Loading…
Reference in New Issue
Block a user