Skip to content

Commit 711721b

Browse files
[wgpu] Properly drop CoreRenderBundles (#8661)
1 parent 9a41de4 commit 711721b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

wgpu/src/backend/wgpu_core.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ pub struct CoreRenderBundleEncoder {
555555

556556
#[derive(Debug)]
557557
pub struct CoreRenderBundle {
558+
context: ContextWgpuCore,
558559
id: wgc::id::RenderBundleId,
559560
}
560561

@@ -3828,12 +3829,22 @@ impl dispatch::RenderBundleEncoderInterface for CoreRenderBundleEncoder {
38283829
self.context
38293830
.handle_error_fatal(err, "RenderBundleEncoder::finish");
38303831
}
3831-
CoreRenderBundle { id }.into()
3832+
CoreRenderBundle {
3833+
context: self.context.clone(),
3834+
id,
3835+
}
3836+
.into()
38323837
}
38333838
}
38343839

38353840
impl dispatch::RenderBundleInterface for CoreRenderBundle {}
38363841

3842+
impl Drop for CoreRenderBundle {
3843+
fn drop(&mut self) {
3844+
self.context.0.render_bundle_drop(self.id)
3845+
}
3846+
}
3847+
38373848
impl dispatch::SurfaceInterface for CoreSurface {
38383849
fn get_capabilities(&self, adapter: &dispatch::DispatchAdapter) -> wgt::SurfaceCapabilities {
38393850
let adapter = adapter.as_core();

0 commit comments

Comments
 (0)