Skip to content

Commit ab68415

Browse files
committed
Skip root signature container validation on validator < 1.5 (#2764)
- Older validators cannot validate/sign root signature-only containers
1 parent a23497d commit ab68415

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

tools/clang/tools/dxcompiler/dxcompilerobj.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,7 @@ class DxcCompiler : public IDxcCompiler3,
616616
// validator can be used as a fallback.
617617
bool produceFullContainer = false;
618618
bool needsValidation = false;
619+
bool validateRootSigContainer = false;
619620

620621
if (isPreprocessing) {
621622
// These settings are back-compatible with fxc.
@@ -675,6 +676,12 @@ class DxcCompiler : public IDxcCompiler3,
675676
dxcutil::GetValidatorVersion(&compiler.getCodeGenOpts().HLSLValidatorMajorVer,
676677
&compiler.getCodeGenOpts().HLSLValidatorMinorVer);
677678
}
679+
680+
// Root signature-only container validation is only supported on 1.5 and above.
681+
validateRootSigContainer = DXIL::CompareVersions(
682+
compiler.getCodeGenOpts().HLSLValidatorMajorVer,
683+
compiler.getCodeGenOpts().HLSLValidatorMinorVer,
684+
1, 5) >= 0;
678685
}
679686

680687
if (opts.AstDump) {
@@ -716,7 +723,7 @@ class DxcCompiler : public IDxcCompiler3,
716723

717724
pOutputBlob.Release();
718725
IFT(pContainerStream.QueryInterface(&pOutputBlob));
719-
if (!opts.DisableValidation) {
726+
if (validateRootSigContainer && !opts.DisableValidation) {
720727
CComPtr<IDxcBlobEncoding> pValErrors;
721728
// Validation failure communicated through diagnostic error
722729
dxcutil::ValidateRootSignatureInContainer(
@@ -841,7 +848,7 @@ class DxcCompiler : public IDxcCompiler3,
841848
if (pRootSigStream && pRootSigStream->GetPtrSize()) {
842849
CComPtr<IDxcBlob> pRootSignature;
843850
IFT(pRootSigStream->QueryInterface(&pRootSignature));
844-
if (needsValidation) {
851+
if (validateRootSigContainer && needsValidation) {
845852
CComPtr<IDxcBlobEncoding> pValErrors;
846853
// Validation failure communicated through diagnostic error
847854
dxcutil::ValidateRootSignatureInContainer(pRootSignature, &compiler.getDiagnostics());

0 commit comments

Comments
 (0)