Browse Source

Skip root signature container validation on validator < 1.5 (#2764)

- Older validators cannot validate/sign root signature-only containers
Tex Riddell 5 years ago
parent
commit
bcecd356b2
1 changed files with 9 additions and 2 deletions
  1. 9 2
      tools/clang/tools/dxcompiler/dxcompilerobj.cpp

+ 9 - 2
tools/clang/tools/dxcompiler/dxcompilerobj.cpp

@@ -616,6 +616,7 @@ public:
       // validator can be used as a fallback.
       bool produceFullContainer = false;
       bool needsValidation = false;
+      bool validateRootSigContainer = false;
 
       if (isPreprocessing) {
         // These settings are back-compatible with fxc.
@@ -675,6 +676,12 @@ public:
           dxcutil::GetValidatorVersion(&compiler.getCodeGenOpts().HLSLValidatorMajorVer,
                                       &compiler.getCodeGenOpts().HLSLValidatorMinorVer);
         }
+
+        // Root signature-only container validation is only supported on 1.5 and above.
+        validateRootSigContainer = DXIL::CompareVersions(
+          compiler.getCodeGenOpts().HLSLValidatorMajorVer,
+          compiler.getCodeGenOpts().HLSLValidatorMinorVer,
+          1, 5) >= 0;
       }
 
       if (opts.AstDump) {
@@ -716,7 +723,7 @@ public:
 
           pOutputBlob.Release();
           IFT(pContainerStream.QueryInterface(&pOutputBlob));
-          if (!opts.DisableValidation) {
+          if (validateRootSigContainer && !opts.DisableValidation) {
             CComPtr<IDxcBlobEncoding> pValErrors;
             // Validation failure communicated through diagnostic error
             dxcutil::ValidateRootSignatureInContainer(
@@ -841,7 +848,7 @@ public:
             if (pRootSigStream && pRootSigStream->GetPtrSize()) {
               CComPtr<IDxcBlob> pRootSignature;
               IFT(pRootSigStream->QueryInterface(&pRootSignature));
-              if (needsValidation) {
+              if (validateRootSigContainer && needsValidation) {
                 CComPtr<IDxcBlobEncoding> pValErrors;
                 // Validation failure communicated through diagnostic error
                 dxcutil::ValidateRootSignatureInContainer(pRootSignature, &compiler.getDiagnostics());