mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 16:24:24 +00:00
Bump BGL refcounts on getting them from pipelines
This commit is contained in:
parent
55064ace4c
commit
f164fd1f46
@ -2957,6 +2957,8 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
Ok((id.0, derived_bind_group_count))
|
||||
}
|
||||
|
||||
/// Get an ID of one of the bind group layouts. The ID adds a refcount,
|
||||
/// which needs to be released by calling `bind_group_layout_drop`.
|
||||
pub fn render_pipeline_get_bind_group_layout<B: GfxBackend>(
|
||||
&self,
|
||||
pipeline_id: id::RenderPipelineId,
|
||||
@ -2965,18 +2967,21 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
let hub = B::hub(self);
|
||||
let mut token = Token::root();
|
||||
let (pipeline_layout_guard, mut token) = hub.pipeline_layouts.read(&mut token);
|
||||
let (bgl_guard, mut token) = hub.bind_group_layouts.read(&mut token);
|
||||
let (_, mut token) = hub.bind_groups.read(&mut token);
|
||||
let (pipeline_guard, _) = hub.render_pipelines.read(&mut token);
|
||||
|
||||
let pipeline = pipeline_guard
|
||||
.get(pipeline_id)
|
||||
.map_err(|_| binding_model::GetBindGroupLayoutError::InvalidPipeline)?;
|
||||
pipeline_layout_guard[pipeline.layout_id.value]
|
||||
let id = pipeline_layout_guard[pipeline.layout_id.value]
|
||||
.bind_group_layout_ids
|
||||
.get(index as usize)
|
||||
.map(|valid| valid.0)
|
||||
.ok_or(binding_model::GetBindGroupLayoutError::InvalidGroupIndex(
|
||||
index,
|
||||
))
|
||||
))?;
|
||||
bgl_guard[*id].multi_ref_count.inc();
|
||||
Ok(id.0)
|
||||
}
|
||||
|
||||
pub fn render_pipeline_error<B: GfxBackend>(
|
||||
@ -3171,6 +3176,8 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
Ok((id.0, derived_bind_group_count))
|
||||
}
|
||||
|
||||
/// Get an ID of one of the bind group layouts. The ID adds a refcount,
|
||||
/// which needs to be released by calling `bind_group_layout_drop`.
|
||||
pub fn compute_pipeline_get_bind_group_layout<B: GfxBackend>(
|
||||
&self,
|
||||
pipeline_id: id::ComputePipelineId,
|
||||
@ -3179,18 +3186,21 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
let hub = B::hub(self);
|
||||
let mut token = Token::root();
|
||||
let (pipeline_layout_guard, mut token) = hub.pipeline_layouts.read(&mut token);
|
||||
let (bgl_guard, mut token) = hub.bind_group_layouts.read(&mut token);
|
||||
let (_, mut token) = hub.bind_groups.read(&mut token);
|
||||
let (pipeline_guard, _) = hub.compute_pipelines.read(&mut token);
|
||||
|
||||
let pipeline = pipeline_guard
|
||||
.get(pipeline_id)
|
||||
.map_err(|_| binding_model::GetBindGroupLayoutError::InvalidPipeline)?;
|
||||
pipeline_layout_guard[pipeline.layout_id.value]
|
||||
let id = pipeline_layout_guard[pipeline.layout_id.value]
|
||||
.bind_group_layout_ids
|
||||
.get(index as usize)
|
||||
.map(|valid| valid.0)
|
||||
.ok_or(binding_model::GetBindGroupLayoutError::InvalidGroupIndex(
|
||||
index,
|
||||
))
|
||||
))?;
|
||||
bgl_guard[*id].multi_ref_count.inc();
|
||||
Ok(id.0)
|
||||
}
|
||||
|
||||
pub fn compute_pipeline_error<B: GfxBackend>(
|
||||
|
@ -239,10 +239,8 @@ impl<B: hal::Backend> Access<CommandBuffer<B>> for SwapChain<B> {}
|
||||
impl<B: hal::Backend> Access<RenderBundle> for Device<B> {}
|
||||
impl<B: hal::Backend> Access<RenderBundle> for CommandBuffer<B> {}
|
||||
impl<B: hal::Backend> Access<ComputePipeline<B>> for Device<B> {}
|
||||
impl<B: hal::Backend> Access<ComputePipeline<B>> for PipelineLayout<B> {}
|
||||
impl<B: hal::Backend> Access<ComputePipeline<B>> for BindGroup<B> {}
|
||||
impl<B: hal::Backend> Access<RenderPipeline<B>> for Device<B> {}
|
||||
impl<B: hal::Backend> Access<RenderPipeline<B>> for PipelineLayout<B> {}
|
||||
impl<B: hal::Backend> Access<RenderPipeline<B>> for BindGroup<B> {}
|
||||
impl<B: hal::Backend> Access<RenderPipeline<B>> for ComputePipeline<B> {}
|
||||
impl<B: hal::Backend> Access<ShaderModule<B>> for Device<B> {}
|
||||
|
Loading…
Reference in New Issue
Block a user