summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/libGLESv2/main.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-02-14 09:43:16 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-25 10:34:11 +0100
commita8fce5d6e2cfc4971ca932a18e38662de3482cbc (patch)
tree3786c32f963529251c36b36fe1a9ae4ea0f31ee3 /src/3rdparty/angle/src/libGLESv2/main.cpp
parent7686b2386d60c17aa70c621fe94afc646314e6ac (diff)
ANGLE: Fix static build.
Introduce QT_OPENGL_ES_2_ANGLE_STATIC define for static builds and modify export accordingly. Provided static instances of gl::Current and egl::Current for Qt's single threaded use. Task-number: QTBUG-28196 Change-Id: Ia75699d6da103fb8dd9d5fe97c1ee51e48a74406 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'src/3rdparty/angle/src/libGLESv2/main.cpp')
-rw-r--r--src/3rdparty/angle/src/libGLESv2/main.cpp32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/3rdparty/angle/src/libGLESv2/main.cpp b/src/3rdparty/angle/src/libGLESv2/main.cpp
index 6e678c2616..3853e41c23 100644
--- a/src/3rdparty/angle/src/libGLESv2/main.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/main.cpp
@@ -14,6 +14,8 @@
#include "libGLESv2/Framebuffer.h"
+#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
+
static DWORD currentTLS = TLS_OUT_OF_INDEXES;
extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
@@ -72,14 +74,30 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
return TRUE;
}
+static gl::Current *current()
+{
+ return (gl::Current*)TlsGetValue(currentTLS);
+}
+
+#else // !QT_OPENGL_ES_2_ANGLE_STATIC
+
+static inline gl::Current *current()
+{
+ // No precautions for thread safety taken as ANGLE is used single-threaded in Qt.
+ static gl::Current curr = { 0, 0 };
+ return &curr;
+}
+
+#endif // QT_OPENGL_ES_2_ANGLE_STATIC
+
namespace gl
{
void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface)
{
- Current *current = (Current*)TlsGetValue(currentTLS);
+ Current *curr = current();
- current->context = context;
- current->display = display;
+ curr->context = context;
+ curr->display = display;
if (context && display && surface)
{
@@ -89,9 +107,7 @@ void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface)
Context *getContext()
{
- Current *current = (Current*)TlsGetValue(currentTLS);
-
- return current->context;
+ return current()->context;
}
Context *getNonLostContext()
@@ -115,9 +131,7 @@ Context *getNonLostContext()
egl::Display *getDisplay()
{
- Current *current = (Current*)TlsGetValue(currentTLS);
-
- return current->display;
+ return current()->display;
}
IDirect3DDevice9 *getDevice()