File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -459,7 +459,19 @@ impl crate::TypeInner {
459459}
460460
461461impl 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
463475 pub fn new ( flags : ValidationFlags , capabilities : Capabilities ) -> Self {
464476 let subgroup_operations = if capabilities. contains ( Capabilities :: SUBGROUP ) {
465477 use SubgroupOperationSet as S ;
Original file line number Diff line number Diff line change @@ -383,7 +383,19 @@ impl WebGpuError for MissingDownlevelFlags {
383383 }
384384}
385385
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
387399pub fn create_validator (
388400 features : wgt:: Features ,
389401 downlevel : wgt:: DownlevelFlags ,
You can’t perform that action at this time.
0 commit comments