diff --git a/include/dxc/DxilContainer/DxcContainerBuilder.h b/include/dxc/DxilContainer/DxcContainerBuilder.h index 9a3241525c..e79fec18c8 100644 --- a/include/dxc/DxilContainer/DxcContainerBuilder.h +++ b/include/dxc/DxilContainer/DxcContainerBuilder.h @@ -45,8 +45,7 @@ class DxcContainerBuilder : public IDxcContainerBuilder { return DoBasicQueryInterface(this, riid, ppvObject); } - void Init(const char *warning = nullptr) { - m_warning = warning; + void Init() { m_RequireValidation = false; m_HasPrivateData = false; m_HashFunction = nullptr; @@ -67,7 +66,6 @@ class DxcContainerBuilder : public IDxcContainerBuilder { PartList m_parts; CComPtr m_pContainer; - const char *m_warning; bool m_RequireValidation; bool m_HasPrivateData; // Function to compute hash when valid dxil container is built diff --git a/include/dxc/Support/HLSLOptions.h b/include/dxc/Support/HLSLOptions.h index bad330747b..31ca3d1c14 100644 --- a/include/dxc/Support/HLSLOptions.h +++ b/include/dxc/Support/HLSLOptions.h @@ -114,13 +114,6 @@ struct RewriterOpts { bool DeclGlobalCB = false; // OPT_rw_decl_global_cb }; -enum class ValidatorSelection : int { - Auto, // Force internal validator (even if DXIL.dll is present) - Internal, // Force internal validator (even if DXIL.dll is present) - External, // Use DXIL.dll, failing compilation if not available - Invalid = -1 // Invalid -}; - /// Use this class to capture all options. class DxcOpts { public: @@ -225,8 +218,6 @@ class DxcOpts { bool ResMayAlias = false; // OPT_res_may_alias unsigned long ValVerMajor = UINT_MAX, ValVerMinor = UINT_MAX; // OPT_validator_version - ValidatorSelection SelectValidator = - ValidatorSelection::Auto; // OPT_select_validator unsigned ScanLimit = 0; // OPT_memdep_block_scan_limit bool ForceZeroStoreLifetimes = false; // OPT_force_zero_store_lifetimes bool EnableLifetimeMarkers = false; // OPT_enable_lifetime_markers diff --git a/lib/DxilContainer/DxcContainerBuilder.cpp b/lib/DxilContainer/DxcContainerBuilder.cpp index 770aa910a4..be182328dd 100644 --- a/lib/DxilContainer/DxcContainerBuilder.cpp +++ b/lib/DxilContainer/DxcContainerBuilder.cpp @@ -146,18 +146,14 @@ DxcContainerBuilder::SerializeContainer(IDxcOperationResult **ppResult) { // Combine existing warnings and errors from validation CComPtr pErrorBlob; CDxcMallocHeapPtr errorHeap(m_pMalloc); - SIZE_T warningLength = m_warning ? strlen(m_warning) : 0; - SIZE_T valErrorLength = + SIZE_T totalErrorLength = pValErrorUtf8 ? pValErrorUtf8->GetStringLength() : 0; - SIZE_T totalErrorLength = warningLength + valErrorLength; if (totalErrorLength) { SIZE_T errorSizeInBytes = totalErrorLength + 1; errorHeap.AllocateBytes(errorSizeInBytes); - if (warningLength) - memcpy(errorHeap.m_pData, m_warning, warningLength); - if (valErrorLength) - memcpy(errorHeap.m_pData + warningLength, - pValErrorUtf8->GetStringPointer(), valErrorLength); + + memcpy(errorHeap.m_pData, pValErrorUtf8->GetStringPointer(), + totalErrorLength); errorHeap.m_pData[totalErrorLength] = L'\0'; IFT(hlsl::DxcCreateBlobWithEncodingOnMalloc(errorHeap.m_pData, m_pMalloc, errorSizeInBytes, DXC_CP_UTF8, diff --git a/tools/clang/tools/dxcompiler/CMakeLists.txt b/tools/clang/tools/dxcompiler/CMakeLists.txt index c69e276194..26bf0e5d98 100644 --- a/tools/clang/tools/dxcompiler/CMakeLists.txt +++ b/tools/clang/tools/dxcompiler/CMakeLists.txt @@ -57,7 +57,6 @@ set(SOURCES DXCompiler.rc DXCompiler.def dxcfilesystem.cpp - dxillib.cpp dxcutil.cpp dxcdisassembler.cpp dxcpdbutils.cpp @@ -75,7 +74,6 @@ set(SOURCES dxcutil.cpp dxcdisassembler.cpp dxcpdbutils.cpp - dxillib.cpp dxcvalidator.cpp dxclinker.cpp dxcshadersourceinfo.cpp diff --git a/tools/clang/tools/dxcompiler/DXCompiler.cpp b/tools/clang/tools/dxcompiler/DXCompiler.cpp index c548441449..c7ffcbffa1 100644 --- a/tools/clang/tools/dxcompiler/DXCompiler.cpp +++ b/tools/clang/tools/dxcompiler/DXCompiler.cpp @@ -19,7 +19,6 @@ #ifdef LLVM_ON_WIN32 #include "dxcetw.h" #endif -#include "dxillib.h" namespace hlsl { HRESULT SetupRegistryPassForHLSL(); @@ -65,7 +64,6 @@ static HRESULT InitMaybeFail() throw() { fsSetup = true; IFC(hlsl::SetupRegistryPassForHLSL()); IFC(hlsl::SetupRegistryPassForPIX()); - IFC(DxilLibInitialize()); if (hlsl::options::initHlslOptTable()) { hr = E_FAIL; goto Cleanup; @@ -110,12 +108,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD Reason, LPVOID reserved) { ::hlsl::options::cleanupHlslOptTable(); ::llvm::sys::fs::CleanupPerThreadFileSystem(); ::llvm::llvm_shutdown(); - if (reserved == - NULL) { // FreeLibrary has been called or the DLL load failed - DxilLibCleanup(DxilLibCleanUpType::UnloadLibrary); - } else { // Process termination. We should not call FreeLibrary() - DxilLibCleanup(DxilLibCleanUpType::ProcessTermination); - } DxcClearThreadMalloc(); DxcCleanupThreadMalloc(); DxcEtw_DXCompilerShutdown_Stop(S_OK); diff --git a/tools/clang/tools/dxcompiler/dxcapi.cpp b/tools/clang/tools/dxcompiler/dxcapi.cpp index ab2cf1f40e..d4e85bc35c 100644 --- a/tools/clang/tools/dxcompiler/dxcapi.cpp +++ b/tools/clang/tools/dxcompiler/dxcapi.cpp @@ -25,7 +25,6 @@ #include "dxcetw.h" #endif #include "dxc/DxilContainer/DxcContainerBuilder.h" -#include "dxillib.h" #include HRESULT CreateDxcCompiler(REFIID riid, _Out_ LPVOID *ppv); @@ -59,20 +58,11 @@ HRESULT CreateDxcContainerReflection(REFIID riid, _Out_ LPVOID *ppv) { HRESULT CreateDxcContainerBuilder(REFIID riid, _Out_ LPVOID *ppv) { // Call dxil.dll's containerbuilder *ppv = nullptr; - const char *warning; - HRESULT hr = DxilLibCreateInstance(CLSID_DxcContainerBuilder, - (IDxcContainerBuilder **)ppv); - if (FAILED(hr)) { - warning = "Unable to create container builder from dxil.dll. Resulting " - "container will not be signed.\n"; - } else { - return hr; - } CComPtr Result = DxcContainerBuilder::Alloc(DxcGetThreadMallocNoRef()); IFROOM(Result.p); - Result->Init(warning); + Result->Init(); return Result->QueryInterface(riid, ppv); } diff --git a/tools/clang/tools/dxcompiler/dxcassembler.cpp b/tools/clang/tools/dxcompiler/dxcassembler.cpp index 0ff2abe26c..6622e93cbc 100644 --- a/tools/clang/tools/dxcompiler/dxcassembler.cpp +++ b/tools/clang/tools/dxcompiler/dxcassembler.cpp @@ -19,7 +19,6 @@ #include "dxc/Support/dxcfilesystem.h" #include "dxc/Support/microcom.h" #include "dxcutil.h" -#include "dxillib.h" #include "llvm/Bitcode/ReaderWriter.h" #include "llvm/IR/LLVMContext.h" diff --git a/tools/clang/tools/dxcompiler/dxclinker.cpp b/tools/clang/tools/dxcompiler/dxclinker.cpp index 82c9b8e96b..f5427ccc08 100644 --- a/tools/clang/tools/dxcompiler/dxclinker.cpp +++ b/tools/clang/tools/dxcompiler/dxclinker.cpp @@ -18,7 +18,6 @@ #include "dxc/Support/dxcapi.impl.h" #include "dxc/Support/microcom.h" #include "dxc/dxcapi.h" -#include "dxillib.h" #include "llvm/ADT/SmallVector.h" #include diff --git a/tools/clang/tools/dxcompiler/dxcompilerobj.cpp b/tools/clang/tools/dxcompiler/dxcompilerobj.cpp index ebeee380ef..84b568df9c 100644 --- a/tools/clang/tools/dxcompiler/dxcompilerobj.cpp +++ b/tools/clang/tools/dxcompiler/dxcompilerobj.cpp @@ -56,7 +56,6 @@ #include "dxcompileradapter.h" #include "dxcshadersourceinfo.h" #include "dxcversion.inc" -#include "dxillib.h" #include #include @@ -850,11 +849,9 @@ class DxcCompiler : public IDxcCompiler3, compiler.getCodeGenOpts().HLSLValidatorMajorVer = opts.ValVerMajor; compiler.getCodeGenOpts().HLSLValidatorMinorVer = opts.ValVerMinor; } else { - // Version from dxil.dll, or internal validator if unavailable dxcutil::GetValidatorVersion( &compiler.getCodeGenOpts().HLSLValidatorMajorVer, - &compiler.getCodeGenOpts().HLSLValidatorMinorVer, - opts.SelectValidator); + &compiler.getCodeGenOpts().HLSLValidatorMinorVer); } // Root signature-only container validation is only supported on 1.5 and @@ -934,7 +931,7 @@ class DxcCompiler : public IDxcCompiler3, CComPtr pValErrors; // Validation failure communicated through diagnostic error dxcutil::ValidateRootSignatureInContainer( - pOutputBlob, &compiler.getDiagnostics(), opts.SelectValidator); + pOutputBlob, &compiler.getDiagnostics()); } } } else if (opts.VerifyDiagnostics) { @@ -1054,8 +1051,7 @@ class DxcCompiler : public IDxcCompiler3, std::move(serializeModule), pOutputBlob, m_pMalloc, SerializeFlags, pOutputStream, 0, opts.GetPDBName(), &compiler.getDiagnostics(), &ShaderHashContent, pReflectionStream, - pRootSigStream, pRootSignatureBlob, pPrivateBlob, - opts.SelectValidator); + pRootSigStream, pRootSignatureBlob, pPrivateBlob); inputs.pVersionInfo = static_cast(this); @@ -1108,8 +1104,7 @@ class DxcCompiler : public IDxcCompiler3, CComPtr pValErrors; // Validation failure communicated through diagnostic error dxcutil::ValidateRootSignatureInContainer( - pRootSignature, &compiler.getDiagnostics(), - opts.SelectValidator); + pRootSignature, &compiler.getDiagnostics()); } IFT(pResult->SetOutputObject(DXC_OUT_ROOT_SIGNATURE, pRootSignature)); @@ -1324,13 +1319,6 @@ class DxcCompiler : public IDxcCompiler3, CComPtr pResult; hr = e.hr; std::string msg("Internal Compiler error: "); - switch (hr) { - case DXC_E_VALIDATOR_MISSING: - msg = "Error: external validator selected, but DXIL.dll not found."; - break; - default: - break; - } msg += e.msg; if (SUCCEEDED(DxcResult::Create( e.hr, DXC_OUT_NONE, diff --git a/tools/clang/tools/dxcompiler/dxcutil.cpp b/tools/clang/tools/dxcompiler/dxcutil.cpp index ea3f72dcb4..4e5c5c95e8 100644 --- a/tools/clang/tools/dxcompiler/dxcutil.cpp +++ b/tools/clang/tools/dxcompiler/dxcutil.cpp @@ -19,7 +19,6 @@ #include "dxc/Support/WinIncludes.h" #include "dxc/Support/dxcapi.impl.h" #include "dxc/dxcapi.h" -#include "dxillib.h" #include "clang/Basic/Diagnostic.h" #include "llvm/Bitcode/ReaderWriter.h" #include "llvm/IR/DebugInfo.h" @@ -50,32 +49,8 @@ namespace { // AssembleToContainer helper functions. // return true if the internal validator was used, false otherwise -bool CreateValidator(CComPtr &pValidator, - hlsl::options::ValidatorSelection SelectValidator = - hlsl::options::ValidatorSelection::Auto) { - bool bInternal = - SelectValidator == hlsl::options::ValidatorSelection::Internal; - bool bExternal = - SelectValidator == hlsl::options::ValidatorSelection::External; - bool bAuto = SelectValidator == hlsl::options::ValidatorSelection::Auto; - - // default behavior uses internal validator, as well as - // explicitly specifying internal - if (bInternal || bAuto) { - IFT(CreateDxcValidator(IID_PPV_ARGS(&pValidator))); - return true; - } - - if (bExternal) { - // if external was explicitly specified, but no - // external validator could be found (no DXIL.dll), then error - IFTBOOL(DxilLibIsEnabled(), DXC_E_VALIDATOR_MISSING); - IFT(DxilLibCreateInstance(CLSID_DxcValidator, &pValidator)); - - return false; - } - - return false; +void CreateValidator(CComPtr &pValidator) { + IFT(CreateDxcValidator(IID_PPV_ARGS(&pValidator))); } } // namespace @@ -89,23 +64,20 @@ AssembleInputs::AssembleInputs( uint32_t ValidationFlags, llvm::StringRef DebugName, clang::DiagnosticsEngine *pDiag, hlsl::DxilShaderHash *pShaderHashOut, AbstractMemoryStream *pReflectionOut, AbstractMemoryStream *pRootSigOut, - CComPtr pRootSigBlob, CComPtr pPrivateBlob, - hlsl::options::ValidatorSelection SelectValidator) + CComPtr pRootSigBlob, CComPtr pPrivateBlob) : pM(std::move(pM)), pOutputContainerBlob(pOutputContainerBlob), pMalloc(pMalloc), SerializeFlags(SerializeFlags), ValidationFlags(ValidationFlags), pModuleBitcode(pModuleBitcode), DebugName(DebugName), pDiag(pDiag), pShaderHashOut(pShaderHashOut), pReflectionOut(pReflectionOut), pRootSigOut(pRootSigOut), - pRootSigBlob(pRootSigBlob), pPrivateBlob(pPrivateBlob), - SelectValidator(SelectValidator) {} + pRootSigBlob(pRootSigBlob), pPrivateBlob(pPrivateBlob) {} -void GetValidatorVersion(unsigned *pMajor, unsigned *pMinor, - hlsl::options::ValidatorSelection SelectValidator) { +void GetValidatorVersion(unsigned *pMajor, unsigned *pMinor) { if (pMajor == nullptr || pMinor == nullptr) return; CComPtr pValidator; - CreateValidator(pValidator, SelectValidator); + CreateValidator(pValidator); CComPtr pVersionInfo; if (SUCCEEDED(pValidator.QueryInterface(&pVersionInfo))) { @@ -177,76 +149,19 @@ HRESULT ValidateAndAssembleToContainer(AssembleInputs &inputs) { std::unique_ptr llvmModuleWithDebugInfo; CComPtr pValidator; - bool bInternalValidator = CreateValidator(pValidator, inputs.SelectValidator); - // Warning on internal Validator - - CComPtr pValidator2; - if (!bInternalValidator) { - pValidator.QueryInterface(&pValidator2); - } - - if (bInternalValidator || pValidator2) { - // If using the internal validator or external validator supports - // IDxcValidator2, we'll use the modules directly. In this case, we'll want - // to make a clone to avoid SerializeDxilContainerForModule stripping all - // the debug info. The debug info will be stripped from the orginal module, - // but preserved in the cloned module. - if (llvm::getDebugMetadataVersionFromModule(*inputs.pM) != 0) { - llvmModuleWithDebugInfo.reset(llvm::CloneModule(inputs.pM.get())); - } - } + CreateValidator(pValidator); - // Verify validator version can validate this module - CComPtr pValidatorVersion; - IFT(pValidator->QueryInterface(&pValidatorVersion)); - UINT32 ValMajor, ValMinor; - IFT(pValidatorVersion->GetVersion(&ValMajor, &ValMinor)); - DxilModule &DM = inputs.pM.get()->GetOrCreateDxilModule(); - unsigned ReqValMajor, ReqValMinor; - DM.GetValidatorVersion(ReqValMajor, ReqValMinor); - if (DXIL::CompareVersions(ValMajor, ValMinor, ReqValMajor, ReqValMinor) < 0) { - // Module is expecting to be validated by a newer validator. - if (inputs.pDiag) { - unsigned diagID = inputs.pDiag->getCustomDiagID( - clang::DiagnosticsEngine::Level::Error, - "The module cannot be validated by the version of the validator " - "currently attached."); - inputs.pDiag->Report(diagID); - } - return E_FAIL; - } + if (llvm::getDebugMetadataVersionFromModule(*inputs.pM) != 0) + llvmModuleWithDebugInfo.reset(llvm::CloneModule(inputs.pM.get())); AssembleToContainer(inputs); CComPtr pValResult; - // Important: in-place edit is required so the blob is reused and thus - // dxil.dll can be released. + // In-place edit to avoid an extra copy inputs.ValidationFlags |= DxcValidatorFlags_InPlaceEdit; - if (bInternalValidator) { - IFT(RunInternalValidator(pValidator, llvmModuleWithDebugInfo.get(), - inputs.pOutputContainerBlob, - inputs.ValidationFlags, &pValResult)); - } else { - if (pValidator2 && llvmModuleWithDebugInfo) { - // If metadata was stripped, re-serialize the input module. - CComPtr pDebugModuleStream; - IFT(CreateMemoryStream(DxcGetThreadMallocNoRef(), &pDebugModuleStream)); - raw_stream_ostream outStream(pDebugModuleStream.p); - WriteBitcodeToFile(llvmModuleWithDebugInfo.get(), outStream, true); - outStream.flush(); - - DxcBuffer debugModule = {}; - debugModule.Ptr = pDebugModuleStream->GetPtr(); - debugModule.Size = pDebugModuleStream->GetPtrSize(); - - IFT(pValidator2->ValidateWithDebug(inputs.pOutputContainerBlob, - inputs.ValidationFlags, &debugModule, - &pValResult)); - } else { - IFT(pValidator->Validate(inputs.pOutputContainerBlob, - inputs.ValidationFlags, &pValResult)); - } - } + IFT(RunInternalValidator(pValidator, llvmModuleWithDebugInfo.get(), + inputs.pOutputContainerBlob, inputs.ValidationFlags, + &pValResult)); IFT(pValResult->GetStatus(&valHR)); if (inputs.pDiag) { if (FAILED(valHR)) { @@ -271,9 +186,8 @@ HRESULT ValidateAndAssembleToContainer(AssembleInputs &inputs) { return valHR; } -HRESULT ValidateRootSignatureInContainer( - IDxcBlob *pRootSigContainer, clang::DiagnosticsEngine *pDiag, - hlsl::options::ValidatorSelection SelectValidator) { +HRESULT ValidateRootSignatureInContainer(IDxcBlob *pRootSigContainer, + clang::DiagnosticsEngine *pDiag) { HRESULT valHR = S_OK; CComPtr pValidator; CComPtr pValResult; diff --git a/tools/clang/tools/dxcompiler/dxcutil.h b/tools/clang/tools/dxcompiler/dxcutil.h index 45b3d4dc1a..8612353561 100644 --- a/tools/clang/tools/dxcompiler/dxcutil.h +++ b/tools/clang/tools/dxcompiler/dxcutil.h @@ -54,9 +54,7 @@ struct AssembleInputs { hlsl::AbstractMemoryStream *pReflectionOut = nullptr, hlsl::AbstractMemoryStream *pRootSigOut = nullptr, CComPtr pRootSigBlob = nullptr, - CComPtr pPrivateBlob = nullptr, - hlsl::options::ValidatorSelection SelectValidator = - hlsl::options::ValidatorSelection::Auto); + CComPtr pPrivateBlob = nullptr); std::unique_ptr pM; CComPtr &pOutputContainerBlob; IDxcVersionInfo *pVersionInfo = nullptr; @@ -71,18 +69,13 @@ struct AssembleInputs { hlsl::AbstractMemoryStream *pRootSigOut = nullptr; CComPtr pRootSigBlob = nullptr; CComPtr pPrivateBlob = nullptr; - hlsl::options::ValidatorSelection SelectValidator = - hlsl::options::ValidatorSelection::Auto; }; HRESULT ValidateAndAssembleToContainer(AssembleInputs &inputs); -HRESULT ValidateRootSignatureInContainer( - IDxcBlob *pRootSigContainer, clang::DiagnosticsEngine *pDiag = nullptr, - hlsl::options::ValidatorSelection SelectValidator = - hlsl::options::ValidatorSelection::Auto); +HRESULT +ValidateRootSignatureInContainer(IDxcBlob *pRootSigContainer, + clang::DiagnosticsEngine *pDiag = nullptr); HRESULT SetRootSignature(hlsl::DxilModule *pModule, CComPtr pSource); -void GetValidatorVersion(unsigned *pMajor, unsigned *pMinor, - hlsl::options::ValidatorSelection SelectValidator = - hlsl::options::ValidatorSelection::Auto); +void GetValidatorVersion(unsigned *pMajor, unsigned *pMinor); void AssembleToContainer(AssembleInputs &inputs); HRESULT Disassemble(IDxcBlob *pProgram, llvm::raw_string_ostream &Stream); void ReadOptsAndValidate(hlsl::options::MainArgs &mainArgs, diff --git a/tools/clang/tools/dxcompiler/dxillib.cpp b/tools/clang/tools/dxcompiler/dxillib.cpp deleted file mode 100644 index 72abc869da..0000000000 --- a/tools/clang/tools/dxcompiler/dxillib.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// // -// dxillib.cpp // -// Copyright (C) Microsoft Corporation. All rights reserved. // -// This file is distributed under the University of Illinois Open Source // -// License. See LICENSE.TXT for details. // -// // -// Provides access to dxil.dll // -// // -/////////////////////////////////////////////////////////////////////////////// - -#include "dxillib.h" -#include "dxc/Support/Global.h" // For DXASSERT -#include "dxc/Support/dxcapi.use.h" -#include "llvm/Support/Mutex.h" - -using namespace dxc; - -static DxcDllSupport g_DllSupport; -static HRESULT g_DllLibResult = S_OK; - -static llvm::sys::Mutex *cs = nullptr; - -// Check if we can successfully get IDxcValidator from dxil.dll -// This function is to prevent multiple attempts to load dxil.dll -HRESULT DxilLibInitialize() { - cs = new llvm::sys::Mutex; - cs->lock(); - g_DllLibResult = g_DllSupport.InitializeForDll(kDxilLib, "DxcCreateInstance"); - cs->unlock(); - return S_OK; -} - -HRESULT DxilLibCleanup(DxilLibCleanUpType type) { - HRESULT hr = S_OK; - if (type == DxilLibCleanUpType::ProcessTermination) { - g_DllSupport.Detach(); - } else if (type == DxilLibCleanUpType::UnloadLibrary) { - g_DllSupport.Cleanup(); - } else { - hr = E_INVALIDARG; - } - delete cs; - cs = nullptr; - return hr; -} - -// g_DllLibResult is S_OK by default, check again to see if dxil.dll is loaded -// If we fail to load dxil.dll, set g_DllLibResult to E_FAIL so that we don't -// have multiple attempts to load dxil.dll -bool DxilLibIsEnabled() { - cs->lock(); - if (SUCCEEDED(g_DllLibResult)) { - if (!g_DllSupport.IsEnabled()) { - g_DllLibResult = - g_DllSupport.InitializeForDll(kDxilLib, "DxcCreateInstance"); - } - } - cs->unlock(); - return SUCCEEDED(g_DllLibResult); -} - -HRESULT DxilLibCreateInstance(REFCLSID rclsid, REFIID riid, - IUnknown **ppInterface) { - DXASSERT_NOMSG(ppInterface != nullptr); - HRESULT hr = E_FAIL; - if (DxilLibIsEnabled()) { - cs->lock(); - hr = g_DllSupport.CreateInstance(rclsid, riid, ppInterface); - cs->unlock(); - } - return hr; -} diff --git a/tools/clang/tools/dxcompiler/dxillib.h b/tools/clang/tools/dxcompiler/dxillib.h deleted file mode 100644 index 879d023459..0000000000 --- a/tools/clang/tools/dxcompiler/dxillib.h +++ /dev/null @@ -1,42 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// // -// dxillib.h // -// Copyright (C) Microsoft Corporation. All rights reserved. // -// This file is distributed under the University of Illinois Open Source // -// License. See LICENSE.TXT for details. // -// // -// Provides wrappers to handle calls to dxil.dll // -// // -/////////////////////////////////////////////////////////////////////////////// - -#pragma once -#ifndef __DXC_DXILLIB__ -#define __DXC_DXILLIB__ - -#include "dxc/Support/WinIncludes.h" -#include "dxc/WinAdapter.h" - -// Initialize Dxil library. -HRESULT DxilLibInitialize(); - -// When dxcompiler is detached from process, -// we should not call FreeLibrary on process termination. -// So the caller has to specify if cleaning is from FreeLibrary or process -// termination -enum class DxilLibCleanUpType { UnloadLibrary, ProcessTermination }; - -HRESULT DxilLibCleanup(DxilLibCleanUpType type); - -// Check if can access dxil.dll -bool DxilLibIsEnabled(); - -HRESULT DxilLibCreateInstance(REFCLSID rclsid, REFIID riid, - IUnknown **ppInterface); - -template -HRESULT DxilLibCreateInstance(REFCLSID rclsid, TInterface **ppInterface) { - return DxilLibCreateInstance(rclsid, __uuidof(TInterface), - (IUnknown **)ppInterface); -} - -#endif // __DXC_DXILLIB__ diff --git a/tools/clang/unittests/HLSLTestLib/FileCheckerTest.cpp b/tools/clang/unittests/HLSLTestLib/FileCheckerTest.cpp index 2c75d45e5e..2d9ee7315d 100644 --- a/tools/clang/unittests/HLSLTestLib/FileCheckerTest.cpp +++ b/tools/clang/unittests/HLSLTestLib/FileCheckerTest.cpp @@ -519,28 +519,21 @@ FileRunCommandPart::RunDxc(dxc::DxcDllSupport &DllSupport, // Convert stage to minimum dxil/validator version: RequiredDxilMajor = std::max(RequiredDxilMajor, (unsigned)6) - 5; - bool bInternalValidator = - opts.SelectValidator == hlsl::options::ValidatorSelection::Internal; bool bValVerExplicit = opts.ValVerMajor != UINT_MAX; - // Normally we must check the validator version as well, but there are - // two scenarios where the validator version doesn't need to be checked - // against the version based on the shader model: - // 1. The test selects internal validator. - // 2. The test explicitly requests a specific validator version. - FileRunCommandResult result = - CheckDxilVer(DllSupport, RequiredDxilMajor, RequiredDxilMinor, - !(bInternalValidator || bValVerExplicit)); + // If validator version set explicitly, skip validator version check when + // checking required version for shader model. + FileRunCommandResult result = CheckDxilVer( + DllSupport, RequiredDxilMajor, RequiredDxilMinor, !bValVerExplicit); if (result.AbortPipeline) return result; // Additionally, if the test explicitly requests a specific non-zero - // validator version, and doesn't select internal validator or disable - // validation, we must check that the validator version is at least as - // high as the requested version. - // When ValVerMajor is 0, validation cannot be run against the module. - if (bValVerExplicit && opts.ValVerMajor != 0 && - !(bInternalValidator || opts.DisableValidation)) + // validator version, and doesn't disable validation, we must check + // that the validator version is at least as high as the requested + // version. When ValVerMajor is 0, validation cannot be run against + // the module. + if (bValVerExplicit && opts.ValVerMajor != 0 && !opts.DisableValidation) result = CheckDxilVer(DllSupport, opts.ValVerMajor, opts.ValVerMinor); if (result.AbortPipeline) return result;