@@ -135,9 +135,9 @@ class DxcDllSupport {
135135
136136 bool virtual HasCreateWithMalloc () const { return m_createFn2 != nullptr ; }
137137
138- bool virtual IsEnabled () const { return m_dll != nullptr ; }
138+ bool IsEnabled () const { return m_dll != nullptr ; }
139139
140- bool virtual GetCreateInstanceProcs (DxcCreateInstanceProc *pCreateFn,
140+ bool GetCreateInstanceProcs (DxcCreateInstanceProc *pCreateFn,
141141 DxcCreateInstance2Proc *pCreateFn2) const {
142142 if (pCreateFn == nullptr || pCreateFn2 == nullptr ||
143143 m_createFn == nullptr )
@@ -193,64 +193,6 @@ void WriteOperationErrorsToConsole(IDxcOperationResult *pResult,
193193void WriteOperationResultToConsole (IDxcOperationResult *pRewriteResult,
194194 bool outputWarnings);
195195
196- class DxcDllExtValidationSupport : public DxcDllSupport {
197- // DxcDllExtValidationSupport manages the
198- // lifetime of dxcompiler.dll, while the member, m_DxilSupport,
199- // manages the lifetime of dxil.dll
200- DxcDllSupport *m_DxilSupport = nullptr ;
201-
202- std::string DxilDLLPathExt = " " ;
203- bool ExternalDxilDLLInitializationSuccess = false ;
204- // override DxcDllSupport's implementation of InitializeInternal,
205- // adding the environment variable value check for a path to a dxil.dll
206- // for external validation
207- HRESULT InitializeInternal (LPCSTR dllName, LPCSTR fnName){
208-
209- // Load dxcompiler.dll
210- HRESULT result = InitializeForDll (dllName, fnName);
211- // if dxcompiler.dll fails to load, then we won't try loading dxil.dll,
212- // so set this boolean to false.
213- ExternalDxilDLLInitializationSuccess = DXC_FAILED (result) ? false : true ;
214- if (!ExternalDxilDLLInitializationSuccess) {
215- return result;
216- }
217-
218- // now handle external dxil.dll
219- const char *envVal = std::getenv (" DXC_DXIL_DLL_PATH" );
220- bool ValidateInternally = false ;
221- if (!envVal || std::string (envVal).empty ()) {
222- ValidateInternally = true ;
223- }
224-
225- if (!ValidateInternally){
226- std::string DllPathStr (envVal);
227- DxilDLLPathExt = DllPathStr;
228- std::filesystem::path DllPath (DllPathStr);
229-
230- // Check if path is absolute and exists
231- if (!DllPath.is_absolute () || !std::filesystem::exists (DllPath)) {
232- ExternalDxilDLLInitializationSuccess = false ;
233- // TODO: Ideally emit some diagnostic that the given absolute path doesn't exist
234- return HRESULT_FROM_WIN32 (GetLastError ());
235- }
236- result = m_DxilSupport->InitializeForDll (DllPathStr.data (), fnName);
237- if (DXC_FAILED (result)) {
238- ExternalDxilDLLInitializationSuccess = false ;
239- return result;
240- }
241- ExternalDxilDLLInitializationSuccess = true ;
242- } else {
243- // nothing to do if we are validating internally, dxcompiler.dll
244- // is loaded and it'll take care of validation.
245- // No external dxil.dll will be loaded in this case
246- ExternalDxilDLLInitializationSuccess = false ;
247- }
248- return S_OK;
249- }
250-
251- std::string GetDxilDLLPathExt () { return DxilDLLPathExt; }
252-
253- };
254196} // namespace dxc
255197
256198#endif
0 commit comments