mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 14:55:05 +00:00
take buffer lookup out of BufferBindGroupState.add_single
This commit is contained in:
parent
6a181fa634
commit
d2218398ff
@ -1923,10 +1923,11 @@ impl<A: HalApi> Device<A> {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
let buffer = used
|
let buffer = storage
|
||||||
.buffers
|
.get(bb.buffer_id)
|
||||||
.add_single(storage, bb.buffer_id, internal_use)
|
.map_err(|_| Error::InvalidBuffer(bb.buffer_id))?;
|
||||||
.ok_or(Error::InvalidBuffer(bb.buffer_id))?;
|
|
||||||
|
used.buffers.add_single(buffer, internal_use);
|
||||||
|
|
||||||
buffer.same_device(self)?;
|
buffer.same_device(self)?;
|
||||||
|
|
||||||
|
@ -90,18 +90,9 @@ impl<A: HalApi> BufferBindGroupState<A> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Adds the given resource with the given state.
|
/// Adds the given resource with the given state.
|
||||||
pub fn add_single<'a>(
|
pub fn add_single(&self, buffer: &Arc<Buffer<A>>, state: BufferUses) {
|
||||||
&self,
|
|
||||||
storage: &'a Storage<Buffer<A>>,
|
|
||||||
id: BufferId,
|
|
||||||
state: BufferUses,
|
|
||||||
) -> Option<&'a Arc<Buffer<A>>> {
|
|
||||||
let buffer = storage.get(id).ok()?;
|
|
||||||
|
|
||||||
let mut buffers = self.buffers.lock();
|
let mut buffers = self.buffers.lock();
|
||||||
buffers.push((buffer.clone(), state));
|
buffers.push((buffer.clone(), state));
|
||||||
|
|
||||||
Some(buffer)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user