pub struct TaaPass {Show 15 fields
pub enabled: bool,
pub config: TaaConfig,
pub shader_handle: u64,
pub history_handle: u64,
pub prev_history_handle: u64,
pub velocity_handle: u64,
pub current_jitter: [f32; 2],
pub frame_index: u32,
pub prev_view_proj: Mat4,
pub current_view_proj: Mat4,
pub history_width: u32,
pub history_height: u32,
pub history_valid: bool,
pub time_us: u64,
pub ping_pong: bool,
}Expand description
TAA pass state.
Fields§
§enabled: boolWhether TAA is enabled.
config: TaaConfigConfiguration.
shader_handle: u64Shader program handle.
history_handle: u64History color buffer handle.
prev_history_handle: u64Previous frame’s history buffer handle (ping-pong).
velocity_handle: u64Velocity buffer handle.
current_jitter: [f32; 2]Current jitter offset.
frame_index: u32Current frame index in the jitter sequence.
prev_view_proj: Mat4Previous frame’s view-projection matrix (for reprojection).
current_view_proj: Mat4Current frame’s view-projection matrix.
history_width: u32History buffer dimensions.
history_height: u32§history_valid: boolWhether the history buffer is valid (false on first frame or resize).
time_us: u64Time taken (microseconds).
ping_pong: boolWhether this is a ping or pong frame.
Implementations§
Source§impl TaaPass
impl TaaPass
pub fn new() -> Self
pub fn with_config(self, config: TaaConfig) -> Self
Sourcepub fn begin_frame(&mut self, view_proj: &Mat4)
pub fn begin_frame(&mut self, view_proj: &Mat4)
Advance to the next frame: update jitter, store previous matrices.
Sourcepub fn jitter_ndc(&self, viewport: &Viewport) -> [f32; 2]
pub fn jitter_ndc(&self, viewport: &Viewport) -> [f32; 2]
Get the jitter offset in NDC space for a given viewport size.
Sourcepub fn jittered_projection(&self, proj: &Mat4, viewport: &Viewport) -> Mat4
pub fn jittered_projection(&self, proj: &Mat4, viewport: &Viewport) -> Mat4
Apply jitter to a projection matrix.
Sourcepub fn invalidate_history(&mut self)
pub fn invalidate_history(&mut self)
Invalidate history (e.g., on camera cut).
Sourcepub fn neighborhood_clamp(
current_color: [f32; 3],
history_color: [f32; 3],
neighborhood_min: [f32; 3],
neighborhood_max: [f32; 3],
gamma: f32,
) -> [f32; 3]
pub fn neighborhood_clamp( current_color: [f32; 3], history_color: [f32; 3], neighborhood_min: [f32; 3], neighborhood_max: [f32; 3], gamma: f32, ) -> [f32; 3]
Neighborhood clamp: constrain history color to the min/max of the 3x3 neighborhood of the current frame. This prevents ghosting.
Sourcepub fn variance_clip(
history_color: [f32; 3],
neighborhood_mean: [f32; 3],
neighborhood_variance: [f32; 3],
gamma: f32,
) -> [f32; 3]
pub fn variance_clip( history_color: [f32; 3], neighborhood_mean: [f32; 3], neighborhood_variance: [f32; 3], gamma: f32, ) -> [f32; 3]
Variance clipping: use mean and variance of the neighborhood for tighter clamping.
Sourcepub fn compute_blend_factor(&self, velocity_length: f32) -> f32
pub fn compute_blend_factor(&self, velocity_length: f32) -> f32
Compute the blend factor, adjusting for motion.
Sourcepub fn fragment_shader(&self) -> String
pub fn fragment_shader(&self) -> String
Generate the TAA resolve fragment shader.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TaaPass
impl RefUnwindSafe for TaaPass
impl Send for TaaPass
impl Sync for TaaPass
impl Unpin for TaaPass
impl UnsafeUnpin for TaaPass
impl UnwindSafe for TaaPass
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.