Files
wgpu/src/back/mod.rs
T

32 lines
1.1 KiB
Rust

//! Functions which export shader modules into binary and text formats.
#[cfg(feature = "dot-out")]
pub mod dot;
#[cfg(feature = "glsl-out")]
pub mod glsl;
#[cfg(feature = "msl-out")]
pub mod msl;
#[cfg(feature = "spv-out")]
pub mod spv;
impl crate::Expression {
/// Returns the ref count, upon reaching which this expression
/// should be considered for baking.
///
/// Note: we have to cache any expressions that depend on the control flow,
/// or otherwise they may be moved into a non-uniform contol flow, accidentally.
#[allow(dead_code)]
fn bake_ref_count(&self) -> usize {
match *self {
// accesses are never cached, only loads are
crate::Expression::Access { .. } | crate::Expression::AccessIndex { .. } => !0,
// sampling may use the control flow, and image ops look better by themselves
crate::Expression::ImageSample { .. } | crate::Expression::ImageLoad { .. } => 1,
// derivatives use the control flow
crate::Expression::Derivative { .. } => 1,
// cache expressions that are referenced multiple times
_ => 2,
}
}
}