mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
* Initial Commit * Remove now-redundant `format` import * Update CHANGELOG.md * Appropriately feature-gate `texture_format_serialize` test * Remove `alloc` feature Also fixed some documentation links and a Wasm `std` import * Revert change to `Serialize` for `TextureFormat` * Combine use statements * Switch from `PathBuf` to `String` * Consider environmental flags as unset on `no_std` * Fix missing `format!` * Add new CI tasks for `no_std` testing * Comment out known failing CI matrix option * Update all usage of `Dx12Compiler::DynamicDxc` * Added comments to CI * Update .github/workflows/ci.yml * Update .github/workflows/ci.yml * Update .github/workflows/ci.yml * CI Touchups --------- Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
67 lines
2.3 KiB
Rust
67 lines
2.3 KiB
Rust
//! Macros for validation internal to the wgpu.
|
|
//!
|
|
//! This module defines assertion macros that respect `wgpu-type`'s
|
|
//! `"strict_asserts"` feature.
|
|
//!
|
|
//! Because `wgpu-core`'s public APIs validate their arguments in all
|
|
//! types of builds, for performance, the `track` module skips some of
|
|
//! Rust's usual run-time checks on its internal operations in release
|
|
//! builds. However, some `wgpu-core` applications have a strong
|
|
//! preference for robustness over performance. To accommodate them,
|
|
//! `wgpu-core`'s `"strict_asserts"` feature enables that validation
|
|
//! in both debug and release builds.
|
|
|
|
/// This is equivalent to [`core::assert`] if the `strict_asserts` feature is activated, otherwise equal to [`core::debug_assert`].
|
|
#[cfg(feature = "strict_asserts")]
|
|
#[macro_export]
|
|
macro_rules! strict_assert {
|
|
( $( $arg:tt )* ) => {
|
|
assert!( $( $arg )* )
|
|
}
|
|
}
|
|
|
|
/// This is equivalent to [`core::assert_eq`] if the `strict_asserts` feature is activated, otherwise equal to [`core::debug_assert_eq`].
|
|
#[cfg(feature = "strict_asserts")]
|
|
#[macro_export]
|
|
macro_rules! strict_assert_eq {
|
|
( $( $arg:tt )* ) => {
|
|
assert_eq!( $( $arg )* )
|
|
}
|
|
}
|
|
|
|
/// This is equivalent to [`core::assert_ne`] if the `strict_asserts` feature is activated, otherwise equal to [`core::debug_assert_ne`].
|
|
#[cfg(feature = "strict_asserts")]
|
|
#[macro_export]
|
|
macro_rules! strict_assert_ne {
|
|
( $( $arg:tt )* ) => {
|
|
assert_ne!( $( $arg )* )
|
|
}
|
|
}
|
|
|
|
/// This is equivalent to [`core::assert`] if the `strict_asserts` feature is activated, otherwise equal to [`core::debug_assert`]
|
|
#[cfg(not(feature = "strict_asserts"))]
|
|
#[macro_export]
|
|
macro_rules! strict_assert {
|
|
( $( $arg:tt )* ) => {
|
|
debug_assert!( $( $arg )* )
|
|
};
|
|
}
|
|
|
|
/// This is equivalent to [`core::assert_eq`] if the `strict_asserts` feature is activated, otherwise equal to [`core::debug_assert_eq`]
|
|
#[cfg(not(feature = "strict_asserts"))]
|
|
#[macro_export]
|
|
macro_rules! strict_assert_eq {
|
|
( $( $arg:tt )* ) => {
|
|
debug_assert_eq!( $( $arg )* )
|
|
};
|
|
}
|
|
|
|
/// This is equivalent to [`core::assert_ne`] if the `strict_asserts` feature is activated, otherwise equal to [`core::debug_assert_ne`]
|
|
#[cfg(not(feature = "strict_asserts"))]
|
|
#[macro_export]
|
|
macro_rules! strict_assert_ne {
|
|
( $( $arg:tt )* ) => {
|
|
debug_assert_ne!( $( $arg )* )
|
|
};
|
|
}
|