From 0ddf86236e1922811a6147ba9b4aa1d59863b785 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Wed, 26 Mar 2014 14:15:08 +0200 Subject: d3dcompiler_qt: Directly link the d3dcompiler DLL on WinRT 8.1 The compiler DLL is a system module starting with Windows 8.1, so directly link to it instead of expecting a packaged DLL. This makes shader precompilation completely optional on this platform. Change-Id: I46cd175ac32e4909a518a059721241b1d6e7be17 Reviewed-by: Maurice Kalinowski --- src/angle/src/d3dcompiler/d3dcompiler.pro | 5 +++++ src/angle/src/d3dcompiler/main.cpp | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/angle/src/d3dcompiler/d3dcompiler.pro b/src/angle/src/d3dcompiler/d3dcompiler.pro index 5a10187279..4d22080185 100644 --- a/src/angle/src/d3dcompiler/d3dcompiler.pro +++ b/src/angle/src/d3dcompiler/d3dcompiler.pro @@ -9,6 +9,11 @@ DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII SOURCES += main.cpp win32:!winrt: LIBS += -lole32 +winrt:equals(WINSDK_VER, 8.1) { + DEFINES += D3DCOMPILER_LINKED + LIBS += -ld3dcompiler +} + # __stdcall exports get mangled, so use a def file DEF_FILE += $${TARGET}.def diff --git a/src/angle/src/d3dcompiler/main.cpp b/src/angle/src/d3dcompiler/main.cpp index 7742596226..47f80af7d3 100644 --- a/src/angle/src/d3dcompiler/main.cpp +++ b/src/angle/src/d3dcompiler/main.cpp @@ -52,6 +52,12 @@ #include #include +#ifdef D3DCOMPILER_LINKED +namespace D3D { +# include +} +#endif // D3DCOMPILER_LINKED + Q_LOGGING_CATEGORY(QT_D3DCOMPILER, "qt.angle.d3dcompiler") namespace D3DCompiler { @@ -127,6 +133,7 @@ private: static bool loadCompiler() { +#ifndef D3DCOMPILER_LINKED static HMODULE d3dcompiler = 0; if (!d3dcompiler) { const wchar_t *dllNames[] = { @@ -157,7 +164,9 @@ static bool loadCompiler() if (!d3dcompiler) qCDebug(QT_D3DCOMPILER) << "Unable to load D3D shader compiler."; } - +#else // !D3DCOMPILER_LINKED + compile = &D3D::D3DCompile; +#endif // D3DCOMPILER_LINKED return bool(compile); } -- cgit v1.2.3