D3D: Log GetLastError when compiler load fails.
Also use the non-unicode version of LoadLibrary explicitly.
Bug: chromium:919163
Change-Id: I4841c3eef586ff57563915da12765baaa6e0b146
Reviewed-on: https://chromium-review.googlesource.com/c/1398642
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/d3d/HLSLCompiler.cpp b/src/libANGLE/renderer/d3d/HLSLCompiler.cpp
index 22c01ea..371471e 100644
--- a/src/libANGLE/renderer/d3d/HLSLCompiler.cpp
+++ b/src/libANGLE/renderer/d3d/HLSLCompiler.cpp
@@ -130,14 +130,17 @@
{
// Load the version of the D3DCompiler DLL associated with the Direct3D version ANGLE was
// built with.
- mD3DCompilerModule = LoadLibrary(D3DCOMPILER_DLL);
+ mD3DCompilerModule = LoadLibraryA(D3DCOMPILER_DLL_A);
+
+ if (!mD3DCompilerModule)
+ {
+ DWORD lastError = GetLastError();
+ ERR() << "LoadLibrary(" << D3DCOMPILER_DLL_A << ") failed. GetLastError=" << lastError;
+ ANGLE_TRY_HR(context, E_OUTOFMEMORY, "LoadLibrary failed to load D3D Compiler DLL.");
+ }
}
- if (!mD3DCompilerModule)
- {
- ERR() << "D3D compiler module not found.";
- ANGLE_TRY_HR(context, E_OUTOFMEMORY, "D3D compiler module not found.");
- }
+ ASSERT(mD3DCompilerModule);
mD3DCompileFunc =
reinterpret_cast<pD3DCompile>(GetProcAddress(mD3DCompilerModule, "D3DCompile"));