diff options
Diffstat (limited to 'src/angle')
-rw-r--r-- | src/angle/patches/0015-ANGLE-Don-t-export-DLLMain-functions-for-static-buil.patch | 63 | ||||
-rw-r--r-- | src/angle/src/d3dcompiler/d3dcompiler.pro | 5 | ||||
-rw-r--r-- | src/angle/src/d3dcompiler/main.cpp | 71 |
3 files changed, 116 insertions, 23 deletions
diff --git a/src/angle/patches/0015-ANGLE-Don-t-export-DLLMain-functions-for-static-buil.patch b/src/angle/patches/0015-ANGLE-Don-t-export-DLLMain-functions-for-static-buil.patch new file mode 100644 index 0000000000..0341da289a --- /dev/null +++ b/src/angle/patches/0015-ANGLE-Don-t-export-DLLMain-functions-for-static-buil.patch @@ -0,0 +1,63 @@ +From 6545677945d24854007d39fed86d4e44900b5c1a Mon Sep 17 00:00:00 2001 +From: Andrew Knight <andrew.knight@digia.com> +Date: Thu, 27 Mar 2014 15:36:52 +0200 +Subject: [PATCH] ANGLE: Don't export DLLMain functions for static builds + +These ifdef guards were originally a part of +"0004-Make-it-possible-to-link-ANGLE-statically-for-single.patch", +but were lost during the last ANGLE upgrade. + +Task-number: QTBUG-37842 +Change-Id: I4340c1641675dd310c14454a851eb4bc0ae2ec0d +--- + src/3rdparty/angle/src/libEGL/main.cpp | 4 ++++ + src/3rdparty/angle/src/libGLESv2/main.cpp | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/src/3rdparty/angle/src/libEGL/main.cpp b/src/3rdparty/angle/src/libEGL/main.cpp +index e972691..4cdf5f0 100644 +--- a/src/3rdparty/angle/src/libEGL/main.cpp ++++ b/src/3rdparty/angle/src/libEGL/main.cpp +@@ -69,6 +69,8 @@ void DeallocateCurrent() + + } + ++#ifndef QT_OPENGL_ES_2_ANGLE_STATIC ++ + extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) + { + switch (reason) +@@ -124,6 +126,8 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved + return TRUE; + } + ++#endif // !QT_OPENGL_ES_2_ANGLE_STATIC ++ + namespace egl + { + +diff --git a/src/3rdparty/angle/src/libGLESv2/main.cpp b/src/3rdparty/angle/src/libGLESv2/main.cpp +index 95f4b8d..e527994 100644 +--- a/src/3rdparty/angle/src/libGLESv2/main.cpp ++++ b/src/3rdparty/angle/src/libGLESv2/main.cpp +@@ -66,6 +66,8 @@ void DeallocateCurrent() + + } + ++#ifndef QT_OPENGL_ES_2_ANGLE_STATIC ++ + extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) + { + switch (reason) +@@ -107,6 +109,8 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved + return TRUE; + } + ++#endif // !QT_OPENGL_ES_2_ANGLE_STATIC ++ + namespace gl + { + +-- +1.8.4.msysgit.0 + 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..63ee1cf976 100644 --- a/src/angle/src/d3dcompiler/main.cpp +++ b/src/angle/src/d3dcompiler/main.cpp @@ -52,6 +52,12 @@ #include <qt_windows.h> #include <d3dcommon.h> +#ifdef D3DCOMPILER_LINKED +namespace D3D { +# include <d3dcompiler.h> +} +#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); } @@ -190,9 +199,19 @@ HRESULT WINAPI D3DCompile( } static bool initialized = false; - static QString binaryPath; + static QStringList binaryPaths; static QString sourcePath; if (!initialized) { + // Precompiled directory + QString precompiledPath; + if (qEnvironmentVariableIsSet("QT_D3DCOMPILER_BINARY_DIR")) + precompiledPath = QString::fromLocal8Bit(qgetenv("QT_D3DCOMPILER_BINARY_DIR")); + else + precompiledPath = QStringLiteral(":/qt.d3dcompiler"); // Default QRC path + if (QDir(precompiledPath).exists()) + binaryPaths.append(precompiledPath); + + // Service directory QString base; if (qEnvironmentVariableIsSet("QT_D3DCOMPILER_DIR")) base = QString::fromLocal8Bit(qgetenv("QT_D3DCOMPILER_DIR")); @@ -203,28 +222,33 @@ HRESULT WINAPI D3DCompile( base = location + QStringLiteral("/d3dcompiler"); } - // Unless the service has run, this directory won't exist. + // Create the directory structure QDir baseDir(base); - if (baseDir.exists()) { - // Check if we have can read/write blobs - if (baseDir.exists(QStringLiteral("binary"))) { - binaryPath = baseDir.absoluteFilePath(QStringLiteral("binary/")); - } else { - qCWarning(QT_D3DCOMPILER) << "D3D compiler base directory exists, but the binary directory does not.\n" - "Check the compiler service."; + if (!baseDir.exists()) { + baseDir.cdUp(); + if (!baseDir.mkdir(QStringLiteral("d3dcompiler"))) { + qCWarning(QT_D3DCOMPILER) << "Unable to create shader base directory:" + << QDir::toNativeSeparators(baseDir.absolutePath()); + if (binaryPaths.isEmpty()) // No possibility to get a shader, abort + return E_FAIL; } + baseDir.cd(QStringLiteral("d3dcompiler")); + } - // Check if we can write shader source - if (baseDir.exists(QStringLiteral("source"))) { - sourcePath = baseDir.absoluteFilePath(QStringLiteral("source/")); - } else { - qCWarning(QT_D3DCOMPILER) << "D3D compiler base directory exists, but the source directory does not.\n" - "Check the compiler service."; - } + if (!baseDir.exists(QStringLiteral("binary")) && !baseDir.mkdir(QStringLiteral("binary"))) { + qCWarning(QT_D3DCOMPILER) << "Unable to create shader binary directory:" + << QDir::toNativeSeparators(baseDir.absoluteFilePath(QStringLiteral("binary"))); + if (binaryPaths.isEmpty()) // No possibility to get a shader, abort + return E_FAIL; + } else { + binaryPaths.append(baseDir.absoluteFilePath(QStringLiteral("binary/"))); + } + + if (!baseDir.exists(QStringLiteral("source")) && !baseDir.mkdir(QStringLiteral("source"))) { + qCWarning(QT_D3DCOMPILER) << "Unable to create shader source directory:" + << QDir::toNativeSeparators(baseDir.absoluteFilePath(QStringLiteral("source"))); } else { - qCWarning(QT_D3DCOMPILER) << "D3D compiler base directory does not exist:" - << QDir::toNativeSeparators(base) - << "\nCheck that the compiler service is running."; + sourcePath = baseDir.absoluteFilePath(QStringLiteral("source/")); } initialized = true; @@ -245,8 +269,8 @@ HRESULT WINAPI D3DCompile( + QLatin1Char('!') + QString::number(sflags); // Check if pre-compiled shader blob is available - if (!binaryPath.isEmpty()) { - QString blobName = binaryPath + fileName; + foreach (const QString &path, binaryPaths) { + QString blobName = path + fileName; QFile blob(blobName); while (!blob.exists()) { // Progressively drop optional parts @@ -262,6 +286,7 @@ HRESULT WINAPI D3DCompile( return S_FALSE; } qCDebug(QT_D3DCOMPILER) << "Found, but unable to open, precompiled shader blob at" << blob.fileName(); + break; } } @@ -284,7 +309,7 @@ HRESULT WINAPI D3DCompile( QElapsedTimer timer; timer.start(); - QFile blob(binaryPath + fileName); + QFile blob(binaryPaths.last() + fileName); while (!(blob.exists() && blob.open(QFile::ReadOnly)) && timer.elapsed() < timeout) QThread::msleep(100); |