Skip to content

Commit 9ce1772

Browse files
committed
change Device.create_pipeline_cache to return an Arc<PipelineCache<A>
1 parent 47465dd commit 9ce1772

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

wgpu-core/src/device/global.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1737,7 +1737,7 @@ impl Global {
17371737
let cache = unsafe { device.create_pipeline_cache(desc) };
17381738
match cache {
17391739
Ok(cache) => {
1740-
let id = fid.assign(Arc::new(cache));
1740+
let id = fid.assign(cache);
17411741
api_log!("Device::create_pipeline_cache -> {id:?}");
17421742
return (id, None);
17431743
}

wgpu-core/src/device/resource.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3397,7 +3397,7 @@ impl<A: HalApi> Device<A> {
33973397
pub unsafe fn create_pipeline_cache(
33983398
self: &Arc<Self>,
33993399
desc: &pipeline::PipelineCacheDescriptor,
3400-
) -> Result<pipeline::PipelineCache<A>, pipeline::CreatePipelineCacheError> {
3400+
) -> Result<Arc<pipeline::PipelineCache<A>>, pipeline::CreatePipelineCacheError> {
34013401
use crate::pipeline_cache;
34023402

34033403
self.check_is_valid()?;
@@ -3436,6 +3436,9 @@ impl<A: HalApi> Device<A> {
34363436
// This would be none in the error condition, which we don't implement yet
34373437
raw: Some(raw),
34383438
};
3439+
3440+
let cache = Arc::new(cache);
3441+
34393442
Ok(cache)
34403443
}
34413444

0 commit comments

Comments
 (0)