mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-24 08:21:25 +01:00
[naga, wgpu-core] Add some docs for Naga validator creation.
This commit is contained in:
1 parent
1c43ac2c42
commit
d9a6b4fa4a
2 files changed
+26
-2
No files matched your search
+13
-1
@@ -459,7 +459,19 @@ impl crate::TypeInner {
|
||||
}
|
||||
|
||||
impl Validator {
|
||||
/// Construct a new validator instance.
|
||||
/// Create a validator for Naga [`Module`]s.
|
||||
///
|
||||
/// The `flags` argument indicates which stages of validation the
|
||||
/// returned `Validator` should perform. Skipping stages can make
|
||||
/// validation somewhat faster, but the validator may not reject some
|
||||
/// invalid modules. Regardless of `flags`, validation always returns
|
||||
/// a usable [`ModuleInfo`] value on success.
|
||||
///
|
||||
/// If `flags` contains everything in `ValidationFlags::default()`,
|
||||
/// then the returned Naga [`Validator`] will reject any [`Module`]
|
||||
/// that would use capabilities not included in `capabilities`.
|
||||
///
|
||||
/// [`Module`]: crate::Module
|
||||
pub fn new(flags: ValidationFlags, capabilities: Capabilities) -> Self {
|
||||
let subgroup_operations = if capabilities.contains(Capabilities::SUBGROUP) {
|
||||
use SubgroupOperationSet as S;
|
||||
|
||||
@@ -383,7 +383,19 @@ impl WebGpuError for MissingDownlevelFlags {
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a validator with the given validation flags.
|
||||
/// Create a validator for Naga [`Module`]s.
|
||||
///
|
||||
/// Create a Naga [`Validator`] that ensures that each [`naga::Module`]
|
||||
/// presented to it is valid, and uses no features not included in
|
||||
/// `features` and `downlevel`.
|
||||
///
|
||||
/// The validator can only catch invalid modules and feature misuse
|
||||
/// reliably when the `flags` argument includes all the flags in
|
||||
/// [`ValidationFlags::default()`].
|
||||
///
|
||||
/// [`Validator`]: naga::valid::Validator
|
||||
/// [`Module`]: naga::Module
|
||||
/// [`ValidationFlags::default()`]: naga::valid::ValidationFlags::default
|
||||
pub fn create_validator(
|
||||
features: wgt::Features,
|
||||
downlevel: wgt::DownlevelFlags,
|
||||
|
||||
Reference in new issue
Block a user