mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +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
|
||||
.buffers
|
||||
.add_single(storage, bb.buffer_id, internal_use)
|
||||
.ok_or(Error::InvalidBuffer(bb.buffer_id))?;
|
||||
let buffer = storage
|
||||
.get(bb.buffer_id)
|
||||
.map_err(|_| Error::InvalidBuffer(bb.buffer_id))?;
|
||||
|
||||
used.buffers.add_single(buffer, internal_use);
|
||||
|
||||
buffer.same_device(self)?;
|
||||
|
||||
|
@ -90,18 +90,9 @@ impl<A: HalApi> BufferBindGroupState<A> {
|
||||
}
|
||||
|
||||
/// Adds the given resource with the given state.
|
||||
pub fn add_single<'a>(
|
||||
&self,
|
||||
storage: &'a Storage<Buffer<A>>,
|
||||
id: BufferId,
|
||||
state: BufferUses,
|
||||
) -> Option<&'a Arc<Buffer<A>>> {
|
||||
let buffer = storage.get(id).ok()?;
|
||||
|
||||
pub fn add_single(&self, buffer: &Arc<Buffer<A>>, state: BufferUses) {
|
||||
let mut buffers = self.buffers.lock();
|
||||
buffers.push((buffer.clone(), state));
|
||||
|
||||
Some(buffer)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user