From bbb62a69dd2b49d7cc4214937077c22b6997ffac Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Fri, 27 Mar 2015 17:27:38 +0200 Subject: [PATCH 4/5] ANGLE: Dynamically load D3D compiler from a list If the default compiler cannot be found, load it from a list of DLL names, including a non-versioned proxy DLL provided by Qt. On Desktop Windows, the default compiler can also be specified by an environment variable, QT_D3DCOMPILER_DLL. Change-Id: I0d7a8a8a36cc571836f8fa59ea14513b9b19c19b --- .../src/libANGLE/renderer/d3d/HLSLCompiler.cpp | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/HLSLCompiler.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/HLSLCompiler.cpp index 9c72d6f..8961a36 100644 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/HLSLCompiler.cpp +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/HLSLCompiler.cpp @@ -12,6 +12,10 @@ #include "third_party/trace_event/trace_event.h" +#ifndef QT_D3DCOMPILER_DLL +#define QT_D3DCOMPILER_DLL D3DCOMPILER_DLL +#endif + // Definitions local to the translation unit namespace { @@ -143,6 +147,27 @@ bool HLSLCompiler::initialize() } #endif // ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES + // Load the compiler DLL specified by the environment, or default to QT_D3DCOMPILER_DLL + const wchar_t *defaultCompiler = _wgetenv(L"QT_D3DCOMPILER_DLL"); + if (!defaultCompiler) + defaultCompiler = QT_D3DCOMPILER_DLL; + + const wchar_t *compilerDlls[] = { + defaultCompiler, + L"d3dcompiler_47.dll", + L"d3dcompiler_46.dll", + L"d3dcompiler_43.dll", + 0 + }; + + // Load the first available known compiler DLL + for (int i = 0; compilerDlls[i]; ++i) + { + mD3DCompilerModule = LoadLibrary(compilerDlls[i]); + if (mD3DCompilerModule) + break; + } + if (!mD3DCompilerModule) { // Load the version of the D3DCompiler DLL associated with the Direct3D version ANGLE was built with. -- 2.1.4