File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -459,7 +459,19 @@ impl crate::TypeInner {
459
459
}
460
460
461
461
impl Validator {
462
- /// Construct a new validator instance.
462
+ /// Create a validator for Naga [`Module`]s.
463
+ ///
464
+ /// The `flags` argument indicates which stages of validation the
465
+ /// returned `Validator` should perform. Skipping stages can make
466
+ /// validation somewhat faster, but the validator may not reject some
467
+ /// invalid modules. Regardless of `flags`, validation always returns
468
+ /// a usable [`ModuleInfo`] value on success.
469
+ ///
470
+ /// If `flags` contains everything in `ValidationFlags::default()`,
471
+ /// then the returned Naga [`Validator`] will reject any [`Module`]
472
+ /// that would use capabilities not included in `capabilities`.
473
+ ///
474
+ /// [`Module`]: crate::Module
463
475
pub fn new ( flags : ValidationFlags , capabilities : Capabilities ) -> Self {
464
476
let subgroup_operations = if capabilities. contains ( Capabilities :: SUBGROUP ) {
465
477
use SubgroupOperationSet as S ;
Original file line number Diff line number Diff line change @@ -383,7 +383,19 @@ impl WebGpuError for MissingDownlevelFlags {
383
383
}
384
384
}
385
385
386
- /// Create a validator with the given validation flags.
386
+ /// Create a validator for Naga [`Module`]s.
387
+ ///
388
+ /// Create a Naga [`Validator`] that ensures that each [`naga::Module`]
389
+ /// presented to it is valid, and uses no features not included in
390
+ /// `features` and `downlevel`.
391
+ ///
392
+ /// The validator can only catch invalid modules and feature misuse
393
+ /// reliably when the `flags` argument includes all the flags in
394
+ /// [`ValidationFlags::default()`].
395
+ ///
396
+ /// [`Validator`]: naga::valid::Validator
397
+ /// [`Module`]: naga::Module
398
+ /// [`ValidationFlags::default()`]: naga::valid::ValidationFlags::default
387
399
pub fn create_validator (
388
400
features : wgt:: Features ,
389
401
downlevel : wgt:: DownlevelFlags ,
You can’t perform that action at this time.
0 commit comments