diff options
Diffstat (limited to 'src/3rdparty/angle/src/libEGL')
-rw-r--r-- | src/3rdparty/angle/src/libEGL/Display.cpp | 11 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/Display.h | 5 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/Surface.cpp | 41 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/Surface.h | 3 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/libEGL.cpp | 12 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/libEGL.rc | 11 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/main.cpp | 135 |
7 files changed, 118 insertions, 100 deletions
diff --git a/src/3rdparty/angle/src/libEGL/Display.cpp b/src/3rdparty/angle/src/libEGL/Display.cpp index b18a876a55..e75a4b6440 100644 --- a/src/3rdparty/angle/src/libEGL/Display.cpp +++ b/src/3rdparty/angle/src/libEGL/Display.cpp @@ -1,3 +1,4 @@ +#include "../libGLESv2/precompiled.h" // // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -40,13 +41,13 @@ egl::Display *Display::getDisplay(EGLNativeDisplayType displayId) // FIXME: Check if displayId is a valid display device context - egl::Display *display = new egl::Display(displayId, (HDC)displayId); + egl::Display *display = new egl::Display(displayId); displays[displayId] = display; return display; } -Display::Display(EGLNativeDisplayType displayId, HDC deviceContext) : mDc(deviceContext) +Display::Display(EGLNativeDisplayType displayId) { mDisplayId = displayId; mRenderer = NULL; @@ -71,7 +72,7 @@ bool Display::initialize() return true; } - mRenderer = glCreateRenderer(this, mDc, mDisplayId); + mRenderer = glCreateRenderer(this, mDisplayId); if (!mRenderer) { @@ -486,7 +487,7 @@ void Display::initExtensionString() mExtensionString += "EGL_ANGLE_query_surface_pointer "; -#if !defined(ANGLE_OS_WINRT) +#if defined(ANGLE_ENABLE_D3D9) HMODULE swiftShader = GetModuleHandle(TEXT("swiftshader_d3d9.dll")); if (swiftShader) { @@ -525,7 +526,7 @@ void Display::initVendorString() if (mRenderer && mRenderer->getLUID(&adapterLuid)) { char adapterLuidString[64]; - snprintf(adapterLuidString, sizeof(adapterLuidString), " (adapter LUID: %08l%08l)", adapterLuid.HighPart, adapterLuid.LowPart); + snprintf(adapterLuidString, sizeof(adapterLuidString), " (adapter LUID: %08x%08x)", adapterLuid.HighPart, adapterLuid.LowPart); mVendorString += adapterLuidString; } diff --git a/src/3rdparty/angle/src/libEGL/Display.h b/src/3rdparty/angle/src/libEGL/Display.h index 5d55410440..cd07bb3388 100644 --- a/src/3rdparty/angle/src/libEGL/Display.h +++ b/src/3rdparty/angle/src/libEGL/Display.h @@ -11,8 +11,6 @@ #ifndef LIBEGL_DISPLAY_H_ #define LIBEGL_DISPLAY_H_ -#include "common/system.h" - #include <set> #include <vector> @@ -65,12 +63,11 @@ class Display private: DISALLOW_COPY_AND_ASSIGN(Display); - Display(EGLNativeDisplayType displayId, HDC deviceContext); + Display(EGLNativeDisplayType displayId); bool restoreLostDevice(); EGLNativeDisplayType mDisplayId; - const HDC mDc; bool mSoftwareDevice; diff --git a/src/3rdparty/angle/src/libEGL/Surface.cpp b/src/3rdparty/angle/src/libEGL/Surface.cpp index dbff159d0e..3443355c07 100644 --- a/src/3rdparty/angle/src/libEGL/Surface.cpp +++ b/src/3rdparty/angle/src/libEGL/Surface.cpp @@ -1,3 +1,4 @@ +#include "../libGLESv2/precompiled.h" // // 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 @@ -10,6 +11,8 @@ #include <tchar.h> +#include <algorithm> + #include "libEGL/Surface.h" #include "common/debug.h" @@ -20,8 +23,6 @@ #include "libEGL/main.h" #include "libEGL/Display.h" -#include <algorithm> - #if defined(ANGLE_OS_WINRT) #include <windows.foundation.h> #include <windows.ui.core.h> @@ -118,12 +119,9 @@ bool Surface::resetSwapChain() #else ABI::Windows::Foundation::Rect windowRect; ABI::Windows::UI::Core::ICoreWindow *window; - HRESULT result = mWindow->QueryInterface(IID_PPV_ARGS(&window)); - if (FAILED(result)) - { - ASSERT(false); + HRESULT hr = mWindow->QueryInterface(IID_PPV_ARGS(&window)); + if (FAILED(hr)) return false; - } window->get_Bounds(&windowRect); width = windowRect.Width; height = windowRect.Height; @@ -156,16 +154,9 @@ bool Surface::resetSwapChain() bool Surface::resizeSwapChain(int backbufferWidth, int backbufferHeight) { + ASSERT(backbufferWidth >= 0 && backbufferHeight >= 0); ASSERT(mSwapChain); - // Prevent bad swap chain resize by calling reset if size is invalid - if (backbufferWidth < 1 || backbufferHeight < 1) - { - mWidth = backbufferWidth; - mHeight = backbufferHeight; - return mSwapChain->reset(0, 0, mSwapInterval) == EGL_SUCCESS; - } - EGLint status = mSwapChain->resize(backbufferWidth, backbufferHeight); if (status == EGL_CONTEXT_LOST) @@ -347,18 +338,26 @@ bool Surface::checkForOutOfDateSwapChain() #else ABI::Windows::Foundation::Rect windowRect; ABI::Windows::UI::Core::ICoreWindow *window; - HRESULT result = mWindow->QueryInterface(IID_PPV_ARGS(&window)); - if (FAILED(result)) - { - ASSERT(false); + HRESULT hr = mWindow->QueryInterface(IID_PPV_ARGS(&window)); + if (FAILED(hr)) return false; - } window->get_Bounds(&windowRect); int clientWidth = windowRect.Width; int clientHeight = windowRect.Height; #endif bool sizeDirty = clientWidth != getWidth() || clientHeight != getHeight(); +#if !defined(ANGLE_OS_WINRT) + if (IsIconic(getWindowHandle())) + { + // The window is automatically resized to 150x22 when it's minimized, but the swapchain shouldn't be resized + // because that's not a useful size to render to. + sizeDirty = false; + } +#endif + + bool wasDirty = (mSwapIntervalDirty || sizeDirty); + if (mSwapIntervalDirty) { resetSwapChain(clientWidth, clientHeight); @@ -368,7 +367,7 @@ bool Surface::checkForOutOfDateSwapChain() resizeSwapChain(clientWidth, clientHeight); } - if (mSwapIntervalDirty || sizeDirty) + if (wasDirty) { if (static_cast<egl::Surface*>(getCurrentDrawSurface()) == this) { diff --git a/src/3rdparty/angle/src/libEGL/Surface.h b/src/3rdparty/angle/src/libEGL/Surface.h index ae9a380858..1d2303c6eb 100644 --- a/src/3rdparty/angle/src/libEGL/Surface.h +++ b/src/3rdparty/angle/src/libEGL/Surface.h @@ -15,7 +15,6 @@ #include <EGL/egl.h> #include "common/angleutils.h" -#include "windows.h" namespace gl { @@ -80,7 +79,7 @@ private: bool resetSwapChain(int backbufferWidth, int backbufferHeight); bool swapRect(EGLint x, EGLint y, EGLint width, EGLint height); - const EGLNativeWindowType mWindow; // Window that the surface is created for. + const EGLNativeWindowType mWindow; // Window that the surface is created for. bool mWindowSubclassed; // Indicates whether we successfully subclassed mWindow for WM_RESIZE hooking const egl::Config *mConfig; // EGL config surface was created with EGLint mHeight; // Height of surface diff --git a/src/3rdparty/angle/src/libEGL/libEGL.cpp b/src/3rdparty/angle/src/libEGL/libEGL.cpp index 5bcb5d5959..b2944d5c0d 100644 --- a/src/3rdparty/angle/src/libEGL/libEGL.cpp +++ b/src/3rdparty/angle/src/libEGL/libEGL.cpp @@ -184,7 +184,7 @@ const char *__stdcall eglQueryString(EGLDisplay dpy, EGLint name) case EGL_VENDOR: return egl::success(display->getVendorString()); case EGL_VERSION: - return egl::success("1.4 (ANGLE " VERSION_STRING ")"); + return egl::success("1.4 (ANGLE " ANGLE_VERSION_STRING ")"); } return egl::error(EGL_BAD_PARAMETER, (const char*)NULL); @@ -821,13 +821,21 @@ EGLContext __stdcall eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLConte return egl::error(EGL_BAD_CONFIG, EGL_NO_CONTEXT); } - if (share_context && static_cast<gl::Context*>(share_context)->isResetNotificationEnabled() != reset_notification) + gl::Context *sharedContextPtr = (share_context != EGL_NO_CONTEXT ? static_cast<gl::Context*>(share_context) : NULL); + + if (sharedContextPtr != NULL && sharedContextPtr->isResetNotificationEnabled() != reset_notification) { return egl::error(EGL_BAD_MATCH, EGL_NO_CONTEXT); } egl::Display *display = static_cast<egl::Display*>(dpy); + // Can not share contexts between displays + if (sharedContextPtr != NULL && sharedContextPtr->getRenderer() != display->getRenderer()) + { + return egl::error(EGL_BAD_MATCH, EGL_NO_CONTEXT); + } + if (!validateConfig(display, config)) { return EGL_NO_CONTEXT; diff --git a/src/3rdparty/angle/src/libEGL/libEGL.rc b/src/3rdparty/angle/src/libEGL/libEGL.rc index 5d1f32f1c9..65e0aa50c8 100644 --- a/src/3rdparty/angle/src/libEGL/libEGL.rc +++ b/src/3rdparty/angle/src/libEGL/libEGL.rc @@ -54,8 +54,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION - PRODUCTVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION + FILEVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0 + PRODUCTVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -71,13 +71,14 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "ANGLE libEGL Dynamic Link Library" - VALUE "FileVersion", VERSION_STRING + VALUE "FileVersion", ANGLE_VERSION_STRING VALUE "InternalName", "libEGL" VALUE "LegalCopyright", "Copyright (C) 2011 Google Inc." VALUE "OriginalFilename", "libEGL.dll" - VALUE "PrivateBuild", VERSION_STRING + VALUE "PrivateBuild", ANGLE_VERSION_STRING VALUE "ProductName", "ANGLE libEGL Dynamic Link Library" - VALUE "ProductVersion", VERSION_STRING + VALUE "ProductVersion", ANGLE_VERSION_STRING + VALUE "Comments", "Build Date: " ANGLE_COMMIT_DATE END END BLOCK "VarFileInfo" diff --git a/src/3rdparty/angle/src/libEGL/main.cpp b/src/3rdparty/angle/src/libEGL/main.cpp index 964b4b21fd..e972691a4f 100644 --- a/src/3rdparty/angle/src/libEGL/main.cpp +++ b/src/3rdparty/angle/src/libEGL/main.cpp @@ -11,15 +11,63 @@ #include "common/debug.h" -#ifndef QT_OPENGL_ES_2_ANGLE_STATIC - #if !defined(ANGLE_OS_WINRT) static DWORD currentTLS = TLS_OUT_OF_INDEXES; #else static __declspec(thread) void *currentTLS = 0; #endif -namespace egl { Current *getCurrent(); } +namespace egl +{ + +Current *AllocateCurrent() +{ +#if !defined(ANGLE_OS_WINRT) + Current *current = (egl::Current*)LocalAlloc(LPTR, sizeof(egl::Current)); +#else + currentTLS = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(Current)); + Current *current = (egl::Current*)currentTLS; +#endif + + if (!current) + { + ERR("Could not allocate thread local storage."); + return NULL; + } + +#if !defined(ANGLE_OS_WINRT) + ASSERT(currentTLS != TLS_OUT_OF_INDEXES); + TlsSetValue(currentTLS, current); +#endif + + 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; + + return current; +} + +void DeallocateCurrent() +{ +#if !defined(ANGLE_OS_WINRT) + void *current = TlsGetValue(currentTLS); + + if (current) + { + LocalFree((HLOCAL)current); + } +#else + if (currentTLS) + { + HeapFree(GetProcessHeap(), 0, currentTLS); + currentTLS = 0; + } +#endif +} + +} extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) { @@ -27,7 +75,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved { case DLL_PROCESS_ATTACH: { -#if !defined(ANGLE_DISABLE_TRACE) +#if defined(ANGLE_ENABLE_TRACE) FILE *debug = fopen(TRACE_OUTPUT_FILE, "rt"); if (debug) @@ -41,7 +89,6 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved } } #endif - #if !defined(ANGLE_OS_WINRT) currentTLS = TlsAlloc(); @@ -54,51 +101,19 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved // Fall throught to initialize index case DLL_THREAD_ATTACH: { - egl::Current *current = egl::getCurrent(); - - if (current) - { -#if !defined(ANGLE_OS_WINRT) - TlsSetValue(currentTLS, current); -#endif - 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; - } + egl::AllocateCurrent(); } break; case DLL_THREAD_DETACH: { - egl::Current *current = egl::getCurrent(); - - if (current) - { -#if !defined(ANGLE_OS_WINRT) - LocalFree((HLOCAL)current); -#else - HeapFree(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, current); - currentTLS = 0; -#endif - } + egl::DeallocateCurrent(); } break; case DLL_PROCESS_DETACH: { - egl::Current *current = egl::getCurrent(); - - if (current) - { + egl::DeallocateCurrent(); #if !defined(ANGLE_OS_WINRT) - LocalFree((HLOCAL)current); - } - TlsFree(currentTLS); -#else - HeapFree(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, current); - currentTLS = 0; - } #endif } break; @@ -109,96 +124,94 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved return TRUE; } -#endif // !QT_OPENGL_ES_2_ANGLE_STATIC - namespace egl { -Current *getCurrent() + +Current *GetCurrentData() { #ifndef QT_OPENGL_ES_2_ANGLE_STATIC #if !defined(ANGLE_OS_WINRT) Current *current = (Current*)TlsGetValue(currentTLS); - if (!current) - current = (Current*)LocalAlloc(LPTR, sizeof(Current)); - return current; #else - if (!currentTLS) - currentTLS = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS|HEAP_ZERO_MEMORY, sizeof(Current)); - return (Current*)currentTLS; + Current *current = (Current*)currentTLS; #endif #else // No precautions for thread safety taken as ANGLE is used single-threaded in Qt. - static Current curr = { EGL_SUCCESS, EGL_OPENGL_ES_API, EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE }; - return &curr; + static Current s_current = { EGL_SUCCESS, EGL_OPENGL_ES_API, EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE }; + Current *current = &s_current; #endif + + // ANGLE issue 488: when the dll is loaded after thread initialization, + // thread local storage (current) might not exist yet. + return (current ? current : AllocateCurrent()); } void setCurrentError(EGLint error) { - Current *current = getCurrent(); + Current *current = GetCurrentData(); current->error = error; } EGLint getCurrentError() { - Current *current = getCurrent(); + Current *current = GetCurrentData(); return current->error; } void setCurrentAPI(EGLenum API) { - Current *current = getCurrent(); + Current *current = GetCurrentData(); current->API = API; } EGLenum getCurrentAPI() { - Current *current = getCurrent(); + Current *current = GetCurrentData(); return current->API; } void setCurrentDisplay(EGLDisplay dpy) { - Current *current = getCurrent(); + Current *current = GetCurrentData(); current->display = dpy; } EGLDisplay getCurrentDisplay() { - Current *current = getCurrent(); + Current *current = GetCurrentData(); return current->display; } void setCurrentDrawSurface(EGLSurface surface) { - Current *current = getCurrent(); + Current *current = GetCurrentData(); current->drawSurface = surface; } EGLSurface getCurrentDrawSurface() { - Current *current = getCurrent(); + Current *current = GetCurrentData(); return current->drawSurface; } void setCurrentReadSurface(EGLSurface surface) { - Current *current = getCurrent(); + Current *current = GetCurrentData(); current->readSurface = surface; } EGLSurface getCurrentReadSurface() { - Current *current = getCurrent(); + Current *current = GetCurrentData(); return current->readSurface; } |