wgpu/api/render_bundle.rs
1use crate::*;
2
3/// Pre-prepared reusable bundle of GPU operations.
4///
5/// It only supports a handful of render commands, but it makes them reusable. Executing a
6/// [`RenderBundle`] is often more efficient than issuing the underlying commands manually.
7///
8/// It can be created by use of a [`RenderBundleEncoder`], and executed onto a [`CommandEncoder`]
9/// using [`RenderPass::execute_bundles`].
10///
11/// Corresponds to [WebGPU `GPURenderBundle`](https://gpuweb.github.io/gpuweb/#render-bundle).
12#[derive(Debug, Clone)]
13pub struct RenderBundle {
14 pub(crate) inner: dispatch::DispatchRenderBundle,
15}
16#[cfg(send_sync)]
17static_assertions::assert_impl_all!(RenderBundle: Send, Sync);
18
19crate::cmp::impl_eq_ord_hash_proxy!(RenderBundle => .inner);
20
21impl RenderBundle {
22 #[cfg(custom)]
23 /// Returns custom implementation of RenderBundle (if custom backend and is internally T)
24 pub fn as_custom<T: custom::RenderBundleInterface>(&self) -> Option<&T> {
25 self.inner.as_custom()
26 }
27}
28
29/// Describes a [`RenderBundle`].
30///
31/// For use with [`RenderBundleEncoder::finish`].
32///
33/// Corresponds to [WebGPU `GPURenderBundleDescriptor`](
34/// https://gpuweb.github.io/gpuweb/#dictdef-gpurenderbundledescriptor).
35pub type RenderBundleDescriptor<'a> = wgt::RenderBundleDescriptor<Label<'a>>;
36static_assertions::assert_impl_all!(RenderBundleDescriptor<'_>: Send, Sync);