@@ -497,73 +497,15 @@ static bool verifyDescriptorRangeFlag(uint32_t Version, uint32_t Type,
497497 return (Flags & ~Mask) == FlagT::NONE;
498498}
499499
500- static bool verifySamplerFilter (uint32_t Filter) {
501- switch (Filter) {
502- case llvm::to_underlying (dxbc::StaticSamplerFilter::MIN_MAG_MIP_POINT):
503- case llvm::to_underlying (dxbc::StaticSamplerFilter::MIN_MAG_POINT_MIP_LINEAR):
504- case llvm::to_underlying (
505- dxbc::StaticSamplerFilter::MIN_POINT_MAG_LINEAR_MIP_POINT):
506- case llvm::to_underlying (dxbc::StaticSamplerFilter::MIN_POINT_MAG_MIP_LINEAR):
507- case llvm::to_underlying (dxbc::StaticSamplerFilter::MIN_LINEAR_MAG_MIP_POINT):
508- case llvm::to_underlying (
509- dxbc::StaticSamplerFilter::MIN_LINEAR_MAG_POINT_MIP_LINEAR):
510- case llvm::to_underlying (dxbc::StaticSamplerFilter::MIN_MAG_LINEAR_MIP_POINT):
511- case llvm::to_underlying (dxbc::StaticSamplerFilter::MIN_MAG_MIP_LINEAR):
512- case llvm::to_underlying (dxbc::StaticSamplerFilter::ANISOTROPIC):
513- case llvm::to_underlying (
514- dxbc::StaticSamplerFilter::COMPARISON_MIN_MAG_MIP_POINT):
515- case llvm::to_underlying (
516- dxbc::StaticSamplerFilter::COMPARISON_MIN_MAG_POINT_MIP_LINEAR):
517- case llvm::to_underlying (
518- dxbc::StaticSamplerFilter::COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT):
519- case llvm::to_underlying (
520- dxbc::StaticSamplerFilter::COMPARISON_MIN_POINT_MAG_MIP_LINEAR):
521- case llvm::to_underlying (
522- dxbc::StaticSamplerFilter::COMPARISON_MIN_LINEAR_MAG_MIP_POINT):
523- case llvm::to_underlying (
524- dxbc::StaticSamplerFilter::COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR):
525- case llvm::to_underlying (
526- dxbc::StaticSamplerFilter::COMPARISON_MIN_MAG_LINEAR_MIP_POINT):
527- case llvm::to_underlying (
528- dxbc::StaticSamplerFilter::COMPARISON_MIN_MAG_MIP_LINEAR):
529- case llvm::to_underlying (dxbc::StaticSamplerFilter::COMPARISON_ANISOTROPIC):
530- case llvm::to_underlying (
531- dxbc::StaticSamplerFilter::MINIMUM_MIN_MAG_MIP_POINT):
532- case llvm::to_underlying (
533- dxbc::StaticSamplerFilter::MINIMUM_MIN_MAG_POINT_MIP_LINEAR):
534- case llvm::to_underlying (
535- dxbc::StaticSamplerFilter::MINIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT):
536- case llvm::to_underlying (
537- dxbc::StaticSamplerFilter::MINIMUM_MIN_POINT_MAG_MIP_LINEAR):
538- case llvm::to_underlying (
539- dxbc::StaticSamplerFilter::MINIMUM_MIN_LINEAR_MAG_MIP_POINT):
540- case llvm::to_underlying (
541- dxbc::StaticSamplerFilter::MINIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR):
542- case llvm::to_underlying (
543- dxbc::StaticSamplerFilter::MINIMUM_MIN_MAG_LINEAR_MIP_POINT):
544- case llvm::to_underlying (
545- dxbc::StaticSamplerFilter::MINIMUM_MIN_MAG_MIP_LINEAR):
546- case llvm::to_underlying (dxbc::StaticSamplerFilter::MINIMUM_ANISOTROPIC):
547- case llvm::to_underlying (
548- dxbc::StaticSamplerFilter::MAXIMUM_MIN_MAG_MIP_POINT):
549- case llvm::to_underlying (
550- dxbc::StaticSamplerFilter::MAXIMUM_MIN_MAG_POINT_MIP_LINEAR):
551- case llvm::to_underlying (
552- dxbc::StaticSamplerFilter::MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT):
553- case llvm::to_underlying (
554- dxbc::StaticSamplerFilter::MAXIMUM_MIN_POINT_MAG_MIP_LINEAR):
555- case llvm::to_underlying (
556- dxbc::StaticSamplerFilter::MAXIMUM_MIN_LINEAR_MAG_MIP_POINT):
557- case llvm::to_underlying (
558- dxbc::StaticSamplerFilter::MAXIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR):
559- case llvm::to_underlying (
560- dxbc::StaticSamplerFilter::MAXIMUM_MIN_MAG_LINEAR_MIP_POINT):
561- case llvm::to_underlying (
562- dxbc::StaticSamplerFilter::MAXIMUM_MIN_MAG_MIP_LINEAR):
563- case llvm::to_underlying (dxbc::StaticSamplerFilter::MAXIMUM_ANISOTROPIC):
564- return true ;
565- }
566- return false ;
500+ static bool verifySamplerFilter (uint32_t Value) {
501+ dxbc::StaticSamplerFilter Filter = dxbc::StaticSamplerFilter (Value);
502+
503+ dxbc::StaticSamplerFilter Mask = dxbc::StaticSamplerFilter::MIN_MAG_MIP_POINT;
504+
505+ #define STATIC_SAMPLER_FILTER (Num, Val ) Mask |= dxbc::StaticSamplerFilter::Val;
506+ #include " llvm/BinaryFormat/DXContainerConstants.def"
507+
508+ return popcount (llvm::to_underlying (Filter & Mask)) == 1 ;
567509}
568510
569511// Values allowed here:
0 commit comments