summaryrefslogtreecommitdiff
path: root/src/3rdparty/angle/src/libEGL
diff options
context:
space:
mode:
authorAndrew Knight <andrew.knight@digia.com>2014-02-24 11:18:33 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-26 07:56:50 +0100
commita7d093e740b1e20874b5ebeb37b5c5d76ae19e42 (patch)
tree573b63025dbaa090392e468e1a90de8104054578 /src/3rdparty/angle/src/libEGL
parent45e17d0cc74d3444e23c18f73d6ac155659cec55 (diff)
downloadqtbase-a7d093e740b1e20874b5ebeb37b5c5d76ae19e42.tar.gz
Upgrade ANGLE to 1.3.5bb7ec572d0a
This brings Qt's copy of ANGLE up to ANGLE master, which contains a number of bugfixes as well as restructuring for the upcoming ES 3.0 support. This version brings considerable stability improvements to the D3D11 renderer. The static translator project files have been merged to align with the ANGLE source tree. Two new patches have been applied to fix errors in upstream ANGLE: - 0011-ANGLE-Fix-compilation-error-on-MinGW-caused-by-trace.patch The event trace header in ANGLE's third_party directory has an unused template which causes a compilation error on MinGW. Disable this part of the code. - 0012-ANGLE-fix-semantic-index-lookup.patch The sorted semantic index table was returning a direct mapping to the new indices, instead of the old indices. This caused a mismatch in the GL type lookup for the translated attribute. All other patches have been rebased, removed if no longer needed, and renamed to clear up the application order: - 0001-Fix-compilation-for-MSVC-2008-and-std-tuple.patch No changes. - 0001-Fix-compilation-with-MinGW-mingw-tdm64-gcc-4.8.1.patch No changes. Renamed to 0002. - 0001-Fix-compilation-with-MinGW-gcc-64-bit.patch No changes. Renamed to 0003. - 0001-Make-it-possible-to-link-ANGLE-statically-for-single.patch Modified patch to adapt to new DLL loading structure. Renamed to 0004. - 0005-Fix-build-when-SSE2-is-not-available.patch No changes. - 0011-Fix-compilation-of-libGLESv2-with-older-MinGW-w64-he.patch No changes. Renamed to 0006. - 0006-Make-DX9-DX11-mutually-exclusive.patch Made the patch less invasive by allowing D3D9 code to run unless explicitly disabled (e.g. on WinRT, where it doesn't compile). This makes the patch smaller and allows Desktop Windows to compile both D3D9 and D3D11 codepaths. Renamed to 0007. - 0015-ANGLE-Dynamically-load-D3D-compiler-from-a-list-of-k.patch No changes. Renamed to 0008. - 0012-ANGLE-Support-WinRT.patch Made D3D11_level9 initialization only possible if D3D9 is disabled. This makes sure Desktop PCs use the old D3D9 codepath instead of the less-tested D3D11_level9 codepath. Renamed to 0009. - 0013-Enable-D3D11-for-feature-level-9-cards.patch Conveniently smaller patch due to buffer implementation improvements upstream. Renamed to 0010. - 0014-ANGLE-D3D11-Alwayls-execute-QueryInterface.patch This was a fix for patch 0009, so was integrated there. Removed. - 0016-ANGLE-D3D11-Fix-build-on-desktop-Windows.patch This was a fix for patch 0009, so it was integrated there. Removed. - 0001-ANGLE-Fix-compilation-with-MSVC2013.patch Fixed upstream. Removed. - 0007-ANGLE-Fix-typedefs-for-Win64.patch Fixed upstream. Removed. - 0004-Fix-black-screen-after-minimizing-OpenGL-window-with.patch The issue has been fixed in Qt itself. Removed. - 0008-DX11-Prevent-assert-when-view-is-minimized-or-.patch The cause of the problem was the same as patch 0004, but for the D3D11 codepath. Removed. Change-Id: Id69484ab3a3e013050741c462fb1b06dfb0fd112 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com> Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Diffstat (limited to 'src/3rdparty/angle/src/libEGL')
-rw-r--r--src/3rdparty/angle/src/libEGL/Display.cpp11
-rw-r--r--src/3rdparty/angle/src/libEGL/Display.h5
-rw-r--r--src/3rdparty/angle/src/libEGL/Surface.cpp41
-rw-r--r--src/3rdparty/angle/src/libEGL/Surface.h3
-rw-r--r--src/3rdparty/angle/src/libEGL/libEGL.cpp12
-rw-r--r--src/3rdparty/angle/src/libEGL/libEGL.rc11
-rw-r--r--src/3rdparty/angle/src/libEGL/main.cpp135
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;
}