diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-04-22 09:04:29 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-04-22 09:25:54 +0200 |
commit | aed5a7168354c6ae47687d20b4bd3f0adcc14f8e (patch) | |
tree | d2060479a7c12fdba8c1955e5d363754feffabb8 /src/3rdparty/angle/src/libEGL/main.cpp | |
parent | d3d10cf23d61f4a011f1a7e9abdee1a92717e80f (diff) | |
parent | 628fa13ea4d6ff0e2e2ee76c9adfc78676de3c59 (diff) |
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
src/corelib/statemachine/qstatemachine.cpp
src/corelib/statemachine/qstatemachine_p.h
src/gui/painting/qdrawhelper.cpp
src/plugins/platforms/xcb/qxcbnativeinterface.cpp
src/plugins/platforms/xcb/qxcbwindow.cpp
src/plugins/platforms/xcb/qxcbwindow.h
src/testlib/qtestblacklist.cpp
src/tools/qdoc/node.cpp
src/tools/qdoc/node.h
tests/auto/gui/painting/qcolor/tst_qcolor.cpp
Change-Id: I6c78b7b162001712d5774293f501b06b4ff32684
Diffstat (limited to 'src/3rdparty/angle/src/libEGL/main.cpp')
-rw-r--r-- | src/3rdparty/angle/src/libEGL/main.cpp | 203 |
1 files changed, 0 insertions, 203 deletions
diff --git a/src/3rdparty/angle/src/libEGL/main.cpp b/src/3rdparty/angle/src/libEGL/main.cpp deleted file mode 100644 index e88cad775f..0000000000 --- a/src/3rdparty/angle/src/libEGL/main.cpp +++ /dev/null @@ -1,203 +0,0 @@ -// -// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// - -// main.cpp: DLL entry point and management of thread-local data. - -#include "libEGL/main.h" - -#include "common/debug.h" -#include "common/tls.h" - -static TLSIndex currentTLS = TLS_OUT_OF_INDEXES; - -namespace egl -{ - -Current *AllocateCurrent() -{ - ASSERT(currentTLS != TLS_OUT_OF_INDEXES); - if (currentTLS == TLS_OUT_OF_INDEXES) - { - return NULL; - } - - Current *current = new Current(); - current->error = EGL_SUCCESS; - current->API = EGL_OPENGL_ES_API; - current->display = EGL_NO_DISPLAY; - current->drawSurface = EGL_NO_SURFACE; - current->readSurface = EGL_NO_SURFACE; - - if (!SetTLSValue(currentTLS, current)) - { - ERR("Could not set thread local storage."); - return NULL; - } - - return current; -} - -void DeallocateCurrent() -{ - Current *current = reinterpret_cast<Current*>(GetTLSValue(currentTLS)); - SafeDelete(current); - SetTLSValue(currentTLS, NULL); -} - -} - -#ifndef QT_OPENGL_ES_2_ANGLE_STATIC - -extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) -{ - switch (reason) - { - case DLL_PROCESS_ATTACH: - { -#if defined(ANGLE_ENABLE_DEBUG_TRACE) - FILE *debug = fopen(TRACE_OUTPUT_FILE, "rt"); - - if (debug) - { - fclose(debug); - debug = fopen(TRACE_OUTPUT_FILE, "wt"); // Erase - - if (debug) - { - fclose(debug); - } - } -#endif - - currentTLS = CreateTLSIndex(); - if (currentTLS == TLS_OUT_OF_INDEXES) - { - return FALSE; - } - -#ifdef ANGLE_ENABLE_DEBUG_ANNOTATIONS - gl::InitializeDebugAnnotations(); -#endif - } - // Fall through to initialize index - case DLL_THREAD_ATTACH: - { - egl::AllocateCurrent(); - } - break; - case DLL_THREAD_DETACH: - { - egl::DeallocateCurrent(); - } - break; - case DLL_PROCESS_DETACH: - { - egl::DeallocateCurrent(); - DestroyTLSIndex(currentTLS); - -#ifdef ANGLE_ENABLE_DEBUG_ANNOTATIONS - gl::UninitializeDebugAnnotations(); -#endif - } - break; - default: - break; - } - - return TRUE; -} - -#endif // !QT_OPENGL_ES_2_ANGLE_STATIC - -namespace egl -{ - -Current *GetCurrentData() -{ -#ifndef QT_OPENGL_ES_2_ANGLE_STATIC - Current *current = reinterpret_cast<Current*>(GetTLSValue(currentTLS)); - - // ANGLE issue 488: when the dll is loaded after thread initialization, - // thread local storage (current) might not exist yet. - return (current ? current : AllocateCurrent()); -#else - // No precautions for thread safety taken as ANGLE is used single-threaded in Qt. - static Current current = { EGL_SUCCESS, EGL_OPENGL_ES_API, EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE }; - return ¤t; -#endif -} - -void recordError(const Error &error) -{ - Current *current = GetCurrentData(); - - current->error = error.getCode(); -} - -EGLint getCurrentError() -{ - Current *current = GetCurrentData(); - - return current->error; -} - -void setCurrentAPI(EGLenum API) -{ - Current *current = GetCurrentData(); - - current->API = API; -} - -EGLenum getCurrentAPI() -{ - Current *current = GetCurrentData(); - - return current->API; -} - -void setCurrentDisplay(EGLDisplay dpy) -{ - Current *current = GetCurrentData(); - - current->display = dpy; -} - -EGLDisplay getCurrentDisplay() -{ - Current *current = GetCurrentData(); - - return current->display; -} - -void setCurrentDrawSurface(EGLSurface surface) -{ - Current *current = GetCurrentData(); - - current->drawSurface = surface; -} - -EGLSurface getCurrentDrawSurface() -{ - Current *current = GetCurrentData(); - - return current->drawSurface; -} - -void setCurrentReadSurface(EGLSurface surface) -{ - Current *current = GetCurrentData(); - - current->readSurface = surface; -} - -EGLSurface getCurrentReadSurface() -{ - Current *current = GetCurrentData(); - - return current->readSurface; -} - -} |