@@ -51,25 +51,20 @@ namespace {
5151
5252// return true if the internal validator was used, false otherwise
5353bool CreateValidator (CComPtr<IDxcValidator> &pValidator,
54- hlsl::options::ValidatorSelection SelectValidator =
55- hlsl::options::ValidatorSelection::Auto) {
56- bool bInternal =
57- SelectValidator == hlsl::options::ValidatorSelection::Internal;
58- bool bExternal =
59- SelectValidator == hlsl::options::ValidatorSelection::External;
60- bool bAuto = SelectValidator == hlsl::options::ValidatorSelection::Auto;
61-
62- // default behavior uses internal validator, as well as
63- // explicitly specifying internal
64- if (bInternal || bAuto) {
54+ std::string DxilDLLPath = " " ) {
55+
56+ // default behavior uses internal validator
57+ if (DxilDLLPath == " " ) {
6558 IFT (CreateDxcValidator (IID_PPV_ARGS (&pValidator)));
6659 return true ;
6760 }
6861
69- if (bExternal) {
70- // if external was explicitly specified, but no
71- // external validator could be found (no DXIL.dll), then error
72- IFTBOOL (DxilLibIsEnabled (), DXC_E_VALIDATOR_MISSING);
62+ // otherwise, use the external validator provided by the dxil_dll_path
63+ // argument
64+ else {
65+ // if a valid absolute path was given, but the DXIL.dll
66+ // is invalid, then error
67+ IFTBOOL (DxilLibIsEnabled (DxilDLLPath), DXC_E_VALIDATOR_MISSING);
7368 IFT (DxilLibCreateInstance (CLSID_DxcValidator, &pValidator));
7469
7570 return false ;
@@ -90,22 +85,22 @@ AssembleInputs::AssembleInputs(
9085 clang::DiagnosticsEngine *pDiag, hlsl::DxilShaderHash *pShaderHashOut,
9186 AbstractMemoryStream *pReflectionOut, AbstractMemoryStream *pRootSigOut,
9287 CComPtr<IDxcBlob> pRootSigBlob, CComPtr<IDxcBlob> pPrivateBlob,
93- hlsl::options::ValidatorSelection SelectValidator )
88+ std::string DxilDLLPath )
9489 : pM(std::move(pM)), pOutputContainerBlob(pOutputContainerBlob),
9590 pMalloc (pMalloc), SerializeFlags(SerializeFlags),
9691 ValidationFlags(ValidationFlags), pModuleBitcode(pModuleBitcode),
9792 DebugName(DebugName), pDiag(pDiag), pShaderHashOut(pShaderHashOut),
9893 pReflectionOut(pReflectionOut), pRootSigOut(pRootSigOut),
9994 pRootSigBlob(pRootSigBlob), pPrivateBlob(pPrivateBlob),
100- SelectValidator(SelectValidator ) {}
95+ DxilDLLPath(DxilDLLPath ) {}
10196
10297void GetValidatorVersion (unsigned *pMajor, unsigned *pMinor,
103- hlsl::options::ValidatorSelection SelectValidator ) {
98+ std::string DxilDLLPath ) {
10499 if (pMajor == nullptr || pMinor == nullptr )
105100 return ;
106101
107102 CComPtr<IDxcValidator> pValidator;
108- CreateValidator (pValidator, SelectValidator );
103+ CreateValidator (pValidator, DxilDLLPath );
109104
110105 CComPtr<IDxcVersionInfo> pVersionInfo;
111106 if (SUCCEEDED (pValidator.QueryInterface (&pVersionInfo))) {
@@ -115,6 +110,7 @@ void GetValidatorVersion(unsigned *pMajor, unsigned *pMinor,
115110 *pMajor = 1 ;
116111 *pMinor = 0 ;
117112 }
113+ return ;
118114}
119115
120116void AssembleToContainer (AssembleInputs &inputs) {
@@ -177,8 +173,14 @@ HRESULT ValidateAndAssembleToContainer(AssembleInputs &inputs) {
177173 std::unique_ptr<llvm::Module> llvmModuleWithDebugInfo;
178174
179175 CComPtr<IDxcValidator> pValidator;
180- bool bInternalValidator = CreateValidator (pValidator, inputs.SelectValidator );
181- // Warning on internal Validator
176+ bool bInternalValidator = CreateValidator (pValidator, inputs.DxilDLLPath );
177+ // Warning on external Validator
178+ if (!bInternalValidator) {
179+ unsigned diagID = inputs.pDiag ->getCustomDiagID (
180+ clang::DiagnosticsEngine::Level::Warning,
181+ " External validator loaded at %0" );
182+ inputs.pDiag ->Report (diagID) << inputs.DxilDLLPath ;
183+ }
182184
183185 CComPtr<IDxcValidator2> pValidator2;
184186 if (!bInternalValidator) {
@@ -273,11 +275,11 @@ HRESULT ValidateAndAssembleToContainer(AssembleInputs &inputs) {
273275
274276HRESULT ValidateRootSignatureInContainer (
275277 IDxcBlob *pRootSigContainer, clang::DiagnosticsEngine *pDiag,
276- hlsl::options::ValidatorSelection SelectValidator ) {
278+ std::string DxilDLLPath ) {
277279 HRESULT valHR = S_OK;
278280 CComPtr<IDxcValidator> pValidator;
279281 CComPtr<IDxcOperationResult> pValResult;
280- CreateValidator (pValidator);
282+ CreateValidator (pValidator, DxilDLLPath );
281283 IFT (pValidator->Validate (pRootSigContainer,
282284 DxcValidatorFlags_RootSignatureOnly |
283285 DxcValidatorFlags_InPlaceEdit,
0 commit comments