move body of BufferUsageScope.insert_merge_single in BufferUsageScope.merge_single

This commit is contained in:
teoxoy 2024-06-20 13:28:57 +02:00 committed by Teodor Tanasoaia
parent aaec1c37b9
commit 26eceabe86
2 changed files with 2 additions and 17 deletions

View File

@ -781,7 +781,7 @@ impl Global {
state
.scope
.buffers
.insert_merge_single(buffer.clone(), hal::BufferUses::INDIRECT)
.merge_single(&buffer, hal::BufferUses::INDIRECT)
.map_pass_err(scope)?;
buffer
.check_usage(wgt::BufferUsages::INDIRECT)

View File

@ -229,21 +229,6 @@ impl<A: HalApi> BufferUsageScope<A> {
&mut self,
buffer: &Arc<Buffer<A>>,
new_state: BufferUses,
) -> Result<(), UsageConflict> {
self.insert_merge_single(buffer.clone(), new_state)
}
/// Merge a single state into the UsageScope, using an already resolved buffer.
///
/// If the resulting state is invalid, returns a usage
/// conflict with the details of the invalid state.
///
/// If the ID is higher than the length of internal vectors,
/// the vectors will be extended. A call to set_size is not needed.
pub fn insert_merge_single(
&mut self,
buffer: Arc<Buffer<A>>,
new_state: BufferUses,
) -> Result<(), UsageConflict> {
let index = buffer.info.tracker_index().as_usize();
@ -260,7 +245,7 @@ impl<A: HalApi> BufferUsageScope<A> {
index,
BufferStateProvider::Direct { state: new_state },
ResourceMetadataProvider::Direct {
resource: Cow::Owned(buffer),
resource: Cow::Owned(buffer.clone()),
},
)?;
}