Skip to content

Commit 75f968d

Browse files
committed
attempt 2
1 parent 036d502 commit 75f968d

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

include/dxc/Support/dxcapi.use.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,7 @@ class DxcDllSupport {
3636
m_dll = LoadLibraryA(dllName);
3737
if (m_dll == nullptr)
3838
return HRESULT_FROM_WIN32(GetLastError());
39-
// load dxil.dll too
40-
HMODULE dxildllModule =
41-
LoadLibraryA(DxilDLLPath == "" ? "dxil.dll" : GetDxilDLLPath());
42-
if (dxildllModule == nullptr) {
43-
return HRESULT_FROM_WIN32(GetLastError());
44-
}
39+
4540
m_createFn = (DxcCreateInstanceProc)GetProcAddress(m_dll, fnName);
4641

4742
if (m_createFn == nullptr) {

lib/DxcSupport/dxcapi.use.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ void IFT_Data(HRESULT hr, LPCWSTR data) {
7575

7676
void EnsureEnabled(DxcDllSupport &dxcSupport) {
7777
if (!dxcSupport.IsEnabled()) {
78-
// first initialize Dxil.dll
7978
IFT(dxcSupport.Initialize());
8079
}
8180
}

tools/clang/tools/dxclib/dxc.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ int dxc::main(int argc, const char **argv_) {
14481448
SetUnhandledExceptionFilter(ExceptionFilter);
14491449
#endif
14501450

1451-
// Setup a helper DLL.
1451+
// Setup dxcompiler DLL.
14521452
{
14531453
std::string dllErrorString;
14541454
llvm::raw_string_ostream dllErrorStream(dllErrorString);
@@ -1462,6 +1462,7 @@ int dxc::main(int argc, const char **argv_) {
14621462
}
14631463

14641464
EnsureEnabled(dxcSupport);
1465+
14651466
DxcContext context(dxcOpts, dxcSupport);
14661467
// Handle help request, which overrides any other processing.
14671468
if (dxcOpts.ShowHelp) {

tools/clang/tools/dxcompiler/dxcutil.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ bool CreateValidator(CComPtr<IDxcValidator> &pValidator,
6262
// otherwise, use the external validator provided by the dxil_dll_path
6363
// argument
6464
else {
65-
// if a valid absolute path was given, but the DXIL.dll
66-
// is invalid, then error
65+
// this code loads the dll path on an as-needed basis.
66+
// if a request to initialize the dxil lib arrives more than once
67+
// then DxilLibInitialize does nothing.
68+
IFT(DxilLibInitialize(DxilDLLPath));
6769
IFTBOOL(DxilLibIsEnabled(DxilDLLPath), DXC_E_VALIDATOR_MISSING);
6870
IFT(DxilLibCreateInstance(CLSID_DxcValidator, &pValidator));
6971

0 commit comments

Comments
 (0)