Skip to content

Commit 36c998a

Browse files
committed
change Device.create_bind_group_layout to return an Arc<BindGroupLayout<A>
1 parent 781b54a commit 36c998a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

wgpu-core/src/device/global.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -673,9 +673,6 @@ impl Global {
673673
bgl.exclusive_pipeline
674674
.set(binding_model::ExclusivePipeline::None)
675675
.unwrap();
676-
677-
let bgl = Arc::new(bgl);
678-
679676
Ok(bgl)
680677
});
681678

wgpu-core/src/device/resource.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,7 +1659,7 @@ impl<A: HalApi> Device<A> {
16591659
label: &crate::Label,
16601660
entry_map: bgl::EntryMap,
16611661
origin: bgl::Origin,
1662-
) -> Result<BindGroupLayout<A>, binding_model::CreateBindGroupLayoutError> {
1662+
) -> Result<Arc<BindGroupLayout<A>>, binding_model::CreateBindGroupLayoutError> {
16631663
#[derive(PartialEq)]
16641664
enum WritableStorage {
16651665
Yes,
@@ -1858,15 +1858,19 @@ impl<A: HalApi> Device<A> {
18581858
.validate(&self.limits)
18591859
.map_err(binding_model::CreateBindGroupLayoutError::TooManyBindings)?;
18601860

1861-
Ok(BindGroupLayout {
1861+
let bgl = BindGroupLayout {
18621862
raw: Some(raw),
18631863
device: self.clone(),
18641864
entries: entry_map,
18651865
origin,
18661866
exclusive_pipeline: OnceCell::new(),
18671867
binding_count_validator: count_validator,
18681868
label: label.to_string(),
1869-
})
1869+
};
1870+
1871+
let bgl = Arc::new(bgl);
1872+
1873+
Ok(bgl)
18701874
}
18711875

18721876
pub(crate) fn create_buffer_binding<'a>(
@@ -2607,7 +2611,6 @@ impl<A: HalApi> Device<A> {
26072611
bgl::Origin::Derived,
26082612
) {
26092613
Ok(bgl) => {
2610-
let bgl = Arc::new(bgl);
26112614
e.insert(bgl.clone());
26122615
Ok(bgl)
26132616
}

0 commit comments

Comments
 (0)