naga-rust-rt 0.1.0

Support library for shaders compiled to Rust via the `naga-rust-back` library.
Documentation
//! This library provides types and functions which are used by the Rust code generated by
//! [`naga_rust_back`] or [`naga_rust_embed`]. These types and functions implement vector arithmetic
//! in the style expected by shader code, which differs from straightforward Rust in various ways.
//!
//! This library currently does not have a clean public API distinct from the API provided
//! for the benefit of the code generator. Expect changes in future versions.
//!
//! [`naga_rust_back`]: https://docs.rs/naga-rust-back
//! [`naga_rust_embed`]: https://docs.rs/naga-rust-embed

#![no_std]

#[cfg(feature = "std")]
extern crate std;

mod vector;

pub use vector::*;

// TODO: should probably be num_traits::Zero or something custom
pub fn zero<T: Default>() -> T {
    T::default()
}

pub fn discard() {
    // Best we can do for now, until we implement a codegen option to return Result instead.
    panic!("shader reached discard instruction");
}

pub use naga_rust_macros::dummy_attribute as compute;
pub use naga_rust_macros::dummy_attribute as fragment;
pub use naga_rust_macros::dummy_attribute as vertex;
pub use naga_rust_macros::dummy_attribute as workgroup_size;