Let ANGLE use multithreaded devices if necessary.
This is needed to prevent lock-ups in application that use ANGLE from multiple threads, as e.g. QtWebEngine based applications do. The environment variable QT_D3DCREATE_MULTITHREADED is used to communicate this from the QtWebEngine module. Change-Id: Ibd5a5c75eb68af567d420d9a35efb3490c93b27c Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>bb10
parent
918038ad57
commit
6b52e6ead9
|
|
@ -56,6 +56,7 @@
|
|||
|
||||
# if defined(ANGLE_ENABLE_D3D11)
|
||||
# include <d3d10_1.h>
|
||||
# include <d3d10.h>
|
||||
# include <d3d11.h>
|
||||
# include <dxgi.h>
|
||||
# include <dxgi1_2.h>
|
||||
|
|
|
|||
|
|
@ -305,6 +305,19 @@ EGLint Renderer11::initialize()
|
|||
mMaxSupportedSamples = std::max(mMaxSupportedSamples, support.maxSupportedSamples);
|
||||
}
|
||||
|
||||
#if !defined(ANGLE_PLATFORM_WINRT)
|
||||
static wchar_t *qt_d3dcreate_multihreaded_var = _wgetenv(L"QT_D3DCREATE_MULTITHREADED");
|
||||
if (qt_d3dcreate_multihreaded_var && wcsstr(qt_d3dcreate_multihreaded_var, L"1"))
|
||||
{
|
||||
ID3D10Multithread *multithread;
|
||||
result = mDevice->QueryInterface(IID_PPV_ARGS(&multithread));
|
||||
ASSERT(SUCCEEDED(result));
|
||||
result = multithread->SetMultithreadProtected(true);
|
||||
ASSERT(SUCCEEDED(result));
|
||||
multithread->Release();
|
||||
}
|
||||
#endif
|
||||
|
||||
initializeDevice();
|
||||
|
||||
return EGL_SUCCESS;
|
||||
|
|
|
|||
|
|
@ -319,6 +319,10 @@ EGLint Renderer9::initialize()
|
|||
D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters();
|
||||
DWORD behaviorFlags = D3DCREATE_FPU_PRESERVE | D3DCREATE_NOWINDOWCHANGES;
|
||||
|
||||
static wchar_t *qt_d3dcreate_multihreaded_var = _wgetenv(L"QT_D3DCREATE_MULTITHREADED");
|
||||
if (qt_d3dcreate_multihreaded_var && wcsstr(qt_d3dcreate_multihreaded_var, L"1"))
|
||||
behaviorFlags |= D3DCREATE_MULTITHREADED;
|
||||
|
||||
{
|
||||
TRACE_EVENT0("gpu", "D3d9_CreateDevice");
|
||||
result = mD3d9->CreateDevice(mAdapter, mDeviceType, mDeviceWindow, behaviorFlags | D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE, &presentParameters, &mDevice);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
From d52fac0c0b5d12cd117ae4b871f0ac6a202755ad Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20Br=C3=BCning?= <michael.bruning@digia.com>
|
||||
Date: Wed, 27 Aug 2014 12:42:00 +0200
|
||||
Subject: [PATCH] Let ANGLE use multithreaded devices if necessary.
|
||||
|
||||
This is needed to prevent lock-ups in application that use ANGLE from
|
||||
multiple threads, as e.g. QtWebEngine based applications do.
|
||||
|
||||
The environment variable QT_D3DCREATE_MULTITHREADED is used to
|
||||
communicate this from the QtWebEngine module.
|
||||
|
||||
Change-Id: Ibd5a5c75eb68af567d420d9a35efb3490c93b27c
|
||||
---
|
||||
src/3rdparty/angle/src/common/platform.h | 1 +
|
||||
.../angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp | 13 +++++++++++++
|
||||
.../angle/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp | 4 ++++
|
||||
3 files changed, 18 insertions(+)
|
||||
|
||||
diff --git a/src/3rdparty/angle/src/common/platform.h b/src/3rdparty/angle/src/common/platform.h
|
||||
index e16e7ac..cedc6f2 100644
|
||||
--- a/src/3rdparty/angle/src/common/platform.h
|
||||
+++ b/src/3rdparty/angle/src/common/platform.h
|
||||
@@ -56,6 +56,7 @@
|
||||
|
||||
# if defined(ANGLE_ENABLE_D3D11)
|
||||
# include <d3d10_1.h>
|
||||
+# include <d3d10.h>
|
||||
# include <d3d11.h>
|
||||
# include <dxgi.h>
|
||||
# include <dxgi1_2.h>
|
||||
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp
|
||||
index 17a13f9..651b065 100644
|
||||
--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp
|
||||
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp
|
||||
@@ -305,6 +305,19 @@ EGLint Renderer11::initialize()
|
||||
mMaxSupportedSamples = std::max(mMaxSupportedSamples, support.maxSupportedSamples);
|
||||
}
|
||||
|
||||
+#if !defined(ANGLE_PLATFORM_WINRT)
|
||||
+ static wchar_t *qt_d3dcreate_multihreaded_var = _wgetenv(L"QT_D3DCREATE_MULTITHREADED");
|
||||
+ if (qt_d3dcreate_multihreaded_var && wcsstr(qt_d3dcreate_multihreaded_var, L"1"))
|
||||
+ {
|
||||
+ ID3D10Multithread *multithread;
|
||||
+ result = mDevice->QueryInterface(IID_PPV_ARGS(&multithread));
|
||||
+ ASSERT(SUCCEEDED(result));
|
||||
+ result = multithread->SetMultithreadProtected(true);
|
||||
+ ASSERT(SUCCEEDED(result));
|
||||
+ multithread->Release();
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
initializeDevice();
|
||||
|
||||
return EGL_SUCCESS;
|
||||
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp
|
||||
index 491c27a..2c8a79f 100644
|
||||
--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp
|
||||
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp
|
||||
@@ -319,6 +319,10 @@ EGLint Renderer9::initialize()
|
||||
D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters();
|
||||
DWORD behaviorFlags = D3DCREATE_FPU_PRESERVE | D3DCREATE_NOWINDOWCHANGES;
|
||||
|
||||
+ static wchar_t *qt_d3dcreate_multihreaded_var = _wgetenv(L"QT_D3DCREATE_MULTITHREADED");
|
||||
+ if (qt_d3dcreate_multihreaded_var && wcsstr(qt_d3dcreate_multihreaded_var, L"1"))
|
||||
+ behaviorFlags |= D3DCREATE_MULTITHREADED;
|
||||
+
|
||||
{
|
||||
TRACE_EVENT0("gpu", "D3d9_CreateDevice");
|
||||
result = mD3d9->CreateDevice(mAdapter, mDeviceType, mDeviceWindow, behaviorFlags | D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE, &presentParameters, &mDevice);
|
||||
--
|
||||
1.8.3.2
|
||||
|
||||
Loading…
Reference in New Issue