change Device.create_bind_group_layout to return an Arc<BindGroupLayout<A>

This commit is contained in:
teoxoy 2024-08-05 17:25:25 +02:00 committed by Teodor Tanasoaia
parent 781b54a8b9
commit 36c998a558
2 changed files with 7 additions and 7 deletions

View File

@ -673,9 +673,6 @@ impl Global {
bgl.exclusive_pipeline bgl.exclusive_pipeline
.set(binding_model::ExclusivePipeline::None) .set(binding_model::ExclusivePipeline::None)
.unwrap(); .unwrap();
let bgl = Arc::new(bgl);
Ok(bgl) Ok(bgl)
}); });

View File

@ -1659,7 +1659,7 @@ impl<A: HalApi> Device<A> {
label: &crate::Label, label: &crate::Label,
entry_map: bgl::EntryMap, entry_map: bgl::EntryMap,
origin: bgl::Origin, origin: bgl::Origin,
) -> Result<BindGroupLayout<A>, binding_model::CreateBindGroupLayoutError> { ) -> Result<Arc<BindGroupLayout<A>>, binding_model::CreateBindGroupLayoutError> {
#[derive(PartialEq)] #[derive(PartialEq)]
enum WritableStorage { enum WritableStorage {
Yes, Yes,
@ -1858,7 +1858,7 @@ impl<A: HalApi> Device<A> {
.validate(&self.limits) .validate(&self.limits)
.map_err(binding_model::CreateBindGroupLayoutError::TooManyBindings)?; .map_err(binding_model::CreateBindGroupLayoutError::TooManyBindings)?;
Ok(BindGroupLayout { let bgl = BindGroupLayout {
raw: Some(raw), raw: Some(raw),
device: self.clone(), device: self.clone(),
entries: entry_map, entries: entry_map,
@ -1866,7 +1866,11 @@ impl<A: HalApi> Device<A> {
exclusive_pipeline: OnceCell::new(), exclusive_pipeline: OnceCell::new(),
binding_count_validator: count_validator, binding_count_validator: count_validator,
label: label.to_string(), label: label.to_string(),
}) };
let bgl = Arc::new(bgl);
Ok(bgl)
} }
pub(crate) fn create_buffer_binding<'a>( pub(crate) fn create_buffer_binding<'a>(
@ -2607,7 +2611,6 @@ impl<A: HalApi> Device<A> {
bgl::Origin::Derived, bgl::Origin::Derived,
) { ) {
Ok(bgl) => { Ok(bgl) => {
let bgl = Arc::new(bgl);
e.insert(bgl.clone()); e.insert(bgl.clone());
Ok(bgl) Ok(bgl)
} }