-
Notifications
You must be signed in to change notification settings - Fork 933
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
8,685 additions
and
3,672 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
//! 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 [`std::assert`] if the `strict_asserts` feature is activated. | ||
#[cfg(feature = "strict_asserts")] | ||
#[macro_export] | ||
macro_rules! strict_assert { | ||
( $( $arg:tt )* ) => { | ||
assert!( $( $arg )* ) | ||
} | ||
} | ||
|
||
/// This is equivalent to [`std::assert_eq`] if the `strict_asserts` feature is activated. | ||
#[cfg(feature = "strict_asserts")] | ||
#[macro_export] | ||
macro_rules! strict_assert_eq { | ||
( $( $arg:tt )* ) => { | ||
assert_eq!( $( $arg )* ) | ||
} | ||
} | ||
|
||
/// This is equivalent to [`std::assert_ne`] if the `strict_asserts` feature is activated. | ||
#[cfg(feature = "strict_asserts")] | ||
#[macro_export] | ||
macro_rules! strict_assert_ne { | ||
( $( $arg:tt )* ) => { | ||
assert_ne!( $( $arg )* ) | ||
} | ||
} | ||
|
||
/// This is equivalent to [`std::assert`] if the `strict_asserts` feature is activated. | ||
#[cfg(not(feature = "strict_asserts"))] | ||
#[macro_export] | ||
macro_rules! strict_assert { | ||
( $( $arg:tt )* ) => { | ||
debug_assert!( $( $arg )* ) | ||
}; | ||
} | ||
|
||
/// This is equivalent to [`std::assert_eq`] if the `strict_asserts` feature is activated. | ||
#[cfg(not(feature = "strict_asserts"))] | ||
#[macro_export] | ||
macro_rules! strict_assert_eq { | ||
( $( $arg:tt )* ) => { | ||
debug_assert_eq!( $( $arg )* ) | ||
}; | ||
} | ||
|
||
/// This is equivalent to [`std::assert_ne`] if the `strict_asserts` feature is activated. | ||
#[cfg(not(feature = "strict_asserts"))] | ||
#[macro_export] | ||
macro_rules! strict_assert_ne { | ||
( $( $arg:tt )* ) => { | ||
debug_assert_ne!( $( $arg )* ) | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.