Skip to main content

BloomFeature

Struct BloomFeature 

Source
pub struct BloomFeature { /* private fields */ }
Expand description

Persistent bloom feature owning GPU pipelines, layouts, and pre-built static bind groups.

The Composer calls extract_and_prepare once per frame before the render graph is built, then add_to_graph to emit a chain of flattened micro-passes (Extract → Downsample × N → Upsample × N → Composite) into the RDG.

§Dual-Layer BindGroup Model

Static bind groups (Group 0) containing samplers and uniform buffers are built here and shared across all micro-pass nodes as cheap clones. Each micro-pass only assembles Group 1 (transient texture views).

Implementations§

Source§

impl BloomFeature

Source

pub fn new() -> Self

Creates a new bloom feature. All GPU resources are lazily allocated.

Source

pub fn extract_and_prepare( &mut self, ctx: &mut ExtractContext<'_>, upsample_uniform: &CpuBuffer<UpsampleUniforms>, composite_uniform: &CpuBuffer<CompositeUniforms>, )

Ensure all persistent GPU resources (layouts, static buffers, pipelines) are initialised. Build or rebuild static bind groups (Group 0) when the underlying GPU buffer identity changes.

upsample_uniform and composite_uniform are the CpuBuffer IDs whose GPU mirrors have already been uploaded via ensure_buffer().

Source

pub fn add_to_graph<'a>( &'a self, ctx: &mut GraphBuilderContext<'a, '_>, input_color: TextureNodeId, karis_average: bool, max_mip_levels: u32, ) -> TextureNodeId

Emit the full bloom pipeline as a chain of independent RDG passes.

Each downsample and upsample step is a separate pass operating on independent 2D transient textures with progressively halved resolution. The RDG compiler sees fine-grained dependencies between every mip level, enabling:

  • Optimal barrier/transition insertion between individual steps.
  • Aggressive memory aliasing — textures whose lifetimes don’t overlap are automatically mapped to the same physical GPU memory.

Returns the composited output TextureNodeId (scene HDR with bloom applied) for downstream wiring (e.g. ToneMapping).

Trait Implementations§

Source§

impl Default for BloomFeature

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,