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 state
.scope .scope
.buffers .buffers
.insert_merge_single(buffer.clone(), hal::BufferUses::INDIRECT) .merge_single(&buffer, hal::BufferUses::INDIRECT)
.map_pass_err(scope)?; .map_pass_err(scope)?;
buffer buffer
.check_usage(wgt::BufferUsages::INDIRECT) .check_usage(wgt::BufferUsages::INDIRECT)

View File

@ -229,21 +229,6 @@ impl<A: HalApi> BufferUsageScope<A> {
&mut self, &mut self,
buffer: &Arc<Buffer<A>>, buffer: &Arc<Buffer<A>>,
new_state: BufferUses, 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> { ) -> Result<(), UsageConflict> {
let index = buffer.info.tracker_index().as_usize(); let index = buffer.info.tracker_index().as_usize();
@ -260,7 +245,7 @@ impl<A: HalApi> BufferUsageScope<A> {
index, index,
BufferStateProvider::Direct { state: new_state }, BufferStateProvider::Direct { state: new_state },
ResourceMetadataProvider::Direct { ResourceMetadataProvider::Direct {
resource: Cow::Owned(buffer), resource: Cow::Owned(buffer.clone()),
}, },
)?; )?;
} }