summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip A Reimer2015-06-12 17:26:45 -0600
committerPhilip A Reimer2015-06-12 17:26:45 -0600
commite55465c5d475b9f7eb94445276fe44129f6f7d0c (patch)
tree75e01de720287f3110b0452868908fd77021cf15
downloadaur-e55465c5d475b9f7eb94445276fe44129f6f7d0c.tar.gz
Initial import
-rw-r--r--.SRCINFO66
-rw-r--r--0000-General-fixes-for-ANGLE-2.1.patch477
-rw-r--r--0004-Make-it-possible-to-link-ANGLE-statically-for-single.patch109
-rw-r--r--0008-ANGLE-Dynamically-load-D3D-compiler-from-a-list-or-t.patch64
-rw-r--r--0009-ANGLE-Support-WinRT.patch837
-rw-r--r--0010-ANGLE-Enable-D3D11-for-feature-level-9-cards.patch637
-rw-r--r--0012-ANGLE-fix-semantic-index-lookup.patch48
-rw-r--r--0013-ANGLE-Add-support-for-querying-platform-device.patch100
-rw-r--r--0014-Let-ANGLE-use-multithreaded-devices-if-necessary.patch69
-rw-r--r--0015-ANGLE-Fix-angle-d3d11-on-MSVC2010.patch536
-rw-r--r--0016-ANGLE-Fix-compilation-with-MinGW-D3D11.patch169
-rw-r--r--0017-ANGLE-Fix-compilation-with-D3D9.patch62
-rw-r--r--0018-ANGLE-Fix-releasing-textures-after-we-kill-D3D11.patch106
-rw-r--r--PKGBUILD211
-rw-r--r--angleproject-disable-debug-annotations.patch33
-rw-r--r--angleproject-export-shader-symbols.patch36
-rw-r--r--angleproject-include-import-library-and-use-def-file.patch30
-rw-r--r--angleproject-prevent-multiple-definition-errors.patch39
-rw-r--r--angleproject-undo-mingw-org-compatibility.patch11
-rw-r--r--angleproject-undo-mingw-org-compatibility2.patch13
-rw-r--r--angleproject-undo-shader-renames.patch162
-rw-r--r--commit-409078f363
-rw-r--r--commit-4de44cb747
-rw-r--r--libEGL_mingw32.def41
-rw-r--r--libGLESv2_mingw32.def296
25 files changed, 5262 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..3aca2d8426f9
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,66 @@
+pkgbase = mingw-w64-angleproject
+ pkgdesc = Angle project (mingw-w64)
+ pkgver = 2.1.r3427.30d6c25
+ pkgrel = 2
+ url = http://code.google.com/p/angleproject/
+ arch = any
+ license = BSD
+ makedepends = mingw-w64-gcc
+ makedepends = gyp-svn
+ makedepends = git
+ makedepends = python
+ depends = mingw-w64-crt
+ options = !strip
+ options = !buildflags
+ options = staticlibs
+ source = angleproject::git+https://chromium.googlesource.com/angle/angle#commit=30d6c25
+ source = libGLESv2_mingw32.def
+ source = libEGL_mingw32.def
+ source = 0000-General-fixes-for-ANGLE-2.1.patch
+ source = 0004-Make-it-possible-to-link-ANGLE-statically-for-single.patch
+ source = 0008-ANGLE-Dynamically-load-D3D-compiler-from-a-list-or-t.patch
+ source = 0009-ANGLE-Support-WinRT.patch
+ source = 0010-ANGLE-Enable-D3D11-for-feature-level-9-cards.patch
+ source = 0012-ANGLE-fix-semantic-index-lookup.patch
+ source = 0013-ANGLE-Add-support-for-querying-platform-device.patch
+ source = 0014-Let-ANGLE-use-multithreaded-devices-if-necessary.patch
+ source = 0015-ANGLE-Fix-angle-d3d11-on-MSVC2010.patch
+ source = 0016-ANGLE-Fix-compilation-with-MinGW-D3D11.patch
+ source = 0017-ANGLE-Fix-compilation-with-D3D9.patch
+ source = 0018-ANGLE-Fix-releasing-textures-after-we-kill-D3D11.patch
+ source = angleproject-undo-mingw-org-compatibility.patch
+ source = angleproject-undo-mingw-org-compatibility2.patch
+ source = angleproject-disable-debug-annotations.patch
+ source = angleproject-undo-shader-renames.patch
+ source = angleproject-prevent-multiple-definition-errors.patch
+ source = commit-4de44cb
+ source = commit-409078f
+ source = angleproject-include-import-library-and-use-def-file.patch
+ source = angleproject-export-shader-symbols.patch
+ md5sums = SKIP
+ md5sums = ebee3837c9f9ad9e9b49061a2274b963
+ md5sums = 7d563b2218692a5ea232c1a7aa77e2a1
+ md5sums = b14a834c2d51c7af99f8aaf089851d23
+ md5sums = fa43f37117af18de3badfc4481ee3639
+ md5sums = fe69049b10928166ef62e1786a13e61b
+ md5sums = e573a80dec8b594bf6244ea4a28ce438
+ md5sums = b64f5fc4838d7157753f8255613ca511
+ md5sums = baf253bebf28653468e18b92d84f4431
+ md5sums = 25b88bcf7132e62c6717c145177ea157
+ md5sums = 8fdd8266b8b2c276dbf4e66d2947e5e3
+ md5sums = fbd26095e88c8e6930edc50c1c7dc0a8
+ md5sums = 5f80ebeebded4a4bb80cd03e3075dae5
+ md5sums = 780bc9ce3c0008910707b2df20c3430c
+ md5sums = 2787c0a067665b02c161c7392b7175e4
+ md5sums = b8f289095e5a64514f3a7adb680fc3d3
+ md5sums = d5c2ca6cb655070ac75a035376e8b052
+ md5sums = f2289e55621764d05e16a71ba09dd779
+ md5sums = f44242b0abb63290bd571a953bae34b9
+ md5sums = 8f54b19db99483c9ee37054d302bf806
+ md5sums = cce58c740f92bf1b2f7ca4a58999a5fc
+ md5sums = a94c3e8bfe9e62198b8b51311f28c9a5
+ md5sums = 8374ba08ca0cc5620ac2c94209122134
+ md5sums = 19a72088f614a5f22004b2687a73f3ad
+
+pkgname = mingw-w64-angleproject
+
diff --git a/0000-General-fixes-for-ANGLE-2.1.patch b/0000-General-fixes-for-ANGLE-2.1.patch
new file mode 100644
index 000000000000..ad3187ec7c01
--- /dev/null
+++ b/0000-General-fixes-for-ANGLE-2.1.patch
@@ -0,0 +1,477 @@
+From bd27c33a4a7c48bd14b9b6c18c8cdce1c3aae155 Mon Sep 17 00:00:00 2001
+From: Andrew Knight <andrew.knight@theqtcompany.com>
+Date: Fri, 14 Nov 2014 10:53:40 +0200
+Subject: [PATCH] General fixes for ANGLE 2.1
+
+- Fix commit.h include (use hard-coded version)
+- Fix export mismatch in libEGL.cpp and libGLESv2.cpp
+- Normalize all precompiled shader names and includes
+- Remove third-party event tracing; it was hardly used in ANGLE
+ and not enabled in Qt builds anyway.
+
+Change-Id: I22254aed62e89a26756ca0784bae95909189c0f9
+---
+ src/3rdparty/angle/src/commit.h | 6 +-
+ src/3rdparty/angle/src/common/version.h | 2 +-
+ .../src/common/winrt/CoreWindowNativeWindow.cpp | 2 +-
+ src/3rdparty/angle/src/libEGL/libEGL.cpp | 3 +
+ src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp | 4 ++
+ src/3rdparty/angle/src/libGLESv2/libGLESv2.def | 3 -
+ .../src/libGLESv2/renderer/d3d/HLSLCompiler.cpp | 3 -
+ .../src/libGLESv2/renderer/d3d/d3d11/Blit11.cpp | 66 +++++++++++-----------
+ .../src/libGLESv2/renderer/d3d/d3d11/Clear11.cpp | 12 ++--
+ .../renderer/d3d/d3d11/PixelTransfer11.cpp | 10 ++--
+ .../libGLESv2/renderer/d3d/d3d11/SwapChain11.cpp | 4 +-
+ .../renderer/d3d/d3d11/shaders/Clear11.hlsl | 4 ++
+ .../src/libGLESv2/renderer/d3d/d3d9/Blit9.cpp | 20 +++----
+ .../src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp | 12 ----
+ .../libGLESv2/renderer/d3d/d3d9/shaders/Blit.ps | 6 +-
+ .../libGLESv2/renderer/d3d/d3d9/shaders/Blit.vs | 4 +-
+ 16 files changed, 76 insertions(+), 85 deletions(-)
+
+diff --git a/src/3rdparty/angle/src/commit.h b/src/3rdparty/angle/src/commit.h
+index 4c89a65..08fc893 100644
+--- a/src/3rdparty/angle/src/commit.h
++++ b/src/3rdparty/angle/src/commit.h
+@@ -7,8 +7,6 @@
+ // This is a default commit hash header, when git is not available.
+ //
+
+-#define ANGLE_COMMIT_HASH "unknown hash"
++#define ANGLE_COMMIT_HASH "30d6c255d238"
+ #define ANGLE_COMMIT_HASH_SIZE 12
+-#define ANGLE_COMMIT_DATE "unknown date"
+-
+-#define ANGLE_DISABLE_PROGRAM_BINARY_LOAD
++#define ANGLE_COMMIT_DATE "2014-11-13 17:37:03 +0000"
+diff --git a/src/3rdparty/angle/src/common/version.h b/src/3rdparty/angle/src/common/version.h
+index d9148d1..f01e024 100644
+--- a/src/3rdparty/angle/src/common/version.h
++++ b/src/3rdparty/angle/src/common/version.h
+@@ -1,4 +1,4 @@
+-#include "id/commit.h"
++#include "../commit.h"
+
+ #define ANGLE_MAJOR_VERSION 2
+ #define ANGLE_MINOR_VERSION 1
+diff --git a/src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.cpp b/src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.cpp
+index 0de16f4..0e63fa5 100644
+--- a/src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.cpp
++++ b/src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.cpp
+@@ -184,4 +184,4 @@ long ConvertDipsToPixels(float dips)
+ static const float dipsPerInch = 96.0f;
+ return lround((dips * GetLogicalDpi() / dipsPerInch));
+ }
+-}
+\ No newline at end of file
++}
+diff --git a/src/3rdparty/angle/src/libEGL/libEGL.cpp b/src/3rdparty/angle/src/libEGL/libEGL.cpp
+index 851b723..6110698 100644
+--- a/src/3rdparty/angle/src/libEGL/libEGL.cpp
++++ b/src/3rdparty/angle/src/libEGL/libEGL.cpp
+@@ -6,6 +6,9 @@
+
+ // libEGL.cpp: Implements the exported EGL functions.
+
++#undef EGLAPI
++#define EGLAPI
++
+ #include <exception>
+
+ #include "common/debug.h"
+diff --git a/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp b/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp
+index 2306168..587950a 100644
+--- a/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/libGLESv2.cpp
+@@ -6,6 +6,10 @@
+
+ // libGLESv2.cpp: Implements the exported OpenGL ES 2.0 functions.
+
++#undef GL_APICALL
++#define GL_APICALL
++#define GL_GLEXT_PROTOTYPES
++
+ #include "common/version.h"
+ #include "common/utilities.h"
+
+diff --git a/src/3rdparty/angle/src/libGLESv2/libGLESv2.def b/src/3rdparty/angle/src/libGLESv2/libGLESv2.def
+index 88dceb3..33557eb 100644
+--- a/src/3rdparty/angle/src/libGLESv2/libGLESv2.def
++++ b/src/3rdparty/angle/src/libGLESv2/libGLESv2.def
+@@ -294,6 +294,3 @@ EXPORTS
+ glBindTexImage @158 NONAME
+ glCreateRenderer @177 NONAME
+ glDestroyRenderer @178 NONAME
+-
+- ; Setting up TRACE macro callbacks
+- SetTraceFunctionPointers @284
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp
+index 5c44fe0..bfeaf51 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp
+@@ -11,8 +11,6 @@
+ #include "common/features.h"
+ #include "common/utilities.h"
+
+-#include "third_party/trace_event/trace_event.h"
+-
+ // Definitions local to the translation unit
+ namespace
+ {
+@@ -120,7 +118,6 @@ HLSLCompiler::~HLSLCompiler()
+
+ bool HLSLCompiler::initialize()
+ {
+- TRACE_EVENT0("gpu", "initializeCompiler");
+ #if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+ #if defined(ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES)
+ // Find a D3DCompiler module that had already been loaded based on a predefined list of versions.
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Blit11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Blit11.cpp
+index 8ed1650..91e7552 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Blit11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Blit11.cpp
+@@ -13,39 +13,39 @@
+ #include "libGLESv2/main.h"
+ #include "libGLESv2/formatutils.h"
+
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughdepth2d11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dui11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2di11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2d11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2dui11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2di11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg2d11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg2dui11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg2di11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr2d11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr2dui11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr2di11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughlum2d11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2d11ps.h"
+-
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthrough3d11vs.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthrough3d11gs.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3dui11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3di11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3d11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3dui11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3di11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg3d11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg3dui11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg3di11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr3d11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr3dui11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr3di11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughlum3d11ps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthrough2dvs.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughdepth2dps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2duips.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dips.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2dps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2duips.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2dips.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg2dps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg2duips.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg2dips.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr2dps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr2duips.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr2dips.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughlum2dps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2dps.h"
++
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthrough3dvs.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthrough3dgs.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3dps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3duips.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3dips.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3dps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3duips.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3dips.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg3dps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg3duips.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg3dips.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr3dps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr3duips.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr3dips.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughlum3dps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha3dps.h"
+
+ #include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/swizzlef2dps.h"
+ #include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/swizzlei2dps.h"
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Clear11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Clear11.cpp
+index 12905d0..4630762 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Clear11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Clear11.cpp
+@@ -15,14 +15,14 @@
+ #include "libGLESv2/FramebufferAttachment.h"
+
+ // Precompiled shaders
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearfloat11vs.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearfloatvs.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearfloatps.h"
+
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearuint11vs.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearuint11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearuintvs.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearuintps.h"
+
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearsint11vs.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearsint11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearsintvs.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearsintps.h"
+
+ namespace rx
+ {
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/PixelTransfer11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/PixelTransfer11.cpp
+index 1bc2bd8..a4072d8 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/PixelTransfer11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/PixelTransfer11.cpp
+@@ -22,11 +22,11 @@
+ #include "libGLESv2/Context.h"
+
+ // Precompiled shaders
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_vs.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_gs.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4f.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4i.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4ui.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexturevs.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexturegs.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexture_4fps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexture_4ips.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexture_4uips.h"
+
+ namespace rx
+ {
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/SwapChain11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/SwapChain11.cpp
+index 3fcacf6..834b7bd 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/SwapChain11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/SwapChain11.cpp
+@@ -12,8 +12,8 @@
+ #include "libGLESv2/renderer/d3d/d3d11/Renderer11.h"
+
+ // Precompiled shaders
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthrough2dvs.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dps.h"
+
+ #include "common/features.h"
+ #include "common/NativeWindow.h"
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/shaders/Clear11.hlsl b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/shaders/Clear11.hlsl
+index 6deef2b..b4cf380 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/shaders/Clear11.hlsl
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/shaders/Clear11.hlsl
+@@ -13,10 +13,12 @@ struct PS_OutputFloat
+ float4 color1 : SV_TARGET1;
+ float4 color2 : SV_TARGET2;
+ float4 color3 : SV_TARGET3;
++#if SM4
+ float4 color4 : SV_TARGET4;
+ float4 color5 : SV_TARGET5;
+ float4 color6 : SV_TARGET6;
+ float4 color7 : SV_TARGET7;
++#endif
+ };
+
+ PS_OutputFloat PS_ClearFloat(in float4 inPosition : SV_POSITION, in float4 inColor : COLOR)
+@@ -26,10 +28,12 @@ PS_OutputFloat PS_ClearFloat(in float4 inPosition : SV_POSITION, in float4 inCol
+ outColor.color1 = inColor;
+ outColor.color2 = inColor;
+ outColor.color3 = inColor;
++#if SM4
+ outColor.color4 = inColor;
+ outColor.color5 = inColor;
+ outColor.color6 = inColor;
+ outColor.color7 = inColor;
++#endif
+ return outColor;
+ }
+
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Blit9.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Blit9.cpp
+index d4fcd17..2ca7a9c 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Blit9.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Blit9.cpp
+@@ -27,20 +27,20 @@ namespace
+
+ const BYTE* const g_shaderCode[] =
+ {
+- g_vs20_standardvs,
+- g_vs20_flipyvs,
+- g_ps20_passthroughps,
+- g_ps20_luminanceps,
+- g_ps20_componentmaskps
++ g_vs20_VS_standard,
++ g_vs20_VS_flipy,
++ g_ps20_PS_passthrough,
++ g_ps20_PS_luminance,
++ g_ps20_PS_componentmask
+ };
+
+ const size_t g_shaderSize[] =
+ {
+- sizeof(g_vs20_standardvs),
+- sizeof(g_vs20_flipyvs),
+- sizeof(g_ps20_passthroughps),
+- sizeof(g_ps20_luminanceps),
+- sizeof(g_ps20_componentmaskps)
++ sizeof(g_vs20_VS_standard),
++ sizeof(g_vs20_VS_flipy),
++ sizeof(g_ps20_PS_passthrough),
++ sizeof(g_ps20_PS_luminance),
++ sizeof(g_ps20_PS_componentmask)
+ };
+ }
+
+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 3bac4ba..82963ec 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp
+@@ -42,8 +42,6 @@
+ #include "common/features.h"
+ #include "common/utilities.h"
+
+-#include "third_party/trace_event/trace_event.h"
+-
+ #include <sstream>
+
+ // Can also be enabled by defining FORCE_REF_RAST in the project's predefined macros
+@@ -185,7 +183,6 @@ EGLint Renderer9::initialize()
+ return EGL_NOT_INITIALIZED;
+ }
+
+- TRACE_EVENT0("gpu", "GetModuleHandle_d3d9");
+ mD3d9Module = GetModuleHandle(TEXT("d3d9.dll"));
+
+ if (mD3d9Module == NULL)
+@@ -202,14 +199,12 @@ EGLint Renderer9::initialize()
+ // desktop. Direct3D9Ex is available in Windows Vista and later if suitable drivers are available.
+ if (ANGLE_D3D9EX == ANGLE_ENABLED && Direct3DCreate9ExPtr && SUCCEEDED(Direct3DCreate9ExPtr(D3D_SDK_VERSION, &mD3d9Ex)))
+ {
+- TRACE_EVENT0("gpu", "D3d9Ex_QueryInterface");
+ ASSERT(mD3d9Ex);
+ mD3d9Ex->QueryInterface(__uuidof(IDirect3D9), reinterpret_cast<void**>(&mD3d9));
+ ASSERT(mD3d9);
+ }
+ else
+ {
+- TRACE_EVENT0("gpu", "Direct3DCreate9");
+ mD3d9 = Direct3DCreate9(D3D_SDK_VERSION);
+ }
+
+@@ -228,7 +223,6 @@ EGLint Renderer9::initialize()
+
+ // Give up on getting device caps after about one second.
+ {
+- TRACE_EVENT0("gpu", "GetDeviceCaps");
+ for (int i = 0; i < 10; ++i)
+ {
+ result = mD3d9->GetDeviceCaps(mAdapter, mDeviceType, &mDeviceCaps);
+@@ -263,7 +257,6 @@ EGLint Renderer9::initialize()
+ }
+
+ {
+- TRACE_EVENT0("gpu", "GetAdapterIdentifier");
+ mD3d9->GetAdapterIdentifier(mAdapter, 0, &mAdapterIdentifier);
+ }
+
+@@ -300,7 +293,6 @@ EGLint Renderer9::initialize()
+ static const TCHAR className[] = TEXT("STATIC");
+
+ {
+- TRACE_EVENT0("gpu", "CreateWindowEx");
+ mDeviceWindow = CreateWindowEx(WS_EX_NOACTIVATE, className, windowName, WS_DISABLED | WS_POPUP, 0, 0, 1, 1, HWND_MESSAGE, NULL, GetModuleHandle(NULL), NULL);
+ }
+
+@@ -308,7 +300,6 @@ EGLint Renderer9::initialize()
+ DWORD behaviorFlags = D3DCREATE_FPU_PRESERVE | D3DCREATE_NOWINDOWCHANGES;
+
+ {
+- TRACE_EVENT0("gpu", "D3d9_CreateDevice");
+ result = mD3d9->CreateDevice(mAdapter, mDeviceType, mDeviceWindow, behaviorFlags | D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE, &presentParameters, &mDevice);
+ }
+ if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DEVICELOST)
+@@ -318,7 +309,6 @@ EGLint Renderer9::initialize()
+
+ if (FAILED(result))
+ {
+- TRACE_EVENT0("gpu", "D3d9_CreateDevice2");
+ result = mD3d9->CreateDevice(mAdapter, mDeviceType, mDeviceWindow, behaviorFlags | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &presentParameters, &mDevice);
+
+ if (FAILED(result))
+@@ -330,13 +320,11 @@ EGLint Renderer9::initialize()
+
+ if (mD3d9Ex)
+ {
+- TRACE_EVENT0("gpu", "mDevice_QueryInterface");
+ result = mDevice->QueryInterface(__uuidof(IDirect3DDevice9Ex), (void**)&mDeviceEx);
+ ASSERT(SUCCEEDED(result));
+ }
+
+ {
+- TRACE_EVENT0("gpu", "ShaderCache initialize");
+ mVertexShaderCache.initialize(mDevice);
+ mPixelShaderCache.initialize(mDevice);
+ }
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/shaders/Blit.ps b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/shaders/Blit.ps
+index dc357d0..eb43eb3 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/shaders/Blit.ps
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/shaders/Blit.ps
+@@ -11,7 +11,7 @@ uniform float4 add : c1;
+
+ // Passthrough Pixel Shader
+ // Outputs texture 0 sampled at texcoord 0.
+-float4 passthroughps(float4 texcoord : TEXCOORD0) : COLOR
++float4 PS_passthrough(float4 texcoord : TEXCOORD0) : COLOR
+ {
+ return tex2D(tex, texcoord.xy);
+ };
+@@ -19,7 +19,7 @@ float4 passthroughps(float4 texcoord : TEXCOORD0) : COLOR
+ // Luminance Conversion Pixel Shader
+ // Performs a mad operation using the LA data from the texture with mult.xw and add.xw.
+ // Returns data in the form of llla
+-float4 luminanceps(float4 texcoord : TEXCOORD0) : COLOR
++float4 PS_luminance(float4 texcoord : TEXCOORD0) : COLOR
+ {
+ return (tex2D(tex, texcoord.xy).xw * mult.xw + add.xw).xxxy;
+ };
+@@ -27,7 +27,7 @@ float4 luminanceps(float4 texcoord : TEXCOORD0) : COLOR
+ // RGB/A Component Mask Pixel Shader
+ // Performs a mad operation using the texture's RGBA data with mult.xyzw and add.xyzw.
+ // Returns data in the form of rgba
+-float4 componentmaskps(float4 texcoord : TEXCOORD0) : COLOR
++float4 PS_componentmask(float4 texcoord : TEXCOORD0) : COLOR
+ {
+ return tex2D(tex, texcoord.xy) * mult + add;
+ };
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/shaders/Blit.vs b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/shaders/Blit.vs
+index 3a36980..3bd611b 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/shaders/Blit.vs
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/shaders/Blit.vs
+@@ -17,7 +17,7 @@ uniform float4 halfPixelSize : c0;
+ // Outputs the homogenous position as-is.
+ // Outputs a tex coord with (0,0) in the upper-left corner of the screen and (1,1) in the bottom right.
+ // C0.X must be negative half-pixel width, C0.Y must be half-pixel height. C0.ZW must be 0.
+-VS_OUTPUT standardvs(in float4 position : POSITION)
++VS_OUTPUT VS_standard(in float4 position : POSITION)
+ {
+ VS_OUTPUT Out;
+
+@@ -32,7 +32,7 @@ VS_OUTPUT standardvs(in float4 position : POSITION)
+ // Outputs the homogenous position as-is.
+ // Outputs a tex coord with (0,1) in the upper-left corner of the screen and (1,0) in the bottom right.
+ // C0.XY must be the half-pixel width and height. C0.ZW must be 0.
+-VS_OUTPUT flipyvs(in float4 position : POSITION)
++VS_OUTPUT VS_flipy(in float4 position : POSITION)
+ {
+ VS_OUTPUT Out;
+
+--
+1.9.4.msysgit.1
+
diff --git a/0004-Make-it-possible-to-link-ANGLE-statically-for-single.patch b/0004-Make-it-possible-to-link-ANGLE-statically-for-single.patch
new file mode 100644
index 000000000000..45a3f17ccabb
--- /dev/null
+++ b/0004-Make-it-possible-to-link-ANGLE-statically-for-single.patch
@@ -0,0 +1,109 @@
+From 3a39939b5eba9f788789961c4800ba62618f758c Mon Sep 17 00:00:00 2001
+From: Friedemann Kleint <Friedemann.Kleint@digia.com>
+Date: Tue, 11 Nov 2014 10:26:32 +0200
+Subject: [PATCH 04/16] Make it possible to link ANGLE statically for
+ single-thread use.
+
+Fix exports and provide static instances of thread-local
+data depending on QT_OPENGL_ES_2_ANGLE_STATIC.
+
+Change-Id: Ifab25a820adf5953bb3b09036de53dbf7f1a7fd5
+---
+ src/3rdparty/angle/include/KHR/khrplatform.h | 2 +-
+ src/3rdparty/angle/src/libEGL/main.cpp | 10 ++++++++++
+ src/3rdparty/angle/src/libGLESv2/main.cpp | 10 ++++++++--
+ 3 files changed, 19 insertions(+), 3 deletions(-)
+
+diff --git a/src/3rdparty/angle/include/KHR/khrplatform.h b/src/3rdparty/angle/include/KHR/khrplatform.h
+index c9e6f17..1ac2d3f 100644
+--- a/src/3rdparty/angle/include/KHR/khrplatform.h
++++ b/src/3rdparty/angle/include/KHR/khrplatform.h
+@@ -97,7 +97,7 @@
+ *-------------------------------------------------------------------------
+ * This precedes the return type of the function in the function prototype.
+ */
+-#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
++#if defined(_WIN32) && !defined(__SCITECH_SNAP__) && !defined(QT_OPENGL_ES_2_ANGLE_STATIC)
+ # define KHRONOS_APICALL __declspec(dllimport)
+ #elif defined (__SYMBIAN32__)
+ # define KHRONOS_APICALL IMPORT_C
+diff --git a/src/3rdparty/angle/src/libEGL/main.cpp b/src/3rdparty/angle/src/libEGL/main.cpp
+index d1489f2..e88cad7 100644
+--- a/src/3rdparty/angle/src/libEGL/main.cpp
++++ b/src/3rdparty/angle/src/libEGL/main.cpp
+@@ -49,6 +49,8 @@ void DeallocateCurrent()
+
+ }
+
++#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
++
+ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
+ {
+ switch (reason)
+@@ -108,16 +110,24 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
+ 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 &current;
++#endif
+ }
+
+ void recordError(const Error &error)
+diff --git a/src/3rdparty/angle/src/libGLESv2/main.cpp b/src/3rdparty/angle/src/libGLESv2/main.cpp
+index 3ac00d5..00f63ae 100644
+--- a/src/3rdparty/angle/src/libGLESv2/main.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/main.cpp
+@@ -74,7 +74,7 @@ void DeallocateCurrent()
+
+ }
+
+-#ifdef ANGLE_PLATFORM_WINDOWS
++#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(QT_OPENGL_ES_2_ANGLE_STATIC)
+ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
+ {
+ switch (reason)
+@@ -117,18 +117,24 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
+
+ return TRUE;
+ }
+-#endif
++#endif // ANGLE_PLATFORM_WINDOWS && !QT_OPENGL_ES_2_ANGLE_STATIC
+
+ namespace gl
+ {
+
+ 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 = { 0, 0 };
++ return &current;
++#endif
+ }
+
+ void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface)
+--
+1.9.4.msysgit.1
+
diff --git a/0008-ANGLE-Dynamically-load-D3D-compiler-from-a-list-or-t.patch b/0008-ANGLE-Dynamically-load-D3D-compiler-from-a-list-or-t.patch
new file mode 100644
index 000000000000..801db67682a2
--- /dev/null
+++ b/0008-ANGLE-Dynamically-load-D3D-compiler-from-a-list-or-t.patch
@@ -0,0 +1,64 @@
+From 4a5960465d1632ab089320fcbba4af294d58fd9a Mon Sep 17 00:00:00 2001
+From: Andrew Knight <andrew.knight@theqtcompany.com>
+Date: Fri, 7 Nov 2014 14:05:36 +0200
+Subject: [PATCH 08/16] ANGLE: Dynamically load D3D compiler from a list or the
+ environment
+
+If the default compiler cannot be found, load it from a list of DLL names,
+including a non-versioned proxy DLL provided by Qt. On Desktop Windows,
+the default compiler can also be specified by an environment variable,
+QT_D3DCOMPILER_DLL.
+
+Change-Id: I0d7a8a8a36cc571836f8fa59ea14513b9b19c19b
+---
+ .../src/libGLESv2/renderer/d3d/HLSLCompiler.cpp | 27 ++++++++++++++++++++++
+ 1 file changed, 27 insertions(+)
+
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp
+index bfeaf51..9d003b4 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp
+@@ -11,6 +11,10 @@
+ #include "common/features.h"
+ #include "common/utilities.h"
+
++#ifndef QT_D3DCOMPILER_DLL
++#define QT_D3DCOMPILER_DLL D3DCOMPILER_DLL
++#endif
++
+ // Definitions local to the translation unit
+ namespace
+ {
+@@ -132,6 +136,29 @@ bool HLSLCompiler::initialize()
+ }
+ #endif // ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES
+
++ // Load the compiler DLL specified by the environment, or default to QT_D3DCOMPILER_DLL
++ const wchar_t *defaultCompiler = _wgetenv(L"QT_D3DCOMPILER_DLL");
++ if (!defaultCompiler)
++ defaultCompiler = QT_D3DCOMPILER_DLL;
++
++ const wchar_t *compilerDlls[] = {
++ defaultCompiler,
++ L"d3dcompiler_47.dll",
++ L"d3dcompiler_46.dll",
++ L"d3dcompiler_45.dll",
++ L"d3dcompiler_44.dll",
++ L"d3dcompiler_43.dll",
++ 0
++ };
++
++ // Load the first available known compiler DLL
++ for (int i = 0; compilerDlls[i]; ++i)
++ {
++ mD3DCompilerModule = LoadLibrary(compilerDlls[i]);
++ if (mD3DCompilerModule)
++ break;
++ }
++
+ if (!mD3DCompilerModule)
+ {
+ // Load the version of the D3DCompiler DLL associated with the Direct3D version ANGLE was built with.
+--
+1.9.4.msysgit.1
+
diff --git a/0009-ANGLE-Support-WinRT.patch b/0009-ANGLE-Support-WinRT.patch
new file mode 100644
index 000000000000..a38fb4ea13cd
--- /dev/null
+++ b/0009-ANGLE-Support-WinRT.patch
@@ -0,0 +1,837 @@
+From 4d150ba3814f824f1cadaedbdb83d0ac79d0e1a2 Mon Sep 17 00:00:00 2001
+From: Andrew Knight <andrew.knight@theqtcompany.com>
+Date: Fri, 14 Nov 2014 09:28:11 +0200
+Subject: [PATCH 09/16] ANGLE: Support WinRT
+
+Tweak ANGLE's existing support for WinRT to allow for changing the
+window size on Windows Phone.
+
+Change-Id: Ia312b5318b977838a2953f1f530487cbf24974bc
+---
+ src/3rdparty/angle/include/EGL/eglplatform.h | 5 +-
+ src/3rdparty/angle/src/common/NativeWindow.h | 7 +-
+ src/3rdparty/angle/src/common/platform.h | 4 +-
+ .../angle/src/common/win32/NativeWindow.cpp | 2 +-
+ .../src/common/winrt/CoreWindowNativeWindow.cpp | 87 +++++++++++++---------
+ .../src/common/winrt/CoreWindowNativeWindow.h | 48 ++----------
+ .../src/common/winrt/InspectableNativeWindow.cpp | 8 +-
+ .../src/common/winrt/InspectableNativeWindow.h | 7 +-
+ .../common/winrt/SwapChainPanelNativeWindow.cpp | 2 +-
+ .../src/common/winrt/SwapChainPanelNativeWindow.h | 2 +-
+ src/3rdparty/angle/src/libEGL/Display.h | 1 +
+ src/3rdparty/angle/src/libEGL/Surface.cpp | 45 ++++++++---
+ src/3rdparty/angle/src/libEGL/Surface.h | 4 +
+ src/3rdparty/angle/src/libEGL/libEGL.cpp | 20 +++++
+ .../src/libGLESv2/renderer/d3d/d3d11/Renderer11.h | 2 +-
+ .../libGLESv2/renderer/d3d/d3d11/SwapChain11.cpp | 74 +++++++++++-------
+ .../src/libGLESv2/renderer/d3d/d3d11/SwapChain11.h | 2 +
+ 17 files changed, 189 insertions(+), 131 deletions(-)
+
+diff --git a/src/3rdparty/angle/include/EGL/eglplatform.h b/src/3rdparty/angle/include/EGL/eglplatform.h
+index 3793e57..2eb3674 100644
+--- a/src/3rdparty/angle/include/EGL/eglplatform.h
++++ b/src/3rdparty/angle/include/EGL/eglplatform.h
+@@ -73,13 +73,14 @@
+ #endif
+ #include <windows.h>
+
+-typedef HDC EGLNativeDisplayType;
+ typedef HBITMAP EGLNativePixmapType;
+
+-#if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PC_APP /* Windows Store */
++#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP || WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) /* Windows Store */
+ #include <inspectable.h>
++typedef IInspectable* EGLNativeDisplayType;
+ typedef IInspectable* EGLNativeWindowType;
+ #else
++typedef HDC EGLNativeDisplayType;
+ typedef HWND EGLNativeWindowType;
+ #endif
+
+diff --git a/src/3rdparty/angle/src/common/NativeWindow.h b/src/3rdparty/angle/src/common/NativeWindow.h
+index dc5fc8f..9e93aea 100644
+--- a/src/3rdparty/angle/src/common/NativeWindow.h
++++ b/src/3rdparty/angle/src/common/NativeWindow.h
+@@ -44,10 +44,11 @@ typedef IDXGIFactory DXGIFactory;
+
+ namespace rx
+ {
++
+ class NativeWindow
+ {
+- public:
+- explicit NativeWindow(EGLNativeWindowType window);
++public:
++ explicit NativeWindow(EGLNativeWindowType window, EGLNativeDisplayType display);
+
+ bool initialize();
+ bool getClientRect(LPRECT rect);
+@@ -58,9 +59,11 @@ class NativeWindow
+ DXGISwapChain** swapChain);
+
+ inline EGLNativeWindowType getNativeWindow() const { return mWindow; }
++ inline EGLNativeDisplayType getNativeDisplay() const { return mDisplay; }
+
+ private:
+ EGLNativeWindowType mWindow;
++ EGLNativeDisplayType mDisplay;
+
+ #if defined(ANGLE_ENABLE_WINDOWS_STORE)
+ std::shared_ptr<InspectableNativeWindow> mImpl;
+diff --git a/src/3rdparty/angle/src/common/platform.h b/src/3rdparty/angle/src/common/platform.h
+index cd12dba..0065ec7 100644
+--- a/src/3rdparty/angle/src/common/platform.h
++++ b/src/3rdparty/angle/src/common/platform.h
+@@ -34,7 +34,7 @@
+ #endif
+
+ #ifdef ANGLE_PLATFORM_WINDOWS
+-# if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PC_APP
++# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP || WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
+ # define ANGLE_ENABLE_WINDOWS_STORE 1
+ # endif
+ # ifndef STRICT
+@@ -67,7 +67,9 @@
+ # if defined(ANGLE_ENABLE_WINDOWS_STORE)
+ # include <dxgi1_3.h>
+ # if defined(_DEBUG)
++# if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP)
+ # include <DXProgrammableCapture.h>
++# endif
+ # include <dxgidebug.h>
+ # endif
+ # endif
+diff --git a/src/3rdparty/angle/src/common/win32/NativeWindow.cpp b/src/3rdparty/angle/src/common/win32/NativeWindow.cpp
+index aa2bfa4..2440747 100644
+--- a/src/3rdparty/angle/src/common/win32/NativeWindow.cpp
++++ b/src/3rdparty/angle/src/common/win32/NativeWindow.cpp
+@@ -16,7 +16,7 @@ bool IsValidEGLNativeWindowType(EGLNativeWindowType window)
+ return (IsWindow(window) == TRUE);
+ }
+
+-NativeWindow::NativeWindow(EGLNativeWindowType window) : mWindow(window)
++NativeWindow::NativeWindow(EGLNativeWindowType window, EGLNativeDisplayType display) : mWindow(window), mDisplay(display)
+ {
+ }
+
+diff --git a/src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.cpp b/src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.cpp
+index 0e63fa5..9b65c15 100644
+--- a/src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.cpp
++++ b/src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.cpp
+@@ -6,21 +6,25 @@
+
+ // CoreWindowNativeWindow.cpp: NativeWindow for managing ICoreWindow native window types.
+
+-#include <windows.graphics.display.h>
++#include <algorithm>
+ #include "common/winrt/CoreWindowNativeWindow.h"
+ using namespace ABI::Windows::Foundation::Collections;
+
+ namespace rx
+ {
++
++typedef ITypedEventHandler<ABI::Windows::UI::Core::CoreWindow *, ABI::Windows::UI::Core::WindowSizeChangedEventArgs *> SizeChangedHandler;
++
+ CoreWindowNativeWindow::~CoreWindowNativeWindow()
+ {
+ unregisterForSizeChangeEvents();
+ }
+
+-bool CoreWindowNativeWindow::initialize(EGLNativeWindowType window, IPropertySet *propertySet)
++bool CoreWindowNativeWindow::initialize(EGLNativeWindowType window, EGLNativeDisplayType display, IPropertySet *propertySet)
+ {
+ ComPtr<IPropertySet> props = propertySet;
+ ComPtr<IInspectable> win = window;
++ ComPtr<IInspectable> displayInformation = display;
+ SIZE swapChainSize = {};
+ bool swapChainSizeSpecified = false;
+ HRESULT result = S_OK;
+@@ -47,6 +51,29 @@ bool CoreWindowNativeWindow::initialize(EGLNativeWindowType window, IPropertySet
+
+ if (SUCCEEDED(result))
+ {
++ result = displayInformation.As(&mDisplayInformation);
++ }
++
++ if (SUCCEEDED(result))
++ {
++#if WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP
++ ComPtr<ABI::Windows::Graphics::Display::IDisplayInformation2> displayInformation2;
++ result = mDisplayInformation.As(&displayInformation2);
++ ASSERT(SUCCEEDED(result));
++
++ result = displayInformation2->get_RawPixelsPerViewPixel(&mScaleFactor);
++ ASSERT(SUCCEEDED(result));
++#else
++ ABI::Windows::Graphics::Display::ResolutionScale resolutionScale;
++ result = mDisplayInformation->get_ResolutionScale(&resolutionScale);
++ ASSERT(SUCCEEDED(result));
++
++ mScaleFactor = DOUBLE(resolutionScale) / 100.0;
++#endif
++ }
++
++ if (SUCCEEDED(result))
++ {
+ // If a swapchain size is specfied, then the automatic resize
+ // behaviors implemented by the host should be disabled. The swapchain
+ // will be still be scaled when being rendered to fit the bounds
+@@ -60,7 +87,14 @@ bool CoreWindowNativeWindow::initialize(EGLNativeWindowType window, IPropertySet
+ }
+ else
+ {
+- result = GetCoreWindowSizeInPixels(mCoreWindow, &mClientRect);
++ ABI::Windows::Foundation::Rect rect;
++ HRESULT result = mCoreWindow->get_Bounds(&rect);
++ if (SUCCEEDED(result))
++ {
++ LONG width = std::floor(rect.Width * mScaleFactor + 0.5);
++ LONG height = std::floor(rect.Height * mScaleFactor + 0.5);
++ mClientRect = { 0, 0, width, height };
++ }
+ }
+ }
+
+@@ -76,12 +110,8 @@ bool CoreWindowNativeWindow::initialize(EGLNativeWindowType window, IPropertySet
+
+ bool CoreWindowNativeWindow::registerForSizeChangeEvents()
+ {
+- ComPtr<IWindowSizeChangedEventHandler> sizeChangedHandler;
+- HRESULT result = Microsoft::WRL::MakeAndInitialize<CoreWindowSizeChangedHandler>(sizeChangedHandler.ReleaseAndGetAddressOf(), this->shared_from_this());
+- if (SUCCEEDED(result))
+- {
+- result = mCoreWindow->add_SizeChanged(sizeChangedHandler.Get(), &mSizeChangedEventToken);
+- }
++ HRESULT result = mCoreWindow->add_SizeChanged(Callback<SizeChangedHandler>(this, &CoreWindowNativeWindow::onSizeChanged).Get(),
++ &mSizeChangedEventToken);
+
+ if (SUCCEEDED(result))
+ {
+@@ -126,7 +156,7 @@ HRESULT CoreWindowNativeWindow::createSwapChain(ID3D11Device *device, DXGIFactor
+ if (SUCCEEDED(result))
+ {
+
+-#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
++#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) // This block is disabled for Qt applications, as the resize events are expected
+ // Test if swapchain supports resize. On Windows Phone devices, this will return DXGI_ERROR_UNSUPPORTED. On
+ // other devices DXGI_ERROR_INVALID_CALL should be returned because the combination of flags passed
+ // (DXGI_SWAP_CHAIN_FLAG_NONPREROTATED | DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE) are invalid flag combinations.
+@@ -152,36 +182,19 @@ HRESULT CoreWindowNativeWindow::createSwapChain(ID3D11Device *device, DXGIFactor
+ return result;
+ }
+
+-HRESULT GetCoreWindowSizeInPixels(const ComPtr<ABI::Windows::UI::Core::ICoreWindow>& coreWindow, RECT *windowSize)
++// Basically, this shouldn't be used on Phone
++HRESULT CoreWindowNativeWindow::onSizeChanged(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IWindowSizeChangedEventArgs *e)
+ {
+- ABI::Windows::Foundation::Rect bounds;
+- HRESULT result = coreWindow->get_Bounds(&bounds);
+- if (SUCCEEDED(result))
++ ABI::Windows::Foundation::Size size;
++ if (SUCCEEDED(e->get_Size(&size)))
+ {
+- *windowSize = { 0, 0, ConvertDipsToPixels(bounds.Width), ConvertDipsToPixels(bounds.Height) };
++ SIZE windowSizeInPixels = {
++ std::floor(size.Width * mScaleFactor + 0.5),
++ std::floor(size.Height * mScaleFactor + 0.5)
++ };
++ setNewClientSize(windowSizeInPixels);
+ }
+
+- return result;
+-}
+-
+-static float GetLogicalDpi()
+-{
+- ComPtr<ABI::Windows::Graphics::Display::IDisplayPropertiesStatics> displayProperties;
+- float dpi = 96.0f;
+-
+- if (SUCCEEDED(GetActivationFactory(HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayProperties).Get(), displayProperties.GetAddressOf())))
+- {
+- if (SUCCEEDED(displayProperties->get_LogicalDpi(&dpi)))
+- {
+- return dpi;
+- }
+- }
+- return dpi;
+-}
+-
+-long ConvertDipsToPixels(float dips)
+-{
+- static const float dipsPerInch = 96.0f;
+- return lround((dips * GetLogicalDpi() / dipsPerInch));
++ return S_OK;
+ }
+ }
+diff --git a/src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.h b/src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.h
+index 0c6222d..1c55124 100644
+--- a/src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.h
++++ b/src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.h
+@@ -11,67 +11,29 @@
+
+ #include "common/winrt/InspectableNativeWindow.h"
+ #include <memory>
+-
+-typedef ABI::Windows::Foundation::__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CWindowSizeChangedEventArgs_t IWindowSizeChangedEventHandler;
++#include <windows.graphics.display.h>
+
+ namespace rx
+ {
+-long ConvertDipsToPixels(float dips);
+
+ class CoreWindowNativeWindow : public InspectableNativeWindow, public std::enable_shared_from_this<CoreWindowNativeWindow>
+ {
+ public:
+ ~CoreWindowNativeWindow();
+
+- bool initialize(EGLNativeWindowType window, IPropertySet *propertySet);
++ bool initialize(EGLNativeWindowType window, EGLNativeDisplayType display, IPropertySet *propertySet);
+ bool registerForSizeChangeEvents();
+ void unregisterForSizeChangeEvents();
+ HRESULT createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain);
+
+ private:
++ HRESULT onSizeChanged(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IWindowSizeChangedEventArgs *);
++
+ ComPtr<ABI::Windows::UI::Core::ICoreWindow> mCoreWindow;
++ ComPtr<ABI::Windows::Graphics::Display::IDisplayInformation> mDisplayInformation;
+ ComPtr<IMap<HSTRING, IInspectable*>> mPropertyMap;
+ };
+
+-[uuid(7F924F66-EBAE-40E5-A10B-B8F35E245190)]
+-class CoreWindowSizeChangedHandler :
+- public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, IWindowSizeChangedEventHandler>
+-{
+- public:
+- CoreWindowSizeChangedHandler() { }
+- HRESULT RuntimeClassInitialize(std::shared_ptr<InspectableNativeWindow> host)
+- {
+- if (!host)
+- {
+- return E_INVALIDARG;
+- }
+-
+- mHost = host;
+- return S_OK;
+- }
+-
+- // IWindowSizeChangedEventHandler
+- IFACEMETHOD(Invoke)(ABI::Windows::UI::Core::ICoreWindow *sender, ABI::Windows::UI::Core::IWindowSizeChangedEventArgs *sizeChangedEventArgs)
+- {
+- std::shared_ptr<InspectableNativeWindow> host = mHost.lock();
+- if (host)
+- {
+- ABI::Windows::Foundation::Size windowSize;
+- if (SUCCEEDED(sizeChangedEventArgs->get_Size(&windowSize)))
+- {
+- SIZE windowSizeInPixels = { ConvertDipsToPixels(windowSize.Width), ConvertDipsToPixels(windowSize.Height) };
+- host->setNewClientSize(windowSizeInPixels);
+- }
+- }
+-
+- return S_OK;
+- }
+-
+- private:
+- std::weak_ptr<InspectableNativeWindow> mHost;
+-};
+-
+-HRESULT GetCoreWindowSizeInPixels(const ComPtr<ABI::Windows::UI::Core::ICoreWindow>& coreWindow, RECT *windowSize);
+ }
+
+ #endif // COMMON_WINRT_COREWINDOWNATIVEWINDOW_H_
+diff --git a/src/3rdparty/angle/src/common/winrt/InspectableNativeWindow.cpp b/src/3rdparty/angle/src/common/winrt/InspectableNativeWindow.cpp
+index c062a48..0589f6d 100644
+--- a/src/3rdparty/angle/src/common/winrt/InspectableNativeWindow.cpp
++++ b/src/3rdparty/angle/src/common/winrt/InspectableNativeWindow.cpp
+@@ -11,9 +11,9 @@
+
+ namespace rx
+ {
+-NativeWindow::NativeWindow(EGLNativeWindowType window)
++NativeWindow::NativeWindow(EGLNativeWindowType window, EGLNativeDisplayType display)
++ : mWindow(window), mDisplay(display)
+ {
+- mWindow = window;
+ }
+
+ bool NativeWindow::initialize()
+@@ -40,7 +40,7 @@ bool NativeWindow::initialize()
+ mImpl = std::make_shared<CoreWindowNativeWindow>();
+ if (mImpl)
+ {
+- return mImpl->initialize(mWindow, propertySet.Get());
++ return mImpl->initialize(mWindow, mDisplay, propertySet.Get());
+ }
+ }
+ else if (IsSwapChainPanel(mWindow, &swapChainPanel))
+@@ -48,7 +48,7 @@ bool NativeWindow::initialize()
+ mImpl = std::make_shared<SwapChainPanelNativeWindow>();
+ if (mImpl)
+ {
+- return mImpl->initialize(mWindow, propertySet.Get());
++ return mImpl->initialize(mWindow, mDisplay, propertySet.Get());
+ }
+ }
+ else
+diff --git a/src/3rdparty/angle/src/common/winrt/InspectableNativeWindow.h b/src/3rdparty/angle/src/common/winrt/InspectableNativeWindow.h
+index c625348..402941a 100644
+--- a/src/3rdparty/angle/src/common/winrt/InspectableNativeWindow.h
++++ b/src/3rdparty/angle/src/common/winrt/InspectableNativeWindow.h
+@@ -32,13 +32,14 @@ class InspectableNativeWindow
+ mRequiresSwapChainScaling(false),
+ mClientRectChanged(false),
+ mClientRect({0,0,0,0}),
+- mNewClientRect({0,0,0,0})
++ mNewClientRect({0,0,0,0}),
++ mScaleFactor(1.0)
+ {
+ mSizeChangedEventToken.value = 0;
+ }
+ virtual ~InspectableNativeWindow(){}
+
+- virtual bool initialize(EGLNativeWindowType window, IPropertySet *propertySet) = 0;
++ virtual bool initialize(EGLNativeWindowType window, EGLNativeDisplayType display, IPropertySet *propertySet) = 0;
+ virtual HRESULT createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain) = 0;
+ virtual bool registerForSizeChangeEvents() = 0;
+ virtual void unregisterForSizeChangeEvents() = 0;
+@@ -49,6 +50,7 @@ class InspectableNativeWindow
+ if (mClientRectChanged && mSupportsSwapChainResize)
+ {
+ mClientRect = mNewClientRect;
++ mClientRectChanged = false;
+ }
+
+ *rect = mClientRect;
+@@ -76,6 +78,7 @@ protected:
+ RECT mClientRect;
+ RECT mNewClientRect;
+ bool mClientRectChanged;
++ DOUBLE mScaleFactor;
+
+ EventRegistrationToken mSizeChangedEventToken;
+ };
+diff --git a/src/3rdparty/angle/src/common/winrt/SwapChainPanelNativeWindow.cpp b/src/3rdparty/angle/src/common/winrt/SwapChainPanelNativeWindow.cpp
+index 4e4fb6d..268dfbd 100644
+--- a/src/3rdparty/angle/src/common/winrt/SwapChainPanelNativeWindow.cpp
++++ b/src/3rdparty/angle/src/common/winrt/SwapChainPanelNativeWindow.cpp
+@@ -18,7 +18,7 @@ SwapChainPanelNativeWindow::~SwapChainPanelNativeWindow()
+ unregisterForSizeChangeEvents();
+ }
+
+-bool SwapChainPanelNativeWindow::initialize(EGLNativeWindowType window, IPropertySet *propertySet)
++bool SwapChainPanelNativeWindow::initialize(EGLNativeWindowType window, EGLNativeDisplayType display, IPropertySet *propertySet)
+ {
+ ComPtr<IPropertySet> props = propertySet;
+ ComPtr<IInspectable> win = window;
+diff --git a/src/3rdparty/angle/src/common/winrt/SwapChainPanelNativeWindow.h b/src/3rdparty/angle/src/common/winrt/SwapChainPanelNativeWindow.h
+index e88f554..5bbf274 100644
+--- a/src/3rdparty/angle/src/common/winrt/SwapChainPanelNativeWindow.h
++++ b/src/3rdparty/angle/src/common/winrt/SwapChainPanelNativeWindow.h
+@@ -18,7 +18,7 @@ class SwapChainPanelNativeWindow : public InspectableNativeWindow, public std::e
+ public:
+ ~SwapChainPanelNativeWindow();
+
+- bool initialize(EGLNativeWindowType window, IPropertySet *propertySet);
++ bool initialize(EGLNativeWindowType window, EGLNativeDisplayType display, IPropertySet *propertySet);
+ bool registerForSizeChangeEvents();
+ void unregisterForSizeChangeEvents();
+ HRESULT createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain);
+diff --git a/src/3rdparty/angle/src/libEGL/Display.h b/src/3rdparty/angle/src/libEGL/Display.h
+index 378323a..b3ffcc8 100644
+--- a/src/3rdparty/angle/src/libEGL/Display.h
++++ b/src/3rdparty/angle/src/libEGL/Display.h
+@@ -67,6 +67,7 @@ class Display
+
+ const char *getExtensionString() const;
+ const char *getVendorString() const;
++ EGLNativeDisplayType getDisplayId() const { return mDisplayId; }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Display);
+diff --git a/src/3rdparty/angle/src/libEGL/Surface.cpp b/src/3rdparty/angle/src/libEGL/Surface.cpp
+index 3414656..b664a85 100644
+--- a/src/3rdparty/angle/src/libEGL/Surface.cpp
++++ b/src/3rdparty/angle/src/libEGL/Surface.cpp
+@@ -31,7 +31,7 @@ namespace egl
+ {
+
+ Surface::Surface(Display *display, const Config *config, EGLNativeWindowType window, EGLint fixedSize, EGLint width, EGLint height, EGLint postSubBufferSupported)
+- : mDisplay(display), mConfig(config), mNativeWindow(window), mPostSubBufferSupported(postSubBufferSupported)
++ : mDisplay(display), mConfig(config), mNativeWindow(window, display->getDisplayId()), mPostSubBufferSupported(postSubBufferSupported)
+ {
+ //TODO(jmadill): MANGLE refactor. (note, can't call makeRendererD3D because of dll export issues)
+ mRenderer = static_cast<rx::RendererD3D*>(mDisplay->getRenderer());
+@@ -47,6 +47,8 @@ Surface::Surface(Display *display, const Config *config, EGLNativeWindowType win
+ mSwapInterval = -1;
+ mWidth = width;
+ mHeight = height;
++ mFixedWidth = mWidth;
++ mFixedHeight = mHeight;
+ setSwapInterval(1);
+ mFixedSize = fixedSize;
+
+@@ -54,7 +56,7 @@ Surface::Surface(Display *display, const Config *config, EGLNativeWindowType win
+ }
+
+ Surface::Surface(Display *display, const Config *config, HANDLE shareHandle, EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureType)
+- : mDisplay(display), mNativeWindow(NULL), mConfig(config), mShareHandle(shareHandle), mWidth(width), mHeight(height), mPostSubBufferSupported(EGL_FALSE)
++ : mDisplay(display), mNativeWindow(NULL, NULL), mConfig(config), mShareHandle(shareHandle), mWidth(width), mHeight(height), mPostSubBufferSupported(EGL_FALSE)
+ {
+ //TODO(jmadill): MANGLE refactor. (note, can't call makeRendererD3D because of dll export issues)
+ mRenderer = static_cast<rx::RendererD3D*>(mDisplay->getRenderer());
+@@ -71,6 +73,8 @@ Surface::Surface(Display *display, const Config *config, HANDLE shareHandle, EGL
+ setSwapInterval(1);
+ // This constructor is for offscreen surfaces, which are always fixed-size.
+ mFixedSize = EGL_TRUE;
++ mFixedWidth = mWidth;
++ mFixedHeight = mHeight;
+ }
+
+ Surface::~Surface()
+@@ -157,10 +161,13 @@ Error Surface::resetSwapChain()
+
+ Error Surface::resizeSwapChain(int backbufferWidth, int backbufferHeight)
+ {
+- ASSERT(backbufferWidth >= 0 && backbufferHeight >= 0);
+ ASSERT(mSwapChain);
+
+- EGLint status = mSwapChain->resize(std::max(1, backbufferWidth), std::max(1, backbufferHeight));
++#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
++ backbufferWidth = std::max(1, backbufferWidth);
++ backbufferHeight = std::max(1, backbufferHeight);
++#endif
++ EGLint status = mSwapChain->resize(backbufferWidth, backbufferHeight);
+
+ if (status == EGL_CONTEXT_LOST)
+ {
+@@ -209,14 +216,14 @@ Error Surface::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
+ return Error(EGL_SUCCESS);
+ }
+
+- if (x + width > mWidth)
++ if (x + width > abs(mWidth))
+ {
+- width = mWidth - x;
++ width = abs(mWidth) - x;
+ }
+
+- if (y + height > mHeight)
++ if (y + height > abs(mHeight))
+ {
+- height = mHeight - y;
++ height = abs(mHeight) - y;
+ }
+
+ if (width == 0 || height == 0)
+@@ -224,6 +231,9 @@ Error Surface::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
+ return Error(EGL_SUCCESS);
+ }
+
++ ASSERT(width > 0);
++ ASSERT(height > 0);
++
+ EGLint status = mSwapChain->swapRect(x, y, width, height);
+
+ if (status == EGL_CONTEXT_LOST)
+@@ -352,6 +362,13 @@ bool Surface::checkForOutOfDateSwapChain()
+ sizeDirty = clientWidth != getWidth() || clientHeight != getHeight();
+ }
+
++ if (mFixedSize && (mWidth != mFixedWidth || mHeight != mFixedHeight))
++ {
++ clientWidth = mFixedWidth;
++ clientHeight = mFixedHeight;
++ sizeDirty = true;
++ }
++
+ bool wasDirty = (mSwapIntervalDirty || sizeDirty);
+
+ if (mSwapIntervalDirty)
+@@ -378,7 +395,7 @@ bool Surface::checkForOutOfDateSwapChain()
+
+ Error Surface::swap()
+ {
+- return swapRect(0, 0, mWidth, mHeight);
++ return swapRect(0, 0, abs(mWidth), abs(mHeight));
+ }
+
+ Error Surface::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height)
+@@ -471,6 +488,16 @@ EGLint Surface::isFixedSize() const
+ return mFixedSize;
+ }
+
++void Surface::setFixedWidth(EGLint width)
++{
++ mFixedWidth = width;
++}
++
++void Surface::setFixedHeight(EGLint height)
++{
++ mFixedHeight = height;
++}
++
+ EGLenum Surface::getFormat() const
+ {
+ return mConfig->mRenderTargetFormat;
+diff --git a/src/3rdparty/angle/src/libEGL/Surface.h b/src/3rdparty/angle/src/libEGL/Surface.h
+index 662fe21..46382d0 100644
+--- a/src/3rdparty/angle/src/libEGL/Surface.h
++++ b/src/3rdparty/angle/src/libEGL/Surface.h
+@@ -70,6 +70,8 @@ class Surface
+ virtual gl::Texture2D *getBoundTexture() const;
+
+ EGLint isFixedSize() const;
++ void setFixedWidth(EGLint width);
++ void setFixedHeight(EGLint height);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Surface);
+@@ -91,6 +93,8 @@ class Surface
+ const egl::Config *mConfig; // EGL config surface was created with
+ EGLint mHeight; // Height of surface
+ EGLint mWidth; // Width of surface
++ EGLint mFixedHeight; // Pending height of the surface
++ EGLint mFixedWidth; // Pending width of the surface
+ // EGLint horizontalResolution; // Horizontal dot pitch
+ // EGLint verticalResolution; // Vertical dot pitch
+ // EGLBoolean largestPBuffer; // If true, create largest pbuffer possible
+diff --git a/src/3rdparty/angle/src/libEGL/libEGL.cpp b/src/3rdparty/angle/src/libEGL/libEGL.cpp
+index 6110698..dc20d85 100644
+--- a/src/3rdparty/angle/src/libEGL/libEGL.cpp
++++ b/src/3rdparty/angle/src/libEGL/libEGL.cpp
+@@ -706,6 +706,26 @@ EGLBoolean __stdcall eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint
+ return EGL_FALSE;
+ }
+
++ switch (attribute)
++ {
++ case EGL_WIDTH:
++ if (!eglSurface->isFixedSize() || !value) {
++ recordError(egl::Error(EGL_BAD_PARAMETER));
++ return EGL_FALSE;
++ }
++ eglSurface->setFixedWidth(value);
++ return EGL_TRUE;
++ case EGL_HEIGHT:
++ if (!eglSurface->isFixedSize() || !value) {
++ recordError(egl::Error(EGL_BAD_PARAMETER));
++ return EGL_FALSE;
++ }
++ eglSurface->setFixedHeight(value);
++ return EGL_TRUE;
++ default:
++ break;
++ }
++
+ UNIMPLEMENTED(); // FIXME
+
+ recordError(egl::Error(EGL_SUCCESS));
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.h
+index 1655f1d..c789cae 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.h
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.h
+@@ -231,7 +231,7 @@ class Renderer11 : public RendererD3D
+
+ HMODULE mD3d11Module;
+ HMODULE mDxgiModule;
+- HDC mDc;
++ EGLNativeDisplayType mDc;
+ std::vector<D3D_FEATURE_LEVEL> mAvailableFeatureLevels;
+ D3D_DRIVER_TYPE mDriverType;
+
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/SwapChain11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/SwapChain11.cpp
+index 834b7bd..52c8a81 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/SwapChain11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/SwapChain11.cpp
+@@ -42,6 +42,8 @@ SwapChain11::SwapChain11(Renderer11 *renderer, NativeWindow nativeWindow, HANDLE
+ mPassThroughPS = NULL;
+ mWidth = -1;
+ mHeight = -1;
++ mRotateL = false;
++ mRotateR = false;
+ mSwapInterval = 0;
+ mAppCreatedShareHandle = mShareHandle != NULL;
+ mPassThroughResourcesInit = false;
+@@ -92,10 +94,11 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
+ ASSERT(device != NULL);
+
+ // D3D11 does not allow zero size textures
+- ASSERT(backbufferWidth >= 1);
+- ASSERT(backbufferHeight >= 1);
++ ASSERT(backbufferWidth != 0);
++ ASSERT(backbufferHeight != 0);
+
+ // Preserve the render target content
++#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+ ID3D11Texture2D *previousOffscreenTexture = mOffscreenTexture;
+ if (previousOffscreenTexture)
+ {
+@@ -103,6 +106,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
+ }
+ const int previousWidth = mWidth;
+ const int previousHeight = mHeight;
++#endif
+
+ releaseOffscreenTexture();
+
+@@ -136,8 +140,8 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
+ D3D11_TEXTURE2D_DESC offscreenTextureDesc = {0};
+ mOffscreenTexture->GetDesc(&offscreenTextureDesc);
+
+- if (offscreenTextureDesc.Width != (UINT)backbufferWidth ||
+- offscreenTextureDesc.Height != (UINT)backbufferHeight ||
++ if (offscreenTextureDesc.Width != UINT(abs(backbufferWidth)) ||
++ offscreenTextureDesc.Height != UINT(abs(backbufferHeight)) ||
+ offscreenTextureDesc.Format != backbufferFormatInfo.texFormat ||
+ offscreenTextureDesc.MipLevels != 1 ||
+ offscreenTextureDesc.ArraySize != 1)
+@@ -152,8 +156,8 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
+ const bool useSharedResource = !mNativeWindow.getNativeWindow() && mRenderer->getShareHandleSupport();
+
+ D3D11_TEXTURE2D_DESC offscreenTextureDesc = {0};
+- offscreenTextureDesc.Width = backbufferWidth;
+- offscreenTextureDesc.Height = backbufferHeight;
++ offscreenTextureDesc.Width = abs(backbufferWidth);
++ offscreenTextureDesc.Height = abs(backbufferHeight);
+ offscreenTextureDesc.Format = backbufferFormatInfo.texFormat;
+ offscreenTextureDesc.MipLevels = 1;
+ offscreenTextureDesc.ArraySize = 1;
+@@ -233,8 +237,8 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
+ if (mDepthBufferFormat != GL_NONE)
+ {
+ D3D11_TEXTURE2D_DESC depthStencilTextureDesc;
+- depthStencilTextureDesc.Width = backbufferWidth;
+- depthStencilTextureDesc.Height = backbufferHeight;
++ depthStencilTextureDesc.Width = abs(backbufferWidth);
++ depthStencilTextureDesc.Height = abs(backbufferHeight);
+ depthStencilTextureDesc.Format = depthBufferFormatInfo.texFormat;
+ depthStencilTextureDesc.MipLevels = 1;
+ depthStencilTextureDesc.ArraySize = 1;
+@@ -286,6 +290,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
+ mWidth = backbufferWidth;
+ mHeight = backbufferHeight;
+
++#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+ if (previousOffscreenTexture != NULL)
+ {
+ D3D11_BOX sourceBox = {0};
+@@ -307,6 +312,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
+ swapRect(0, 0, mWidth, mHeight);
+ }
+ }
++#endif
+
+ return EGL_SUCCESS;
+ }
+@@ -320,8 +326,16 @@ EGLint SwapChain11::resize(EGLint backbufferWidth, EGLint backbufferHeight)
+ return EGL_BAD_ACCESS;
+ }
+
++ // Windows Phone works around the rotation limitation by using negative values for the swap chain size
++#if defined(ANGLE_ENABLE_WINDOWS_STORE) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
++ mRotateL = backbufferWidth < 0; // Landscape/InvertedLandscape
++ mRotateR = backbufferHeight < 0; // InvertedPortrait/InvertedLandscape
++ backbufferWidth = abs(backbufferWidth);
++ backbufferHeight = abs(backbufferHeight);
++#endif
++
+ // EGL allows creating a surface with 0x0 dimension, however, DXGI does not like 0x0 swapchains
+- if (backbufferWidth < 1 || backbufferHeight < 1)
++ if (backbufferWidth == 0 || backbufferHeight == 0)
+ {
+ return EGL_SUCCESS;
+ }
+@@ -329,6 +343,7 @@ EGLint SwapChain11::resize(EGLint backbufferWidth, EGLint backbufferHeight)
+ // Can only call resize if we have already created our swap buffer and resources
+ ASSERT(mSwapChain && mBackBufferTexture && mBackBufferRTView);
+
++#if !defined(ANGLE_ENABLE_WINDOWS_STORE) || (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP) // The swap chain is not directly resized on Windows Phone
+ SafeRelease(mBackBufferTexture);
+ SafeRelease(mBackBufferRTView);
+
+@@ -366,6 +381,7 @@ EGLint SwapChain11::resize(EGLint backbufferWidth, EGLint backbufferHeight)
+ {
+ d3d11::SetDebugName(mBackBufferRTView, "Back buffer render target");
+ }
++#endif
+
+ return resetOffscreenTexture(backbufferWidth, backbufferHeight);
+ }
+@@ -512,16 +528,6 @@ EGLint SwapChain11::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+- // Set vertices
+- D3D11_MAPPED_SUBRESOURCE mappedResource;
+- HRESULT result = deviceContext->Map(mQuadVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
+- if (FAILED(result))
+- {
+- return EGL_BAD_ACCESS;
+- }
+-
+- d3d11::PositionTexCoordVertex *vertices = static_cast<d3d11::PositionTexCoordVertex*>(mappedResource.pData);
+-
+ // Create a quad in homogeneous coordinates
+ float x1 = (x / float(mWidth)) * 2.0f - 1.0f;
+ float y1 = (y / float(mHeight)) * 2.0f - 1.0f;
+@@ -533,10 +539,23 @@ EGLint SwapChain11::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
+ float u2 = (x + width) / float(mWidth);
+ float v2 = (y + height) / float(mHeight);
+
+- d3d11::SetPositionTexCoordVertex(&vertices[0], x1, y1, u1, v1);
+- d3d11::SetPositionTexCoordVertex(&vertices[1], x1, y2, u1, v2);
+- d3d11::SetPositionTexCoordVertex(&vertices[2], x2, y1, u2, v1);
+- d3d11::SetPositionTexCoordVertex(&vertices[3], x2, y2, u2, v2);
++ const bool rotateL = mRotateL;
++ const bool rotateR = mRotateR;
++
++ // Set vertices
++ D3D11_MAPPED_SUBRESOURCE mappedResource;
++ HRESULT result = deviceContext->Map(mQuadVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
++ if (FAILED(result))
++ {
++ return EGL_BAD_ACCESS;
++ }
++
++ d3d11::PositionTexCoordVertex *vertices = static_cast<d3d11::PositionTexCoordVertex*>(mappedResource.pData);
++
++ d3d11::SetPositionTexCoordVertex(&vertices[0], x1, y1, rotateL ? u2 : u1, rotateR ? v2 : v1);
++ d3d11::SetPositionTexCoordVertex(&vertices[1], x1, y2, rotateR ? u2 : u1, rotateL ? v1 : v2);
++ d3d11::SetPositionTexCoordVertex(&vertices[2], x2, y1, rotateR ? u1 : u2, rotateL ? v2 : v1);
++ d3d11::SetPositionTexCoordVertex(&vertices[3], x2, y2, rotateL ? u1 : u2, rotateR ? v1 : v2);
+
+ deviceContext->Unmap(mQuadVB, 0);
+
+@@ -564,10 +583,11 @@ EGLint SwapChain11::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
+
+ // Set the viewport
+ D3D11_VIEWPORT viewport;
+- viewport.TopLeftX = 0;
+- viewport.TopLeftY = 0;
+- viewport.Width = mWidth;
+- viewport.Height = mHeight;
++ viewport.TopLeftX = 0.0f;
++ viewport.TopLeftY = 0.0f;
++ const bool invertViewport = (mRotateL || mRotateR) && !(mRotateL && mRotateR);
++ viewport.Width = FLOAT(invertViewport ? mHeight : mWidth);
++ viewport.Height = FLOAT(invertViewport ? mWidth : mHeight);
+ viewport.MinDepth = 0.0f;
+ viewport.MaxDepth = 1.0f;
+ deviceContext->RSSetViewports(1, &viewport);
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/SwapChain11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/SwapChain11.h
+index 22401d8..77509ed 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/SwapChain11.h
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/SwapChain11.h
+@@ -52,6 +52,8 @@ class SwapChain11 : public SwapChain
+ Renderer11 *mRenderer;
+ EGLint mHeight;
+ EGLint mWidth;
++ bool mRotateL;
++ bool mRotateR;
+ bool mAppCreatedShareHandle;
+ unsigned int mSwapInterval;
+ bool mPassThroughResourcesInit;
+--
+1.9.4.msysgit.1
+
diff --git a/0010-ANGLE-Enable-D3D11-for-feature-level-9-cards.patch b/0010-ANGLE-Enable-D3D11-for-feature-level-9-cards.patch
new file mode 100644
index 000000000000..dd2768cf3ed7
--- /dev/null
+++ b/0010-ANGLE-Enable-D3D11-for-feature-level-9-cards.patch
@@ -0,0 +1,637 @@
+From 829bf86c57357d3c8ec598b92fcfdb1849e84075 Mon Sep 17 00:00:00 2001
+From: Andrew Knight <andrew.knight@theqtcompany.com>
+Date: Tue, 11 Nov 2014 17:11:54 +0200
+Subject: [PATCH 10/16] ANGLE: Enable D3D11 for feature level 9 cards
+
+Enable use of ANGLE on lower-end hardware, such as Surface RT and
+Windows Phone 8.
+
+Change-Id: Ice536802e4eedc1d264abd0dd65960638fce59e4
+---
+ src/3rdparty/angle/src/libGLESv2/angletypes.cpp | 6 +-
+ .../src/libGLESv2/renderer/d3d/d3d11/Blit11.cpp | 69 ++++---
+ .../src/libGLESv2/renderer/d3d/d3d11/Buffer11.cpp | 4 +-
+ .../src/libGLESv2/renderer/d3d/d3d11/Clear11.cpp | 7 +-
+ .../renderer/d3d/d3d11/PixelTransfer11.cpp | 9 +-
+ .../libGLESv2/renderer/d3d/d3d11/Renderer11.cpp | 226 +++++++++++++--------
+ .../src/libGLESv2/renderer/d3d/d3d11/Renderer11.h | 1 +
+ .../renderer/d3d/d3d11/TextureStorage11.cpp | 4 +-
+ .../libGLESv2/renderer/d3d/d3d11/formatutils11.cpp | 4 +-
+ .../renderer/d3d/d3d11/renderer11_utils.cpp | 2 +-
+ 10 files changed, 208 insertions(+), 124 deletions(-)
+
+diff --git a/src/3rdparty/angle/src/libGLESv2/angletypes.cpp b/src/3rdparty/angle/src/libGLESv2/angletypes.cpp
+index 6fd02e0..5a0cfc5 100644
+--- a/src/3rdparty/angle/src/libGLESv2/angletypes.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/angletypes.cpp
+@@ -12,6 +12,8 @@
+ #include "libGLESv2/State.h"
+ #include "libGLESv2/VertexArray.h"
+
++#include <float.h>
++
+ namespace gl
+ {
+
+@@ -24,8 +26,8 @@ SamplerState::SamplerState()
+ maxAnisotropy(1.0f),
+ baseLevel(0),
+ maxLevel(1000),
+- minLod(-1000.0f),
+- maxLod(1000.0f),
++ minLod(-FLT_MAX),
++ maxLod(FLT_MAX),
+ compareMode(GL_NONE),
+ compareFunc(GL_LEQUAL),
+ swizzleRed(GL_RED),
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Blit11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Blit11.cpp
+index 91e7552..06aea9b 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Blit11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Blit11.cpp
+@@ -209,7 +209,7 @@ Blit11::Blit11(Renderer11 *renderer)
+ pointSamplerDesc.BorderColor[2] = 0.0f;
+ pointSamplerDesc.BorderColor[3] = 0.0f;
+ pointSamplerDesc.MinLOD = 0.0f;
+- pointSamplerDesc.MaxLOD = 0.0f;
++ pointSamplerDesc.MaxLOD = mRenderer->isLevel9() ? D3D11_FLOAT32_MAX : 0.0f;
+
+ result = device->CreateSamplerState(&pointSamplerDesc, &mPointSampler);
+ ASSERT(SUCCEEDED(result));
+@@ -228,7 +228,7 @@ Blit11::Blit11(Renderer11 *renderer)
+ linearSamplerDesc.BorderColor[2] = 0.0f;
+ linearSamplerDesc.BorderColor[3] = 0.0f;
+ linearSamplerDesc.MinLOD = 0.0f;
+- linearSamplerDesc.MaxLOD = 0.0f;
++ linearSamplerDesc.MaxLOD = mRenderer->isLevel9() ? D3D11_FLOAT32_MAX : 0.0f;
+
+ result = device->CreateSamplerState(&linearSamplerDesc, &mLinearSampler);
+ ASSERT(SUCCEEDED(result));
+@@ -290,28 +290,31 @@ Blit11::Blit11(Renderer11 *renderer)
+ ASSERT(SUCCEEDED(result));
+ d3d11::SetDebugName(mQuad2DVS, "Blit11 2D vertex shader");
+
+- result = device->CreatePixelShader(g_PS_PassthroughDepth2D, ArraySize(g_PS_PassthroughDepth2D), NULL, &mDepthPS);
+- ASSERT(SUCCEEDED(result));
+- d3d11::SetDebugName(mDepthPS, "Blit11 2D depth pixel shader");
+-
+- D3D11_INPUT_ELEMENT_DESC quad3DLayout[] =
++ if (!renderer->isLevel9())
+ {
+- { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+- { "LAYER", 0, DXGI_FORMAT_R32_UINT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+- { "TEXCOORD", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+- };
+-
+- result = device->CreateInputLayout(quad3DLayout, ArraySize(quad3DLayout), g_VS_Passthrough3D, ArraySize(g_VS_Passthrough3D), &mQuad3DIL);
+- ASSERT(SUCCEEDED(result));
+- d3d11::SetDebugName(mQuad3DIL, "Blit11 3D input layout");
+-
+- result = device->CreateVertexShader(g_VS_Passthrough3D, ArraySize(g_VS_Passthrough3D), NULL, &mQuad3DVS);
+- ASSERT(SUCCEEDED(result));
+- d3d11::SetDebugName(mQuad3DVS, "Blit11 3D vertex shader");
++ result = device->CreatePixelShader(g_PS_PassthroughDepth2D, ArraySize(g_PS_PassthroughDepth2D), NULL, &mDepthPS);
++ ASSERT(SUCCEEDED(result));
++ d3d11::SetDebugName(mDepthPS, "Blit11 2D depth pixel shader");
+
+- result = device->CreateGeometryShader(g_GS_Passthrough3D, ArraySize(g_GS_Passthrough3D), NULL, &mQuad3DGS);
+- ASSERT(SUCCEEDED(result));
+- d3d11::SetDebugName(mQuad3DGS, "Renderer11 copy 3D texture geometry shader");
++ D3D11_INPUT_ELEMENT_DESC quad3DLayout[] =
++ {
++ { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
++ { "LAYER", 0, DXGI_FORMAT_R32_UINT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0 },
++ { "TEXCOORD", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
++ };
++
++ result = device->CreateInputLayout(quad3DLayout, ArraySize(quad3DLayout), g_VS_Passthrough3D, ArraySize(g_VS_Passthrough3D), &mQuad3DIL);
++ ASSERT(SUCCEEDED(result));
++ d3d11::SetDebugName(mQuad3DIL, "Blit11 3D input layout");
++
++ result = device->CreateVertexShader(g_VS_Passthrough3D, ArraySize(g_VS_Passthrough3D), NULL, &mQuad3DVS);
++ ASSERT(SUCCEEDED(result));
++ d3d11::SetDebugName(mQuad3DVS, "Blit11 3D vertex shader");
++
++ result = device->CreateGeometryShader(g_GS_Passthrough3D, ArraySize(g_GS_Passthrough3D), NULL, &mQuad3DGS);
++ ASSERT(SUCCEEDED(result));
++ d3d11::SetDebugName(mQuad3DGS, "Renderer11 copy 3D texture geometry shader");
++ }
+
+ buildShaderMap();
+
+@@ -970,22 +973,27 @@ void Blit11::buildShaderMap()
+ ID3D11Device *device = mRenderer->getDevice();
+
+ add2DBlitShaderToMap(GL_RGBA, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2D, "Blit11 2D RGBA pixel shader" ));
+- add2DBlitShaderToMap(GL_RGBA_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2DUI, "Blit11 2D RGBA UI pixel shader" ));
+- add2DBlitShaderToMap(GL_RGBA_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGBA2DI, "Blit11 2D RGBA I pixel shader" ));
+ add2DBlitShaderToMap(GL_BGRA_EXT, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2D, "Blit11 2D BGRA pixel shader" ));
+ add2DBlitShaderToMap(GL_RGB, false, d3d11::CompilePS(device, g_PS_PassthroughRGB2D, "Blit11 2D RGB pixel shader" ));
+- add2DBlitShaderToMap(GL_RGB_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGB2DUI, "Blit11 2D RGB UI pixel shader" ));
+- add2DBlitShaderToMap(GL_RGB_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGB2DI, "Blit11 2D RGB I pixel shader" ));
+ add2DBlitShaderToMap(GL_RG, false, d3d11::CompilePS(device, g_PS_PassthroughRG2D, "Blit11 2D RG pixel shader" ));
+- add2DBlitShaderToMap(GL_RG_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRG2DUI, "Blit11 2D RG UI pixel shader" ));
+- add2DBlitShaderToMap(GL_RG_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRG2DI, "Blit11 2D RG I pixel shader" ));
+ add2DBlitShaderToMap(GL_RED, false, d3d11::CompilePS(device, g_PS_PassthroughR2D, "Blit11 2D R pixel shader" ));
+- add2DBlitShaderToMap(GL_RED_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughR2DUI, "Blit11 2D R UI pixel shader" ));
+- add2DBlitShaderToMap(GL_RED_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughR2DI, "Blit11 2D R I pixel shader" ));
+ add2DBlitShaderToMap(GL_ALPHA, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2D, "Blit11 2D alpha pixel shader" ));
+ add2DBlitShaderToMap(GL_LUMINANCE, false, d3d11::CompilePS(device, g_PS_PassthroughLum2D, "Blit11 2D lum pixel shader" ));
+ add2DBlitShaderToMap(GL_LUMINANCE_ALPHA, false, d3d11::CompilePS(device, g_PS_PassthroughLumAlpha2D, "Blit11 2D luminance alpha pixel shader"));
+
++ addSwizzleShaderToMap(GL_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, d3d11::CompilePS(device, g_PS_SwizzleF2D, "Blit11 2D F swizzle pixel shader" ));
++
++ if (mRenderer->isLevel9())
++ return;
++
++ add2DBlitShaderToMap(GL_RGBA_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2DUI, "Blit11 2D RGBA UI pixel shader" ));
++ add2DBlitShaderToMap(GL_RGBA_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGBA2DI, "Blit11 2D RGBA I pixel shader" ));
++ add2DBlitShaderToMap(GL_RGB_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGB2DUI, "Blit11 2D RGB UI pixel shader" ));
++ add2DBlitShaderToMap(GL_RGB_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGB2DI, "Blit11 2D RGB I pixel shader" ));
++ add2DBlitShaderToMap(GL_RG_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRG2DUI, "Blit11 2D RG UI pixel shader" ));
++ add2DBlitShaderToMap(GL_RG_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRG2DI, "Blit11 2D RG I pixel shader" ));
++ add2DBlitShaderToMap(GL_RED_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughR2DUI, "Blit11 2D R UI pixel shader" ));
++ add2DBlitShaderToMap(GL_RED_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughR2DI, "Blit11 2D R I pixel shader" ));
+ add3DBlitShaderToMap(GL_RGBA, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA3D, "Blit11 3D RGBA pixel shader" ));
+ add3DBlitShaderToMap(GL_RGBA_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA3DUI, "Blit11 3D UI RGBA pixel shader" ));
+ add3DBlitShaderToMap(GL_RGBA_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGBA3DI, "Blit11 3D I RGBA pixel shader" ));
+@@ -1003,7 +1011,6 @@ void Blit11::buildShaderMap()
+ add3DBlitShaderToMap(GL_LUMINANCE, false, d3d11::CompilePS(device, g_PS_PassthroughLum3D, "Blit11 3D luminance pixel shader" ));
+ add3DBlitShaderToMap(GL_LUMINANCE_ALPHA, false, d3d11::CompilePS(device, g_PS_PassthroughLumAlpha3D, "Blit11 3D luminance alpha pixel shader"));
+
+- addSwizzleShaderToMap(GL_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, d3d11::CompilePS(device, g_PS_SwizzleF2D, "Blit11 2D F swizzle pixel shader" ));
+ addSwizzleShaderToMap(GL_UNSIGNED_INT, D3D_SRV_DIMENSION_TEXTURE2D, d3d11::CompilePS(device, g_PS_SwizzleUI2D, "Blit11 2D UI swizzle pixel shader"));
+ addSwizzleShaderToMap(GL_INT, D3D_SRV_DIMENSION_TEXTURE2D, d3d11::CompilePS(device, g_PS_SwizzleI2D, "Blit11 2D I swizzle pixel shader" ));
+
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Buffer11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Buffer11.cpp
+index 2d5fa3c..5aab379 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Buffer11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Buffer11.cpp
+@@ -753,7 +753,9 @@ void Buffer11::NativeBuffer11::fillBufferDesc(D3D11_BUFFER_DESC* bufferDesc, Ren
+
+ case BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK:
+ bufferDesc->Usage = D3D11_USAGE_DEFAULT;
+- bufferDesc->BindFlags = D3D11_BIND_VERTEX_BUFFER | D3D11_BIND_STREAM_OUTPUT;
++ bufferDesc->BindFlags = D3D11_BIND_VERTEX_BUFFER;
++ if (!renderer->isLevel9())
++ bufferDesc->BindFlags |= D3D11_BIND_STREAM_OUTPUT;
+ bufferDesc->CPUAccessFlags = 0;
+ break;
+
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Clear11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Clear11.cpp
+index 4630762..7185a05 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Clear11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Clear11.cpp
+@@ -104,7 +104,7 @@ Clear11::Clear11(Renderer11 *renderer)
+ rsDesc.DepthBias = 0;
+ rsDesc.DepthBiasClamp = 0.0f;
+ rsDesc.SlopeScaledDepthBias = 0.0f;
+- rsDesc.DepthClipEnable = FALSE;
++ rsDesc.DepthClipEnable = renderer->isLevel9();
+ rsDesc.ScissorEnable = FALSE;
+ rsDesc.MultisampleEnable = FALSE;
+ rsDesc.AntialiasedLineEnable = FALSE;
+@@ -114,6 +114,11 @@ Clear11::Clear11(Renderer11 *renderer)
+ d3d11::SetDebugName(mRasterizerState, "Clear11 masked clear rasterizer state");
+
+ mFloatClearShader = CreateClearShader(device, DXGI_FORMAT_R32G32B32A32_FLOAT, g_VS_ClearFloat, g_PS_ClearFloat);
++ if (mRenderer->isLevel9()) {
++ memset(&mUintClearShader, 0, sizeof(ClearShader));
++ memset(&mIntClearShader, 0, sizeof(ClearShader));
++ return;
++ }
+ mUintClearShader = CreateClearShader(device, DXGI_FORMAT_R32G32B32A32_UINT, g_VS_ClearUint, g_PS_ClearUint );
+ mIntClearShader = CreateClearShader(device, DXGI_FORMAT_R32G32B32A32_SINT, g_VS_ClearSint, g_PS_ClearSint );
+ }
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/PixelTransfer11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/PixelTransfer11.cpp
+index a4072d8..6a3d347 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/PixelTransfer11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/PixelTransfer11.cpp
+@@ -133,10 +133,13 @@ gl::Error PixelTransfer11::loadResources()
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create internal buffer to texture vertex shader.");
+ }
+
+- mBufferToTextureGS = d3d11::CompileGS(device, g_GS_BufferToTexture, "BufferToTexture GS");
+- if (!mBufferToTextureGS)
++ if (!mRenderer->isLevel9())
+ {
+- return gl::Error(GL_OUT_OF_MEMORY, "Failed to create internal buffer to texture geometry shader.");
++ mBufferToTextureGS = d3d11::CompileGS(device, g_GS_BufferToTexture, "BufferToTexture GS");
++ if (!mBufferToTextureGS)
++ {
++ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create internal buffer to texture geometry shader.");
++ }
+ }
+
+ gl::Error error = buildShaderMap();
+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 ffc6cc9..f6ba930 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp
+@@ -153,6 +153,24 @@ Renderer11::Renderer11(egl::Display *display, EGLNativeDisplayType hDc, const eg
+ }
+ }
+
++#if !defined(ANGLE_ENABLE_D3D9)
++ if (requestedMajorVersion == EGL_DONT_CARE || requestedMajorVersion >= 9)
++ {
++ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 3)
++ {
++ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_3);
++ }
++ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 2)
++ {
++ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_2);
++ }
++ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 1)
++ {
++ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_1);
++ }
++ }
++#endif
++
+ mDriverType = (attributes.get(EGL_PLATFORM_ANGLE_USE_WARP_ANGLE, EGL_FALSE) == EGL_TRUE) ? D3D_DRIVER_TYPE_WARP
+ : D3D_DRIVER_TYPE_HARDWARE;
+ }
+@@ -1170,6 +1188,83 @@ gl::Error Renderer11::drawElements(GLenum mode, GLsizei count, GLenum type, cons
+ return gl::Error(GL_NO_ERROR);
+ }
+ }
++template<typename T>
++static void fillLineLoopIndices(GLenum type, GLsizei count, const GLvoid *indices, T *data)
++{
++ switch (type)
++ {
++ case GL_NONE: // Non-indexed draw
++ for (int i = 0; i < count; i++)
++ {
++ data[i] = i;
++ }
++ data[count] = 0;
++ break;
++ case GL_UNSIGNED_BYTE:
++ for (int i = 0; i < count; i++)
++ {
++ data[i] = static_cast<const GLubyte*>(indices)[i];
++ }
++ data[count] = static_cast<const GLubyte*>(indices)[0];
++ break;
++ case GL_UNSIGNED_SHORT:
++ for (int i = 0; i < count; i++)
++ {
++ data[i] = static_cast<const GLushort*>(indices)[i];
++ }
++ data[count] = static_cast<const GLushort*>(indices)[0];
++ break;
++ case GL_UNSIGNED_INT:
++ for (int i = 0; i < count; i++)
++ {
++ data[i] = static_cast<const GLuint*>(indices)[i];
++ }
++ data[count] = static_cast<const GLuint*>(indices)[0];
++ break;
++ default: UNREACHABLE();
++ }
++}
++
++template<typename T>
++static void fillTriangleFanIndices(GLenum type, unsigned int numTris, const GLvoid *indices, T *data)
++{
++ switch (type)
++ {
++ case GL_NONE: // Non-indexed draw
++ for (unsigned int i = 0; i < numTris; i++)
++ {
++ data[i*3 + 0] = 0;
++ data[i*3 + 1] = i + 1;
++ data[i*3 + 2] = i + 2;
++ }
++ break;
++ case GL_UNSIGNED_BYTE:
++ for (unsigned int i = 0; i < numTris; i++)
++ {
++ data[i*3 + 0] = static_cast<const GLubyte*>(indices)[0];
++ data[i*3 + 1] = static_cast<const GLubyte*>(indices)[i + 1];
++ data[i*3 + 2] = static_cast<const GLubyte*>(indices)[i + 2];
++ }
++ break;
++ case GL_UNSIGNED_SHORT:
++ for (unsigned int i = 0; i < numTris; i++)
++ {
++ data[i*3 + 0] = static_cast<const GLushort*>(indices)[0];
++ data[i*3 + 1] = static_cast<const GLushort*>(indices)[i + 1];
++ data[i*3 + 2] = static_cast<const GLushort*>(indices)[i + 2];
++ }
++ break;
++ case GL_UNSIGNED_INT:
++ for (unsigned int i = 0; i < numTris; i++)
++ {
++ data[i*3 + 0] = static_cast<const GLuint*>(indices)[0];
++ data[i*3 + 1] = static_cast<const GLuint*>(indices)[i + 1];
++ data[i*3 + 2] = static_cast<const GLuint*>(indices)[i + 2];
++ }
++ break;
++ default: UNREACHABLE();
++ }
++}
+
+ gl::Error Renderer11::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer)
+ {
+@@ -1189,10 +1284,13 @@ gl::Error Renderer11::drawLineLoop(GLsizei count, GLenum type, const GLvoid *ind
+ indices = bufferData + offset;
+ }
+
++ // TODO: some level 9 hardware supports 32-bit indices; test and store support instead
++ const int indexType = isLevel9() ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT;
++
+ if (!mLineLoopIB)
+ {
+ mLineLoopIB = new StreamingIndexBufferInterface(this);
+- gl::Error error = mLineLoopIB->reserveBufferSpace(INITIAL_INDEX_BUFFER_SIZE, GL_UNSIGNED_INT);
++ gl::Error error = mLineLoopIB->reserveBufferSpace(INITIAL_INDEX_BUFFER_SIZE, indexType);
+ if (error.isError())
+ {
+ SafeDelete(mLineLoopIB);
+@@ -1203,7 +1301,8 @@ gl::Error Renderer11::drawLineLoop(GLsizei count, GLenum type, const GLvoid *ind
+ // Checked by Renderer11::applyPrimitiveType
+ ASSERT(count >= 0);
+
+- if (static_cast<unsigned int>(count) + 1 > (std::numeric_limits<unsigned int>::max() / sizeof(unsigned int)))
++ int indexTypeSize = indexType == GL_UNSIGNED_SHORT ? sizeof(unsigned short) : sizeof(unsigned int);
++ if (static_cast<unsigned int>(count) + 1 > (std::numeric_limits<unsigned int>::max() / indexTypeSize))
+ {
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create a 32-bit looping index buffer for GL_LINE_LOOP, too many indices required.");
+ }
+@@ -1223,42 +1322,12 @@ gl::Error Renderer11::drawLineLoop(GLsizei count, GLenum type, const GLvoid *ind
+ return error;
+ }
+
+- unsigned int *data = reinterpret_cast<unsigned int*>(mappedMemory);
++ if (indexType == GL_UNSIGNED_SHORT)
++ fillLineLoopIndices(type, count, indices, reinterpret_cast<unsigned short*>(mappedMemory));
++ else
++ fillLineLoopIndices(type, count, indices, reinterpret_cast<unsigned int*>(mappedMemory));
+ unsigned int indexBufferOffset = offset;
+
+- switch (type)
+- {
+- case GL_NONE: // Non-indexed draw
+- for (int i = 0; i < count; i++)
+- {
+- data[i] = i;
+- }
+- data[count] = 0;
+- break;
+- case GL_UNSIGNED_BYTE:
+- for (int i = 0; i < count; i++)
+- {
+- data[i] = static_cast<const GLubyte*>(indices)[i];
+- }
+- data[count] = static_cast<const GLubyte*>(indices)[0];
+- break;
+- case GL_UNSIGNED_SHORT:
+- for (int i = 0; i < count; i++)
+- {
+- data[i] = static_cast<const GLushort*>(indices)[i];
+- }
+- data[count] = static_cast<const GLushort*>(indices)[0];
+- break;
+- case GL_UNSIGNED_INT:
+- for (int i = 0; i < count; i++)
+- {
+- data[i] = static_cast<const GLuint*>(indices)[i];
+- }
+- data[count] = static_cast<const GLuint*>(indices)[0];
+- break;
+- default: UNREACHABLE();
+- }
+-
+ error = mLineLoopIB->unmapBuffer();
+ if (error.isError())
+ {
+@@ -1300,10 +1369,12 @@ gl::Error Renderer11::drawTriangleFan(GLsizei count, GLenum type, const GLvoid *
+ indices = bufferData + offset;
+ }
+
++ const int indexType = isLevel9() ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT;
++
+ if (!mTriangleFanIB)
+ {
+ mTriangleFanIB = new StreamingIndexBufferInterface(this);
+- gl::Error error = mTriangleFanIB->reserveBufferSpace(INITIAL_INDEX_BUFFER_SIZE, GL_UNSIGNED_INT);
++ gl::Error error = mTriangleFanIB->reserveBufferSpace(INITIAL_INDEX_BUFFER_SIZE, indexType);
+ if (error.isError())
+ {
+ SafeDelete(mTriangleFanIB);
+@@ -1316,13 +1387,14 @@ gl::Error Renderer11::drawTriangleFan(GLsizei count, GLenum type, const GLvoid *
+
+ const unsigned int numTris = count - 2;
+
+- if (numTris > (std::numeric_limits<unsigned int>::max() / (sizeof(unsigned int) * 3)))
++ int indexTypeSize = indexType == GL_UNSIGNED_SHORT ? sizeof(unsigned short) : sizeof(unsigned int);
++ if (numTris > (std::numeric_limits<unsigned int>::max() / (indexTypeSize * 3)))
+ {
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create a scratch index buffer for GL_TRIANGLE_FAN, too many indices required.");
+ }
+
+- const unsigned int spaceNeeded = (numTris * 3) * sizeof(unsigned int);
+- gl::Error error = mTriangleFanIB->reserveBufferSpace(spaceNeeded, GL_UNSIGNED_INT);
++ const unsigned int spaceNeeded = (numTris * 3) * indexTypeSize;
++ gl::Error error = mTriangleFanIB->reserveBufferSpace(spaceNeeded, indexType);
+ if (error.isError())
+ {
+ return error;
+@@ -1336,45 +1408,12 @@ gl::Error Renderer11::drawTriangleFan(GLsizei count, GLenum type, const GLvoid *
+ return error;
+ }
+
+- unsigned int *data = reinterpret_cast<unsigned int*>(mappedMemory);
+- unsigned int indexBufferOffset = offset;
++ if (indexType == GL_UNSIGNED_SHORT)
++ fillTriangleFanIndices(type, numTris, indices, reinterpret_cast<unsigned short*>(mappedMemory));
++ else
++ fillTriangleFanIndices(type, numTris, indices, reinterpret_cast<unsigned int*>(mappedMemory));
+
+- switch (type)
+- {
+- case GL_NONE: // Non-indexed draw
+- for (unsigned int i = 0; i < numTris; i++)
+- {
+- data[i*3 + 0] = 0;
+- data[i*3 + 1] = i + 1;
+- data[i*3 + 2] = i + 2;
+- }
+- break;
+- case GL_UNSIGNED_BYTE:
+- for (unsigned int i = 0; i < numTris; i++)
+- {
+- data[i*3 + 0] = static_cast<const GLubyte*>(indices)[0];
+- data[i*3 + 1] = static_cast<const GLubyte*>(indices)[i + 1];
+- data[i*3 + 2] = static_cast<const GLubyte*>(indices)[i + 2];
+- }
+- break;
+- case GL_UNSIGNED_SHORT:
+- for (unsigned int i = 0; i < numTris; i++)
+- {
+- data[i*3 + 0] = static_cast<const GLushort*>(indices)[0];
+- data[i*3 + 1] = static_cast<const GLushort*>(indices)[i + 1];
+- data[i*3 + 2] = static_cast<const GLushort*>(indices)[i + 2];
+- }
+- break;
+- case GL_UNSIGNED_INT:
+- for (unsigned int i = 0; i < numTris; i++)
+- {
+- data[i*3 + 0] = static_cast<const GLuint*>(indices)[0];
+- data[i*3 + 1] = static_cast<const GLuint*>(indices)[i + 1];
+- data[i*3 + 2] = static_cast<const GLuint*>(indices)[i + 2];
+- }
+- break;
+- default: UNREACHABLE();
+- }
++ unsigned int indexBufferOffset = offset;
+
+ error = mTriangleFanIB->unmapBuffer();
+ if (error.isError())
+@@ -1634,7 +1673,7 @@ gl::Error Renderer11::applyUniforms(const ProgramImpl &program, const std::vecto
+ }
+
+ // needed for the point sprite geometry shader
+- if (mCurrentGeometryConstantBuffer != mDriverConstantBufferPS)
++ if (mFeatureLevel >= D3D_FEATURE_LEVEL_10_0 && mCurrentGeometryConstantBuffer != mDriverConstantBufferPS)
+ {
+ mDeviceContext->GSSetConstantBuffers(0, 1, &mDriverConstantBufferPS);
+ mCurrentGeometryConstantBuffer = mDriverConstantBufferPS;
+@@ -1938,7 +1977,10 @@ int Renderer11::getMajorShaderModel() const
+ {
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_SHADER_MAJOR_VERSION; // 5
+ case D3D_FEATURE_LEVEL_10_1: return D3D10_1_SHADER_MAJOR_VERSION; // 4
+- case D3D_FEATURE_LEVEL_10_0: return D3D10_SHADER_MAJOR_VERSION; // 4
++ case D3D_FEATURE_LEVEL_10_0:
++ case D3D_FEATURE_LEVEL_9_3:
++ case D3D_FEATURE_LEVEL_9_2:
++ case D3D_FEATURE_LEVEL_9_1: return D3D10_SHADER_MAJOR_VERSION; // 4
+ default: UNREACHABLE(); return 0;
+ }
+ }
+@@ -1949,7 +1991,10 @@ int Renderer11::getMinorShaderModel() const
+ {
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_SHADER_MINOR_VERSION; // 0
+ case D3D_FEATURE_LEVEL_10_1: return D3D10_1_SHADER_MINOR_VERSION; // 1
+- case D3D_FEATURE_LEVEL_10_0: return D3D10_SHADER_MINOR_VERSION; // 0
++ case D3D_FEATURE_LEVEL_10_0:
++ case D3D_FEATURE_LEVEL_9_3:
++ case D3D_FEATURE_LEVEL_9_2:
++ case D3D_FEATURE_LEVEL_9_1: return D3D10_SHADER_MINOR_VERSION; // 0
+ default: UNREACHABLE(); return 0;
+ }
+ }
+@@ -2455,6 +2500,7 @@ gl::Error Renderer11::compileToExecutable(gl::InfoLog &infoLog, const std::strin
+
+ unsigned int profileMajorVersion = 0;
+ unsigned int profileMinorVersion = 0;
++ const char *profileSuffix = NULL;
+ switch (mFeatureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_0:
+@@ -2469,12 +2515,30 @@ gl::Error Renderer11::compileToExecutable(gl::InfoLog &infoLog, const std::strin
+ profileMajorVersion = 4;
+ profileMinorVersion = 0;
+ break;
++ case D3D_FEATURE_LEVEL_9_3:
++ profileMajorVersion = 4;
++ profileMinorVersion = 0;
++ profileSuffix = "_level_9_3";
++ break;
++ case D3D_FEATURE_LEVEL_9_2:
++ profileMajorVersion = 4;
++ profileMinorVersion = 0;
++ profileSuffix = "_level_9_2";
++ break;
++ case D3D_FEATURE_LEVEL_9_1:
++ profileMajorVersion = 4;
++ profileMinorVersion = 0;
++ profileSuffix = "_level_9_1";
++ break;
++ break;
+ default:
+ UNREACHABLE();
+ return gl::Error(GL_INVALID_OPERATION);
+ }
+
+ std::string profile = FormatString("%s_%u_%u", profileType, profileMajorVersion, profileMinorVersion);
++ if (profileSuffix)
++ profile += profileSuffix;
+
+ UINT flags = D3DCOMPILE_OPTIMIZATION_LEVEL2;
+
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.h
+index c789cae..d44bd2f 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.h
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.h
+@@ -188,6 +188,7 @@ class Renderer11 : public RendererD3D
+ ID3D11Device *getDevice() { return mDevice; }
+ ID3D11DeviceContext *getDeviceContext() { return mDeviceContext; };
+ DXGIFactory *getDxgiFactory() { return mDxgiFactory; };
++ bool isLevel9() { return mFeatureLevel <= D3D_FEATURE_LEVEL_9_3; }
+
+ Blit11 *getBlitter() { return mBlit; }
+
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/TextureStorage11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/TextureStorage11.cpp
+index 4287918..74af27e 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/TextureStorage11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/TextureStorage11.cpp
+@@ -744,7 +744,7 @@ gl::Error TextureStorage11_2D::getResource(ID3D11Resource **outResource)
+ D3D11_TEXTURE2D_DESC desc;
+ desc.Width = mTextureWidth; // Compressed texture size constraints?
+ desc.Height = mTextureHeight;
+- desc.MipLevels = mMipLevels;
++ desc.MipLevels = mRenderer->isLevel9() ? 1 : mMipLevels;
+ desc.ArraySize = 1;
+ desc.Format = mTextureFormat;
+ desc.SampleDesc.Count = 1;
+@@ -863,7 +863,7 @@ gl::Error TextureStorage11_2D::createSRV(int baseLevel, int mipLevels, DXGI_FORM
+ srvDesc.Format = format;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+ srvDesc.Texture2D.MostDetailedMip = mTopLevel + baseLevel;
+- srvDesc.Texture2D.MipLevels = mipLevels;
++ srvDesc.Texture2D.MipLevels = mRenderer->isLevel9() ? -1 : mipLevels;
+
+ ID3D11Device *device = mRenderer->getDevice();
+ HRESULT result = device->CreateShaderResourceView(texture, &srvDesc, outSRV);
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/formatutils11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/formatutils11.cpp
+index 1ea916d..90a879e 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/formatutils11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/formatutils11.cpp
+@@ -557,7 +557,7 @@ D3D11LoadFunctionMap BuildD3D11LoadFunctionMap()
+ InsertLoadFunction(&map, GL_ALPHA, GL_HALF_FLOAT_OES, LoadA16FToRGBA16F );
+
+ // From GL_EXT_texture_storage
+- InsertLoadFunction(&map, GL_ALPHA8_EXT, GL_UNSIGNED_BYTE, LoadToNative<GLubyte, 1> );
++ InsertLoadFunction(&map, GL_ALPHA8_EXT, GL_UNSIGNED_BYTE, LoadA8ToRGBA8 );
+ InsertLoadFunction(&map, GL_LUMINANCE8_EXT, GL_UNSIGNED_BYTE, LoadL8ToRGBA8 );
+ InsertLoadFunction(&map, GL_LUMINANCE8_ALPHA8_EXT, GL_UNSIGNED_BYTE, LoadLA8ToRGBA8 );
+ InsertLoadFunction(&map, GL_ALPHA32F_EXT, GL_FLOAT, LoadA32FToRGBA32F );
+@@ -795,7 +795,7 @@ static D3D11ES3FormatMap BuildD3D11FormatMap()
+
+ // From GL_EXT_texture_storage
+ // | GL internal format | D3D11 texture format | D3D11 SRV format | D3D11 RTV format | D3D11 DSV format |
+- InsertD3D11FormatInfo(&map, GL_ALPHA8_EXT, DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_UNKNOWN );
++ InsertD3D11FormatInfo(&map, GL_ALPHA8_EXT, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN );
+ InsertD3D11FormatInfo(&map, GL_LUMINANCE8_EXT, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN );
+ InsertD3D11FormatInfo(&map, GL_ALPHA32F_EXT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN );
+ InsertD3D11FormatInfo(&map, GL_LUMINANCE32F_EXT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN );
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/renderer11_utils.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/renderer11_utils.cpp
+index 9ffc32e..cbfe557 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/renderer11_utils.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/renderer11_utils.cpp
+@@ -284,7 +284,7 @@ static bool GetNPOTTextureSupport(D3D_FEATURE_LEVEL featureLevel)
+ // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+- case D3D_FEATURE_LEVEL_9_1: return false;
++ case D3D_FEATURE_LEVEL_9_1: return true; // Provided that mipmaps & wrap modes are not used
+
+ default: UNREACHABLE(); return false;
+ }
+--
+1.9.4.msysgit.1
+
diff --git a/0012-ANGLE-fix-semantic-index-lookup.patch b/0012-ANGLE-fix-semantic-index-lookup.patch
new file mode 100644
index 000000000000..afc9f256a1ec
--- /dev/null
+++ b/0012-ANGLE-fix-semantic-index-lookup.patch
@@ -0,0 +1,48 @@
+From bbfd3cfcf6e1195d86368b61ce39504ce6acda50 Mon Sep 17 00:00:00 2001
+From: Andrew Knight <andrew.knight@theqtcompany.com>
+Date: Wed, 12 Nov 2014 17:09:23 +0200
+Subject: [PATCH 12/16] ANGLE: fix semantic index lookup
+
+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.
+
+Change-Id: I75d05ed707f56c45210e3dcbc277f894e3dc5a48
+---
+ src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp | 2 +-
+ .../angle/src/libGLESv2/renderer/d3d/d3d11/InputLayoutCache.cpp | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp b/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp
+index 0619023..6d64b38 100644
+--- a/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/ProgramBinary.cpp
+@@ -1216,7 +1216,7 @@ void ProgramBinary::sortAttributesByLayout(rx::TranslatedAttribute attributes[MA
+ for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+ {
+ int oldIndex = mAttributesByLayout[i];
+- sortedSemanticIndices[i] = mSemanticIndex[oldIndex];
++ sortedSemanticIndices[i] = oldIndex;
+ attributes[i] = oldTranslatedAttributes[oldIndex];
+ }
+ }
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/InputLayoutCache.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/InputLayoutCache.cpp
+index e41f238..ff90a6a 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/InputLayoutCache.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/InputLayoutCache.cpp
+@@ -113,10 +113,10 @@ gl::Error InputLayoutCache::applyVertexBuffers(TranslatedAttribute attributes[gl
+ // Record the type of the associated vertex shader vector in our key
+ // This will prevent mismatched vertex shaders from using the same input layout
+ GLint attributeSize;
+- programBinary->getActiveAttribute(ilKey.elementCount, 0, NULL, &attributeSize, &ilKey.elements[ilKey.elementCount].glslElementType, NULL);
++ programBinary->getActiveAttribute(sortedSemanticIndices[i], 0, NULL, &attributeSize, &ilKey.elements[ilKey.elementCount].glslElementType, NULL);
+
+ ilKey.elements[ilKey.elementCount].desc.SemanticName = semanticName;
+- ilKey.elements[ilKey.elementCount].desc.SemanticIndex = sortedSemanticIndices[i];
++ ilKey.elements[ilKey.elementCount].desc.SemanticIndex = i;
+ ilKey.elements[ilKey.elementCount].desc.Format = vertexFormatInfo.nativeFormat;
+ ilKey.elements[ilKey.elementCount].desc.InputSlot = i;
+ ilKey.elements[ilKey.elementCount].desc.AlignedByteOffset = 0;
+--
+1.9.4.msysgit.1
+
diff --git a/0013-ANGLE-Add-support-for-querying-platform-device.patch b/0013-ANGLE-Add-support-for-querying-platform-device.patch
new file mode 100644
index 000000000000..b43dcc368b0f
--- /dev/null
+++ b/0013-ANGLE-Add-support-for-querying-platform-device.patch
@@ -0,0 +1,100 @@
+From 5ef9348de2624c21be1c9fddd265fec5a0851d25 Mon Sep 17 00:00:00 2001
+From: Andrew Knight <andrew.knight@theqtcompany.com>
+Date: Thu, 13 Nov 2014 15:34:26 +0200
+Subject: [PATCH 13/16] ANGLE: Add support for querying platform device
+
+The EGL_EXT_device_base extension allows for querying the platform
+device of the graphics hardware via eglQueryDisplayAttribEXT().
+As that extension is not supported by ANGLE, this patch adds similar
+functionality to the existing eglQuerySurfacePointerANGLE API. When
+EGL_DEVICE_EXT is passed as the queried attribute, the underlying
+D3D/DXGI device pointer is passed back to the caller via the value
+argument.
+
+The D3D device is needed for video support in QtMultimedia as well as
+the IDXGIDevice3::Trim() calls required by the Windows Store.
+
+Change-Id: Ibdf228d81d6604e56db9dd8597d7cd2983ebc428
+---
+ src/3rdparty/angle/src/libEGL/libEGL.cpp | 50 +++++++++++++++++++++++++-------
+ 1 file changed, 39 insertions(+), 11 deletions(-)
+
+diff --git a/src/3rdparty/angle/src/libEGL/libEGL.cpp b/src/3rdparty/angle/src/libEGL/libEGL.cpp
+index dc20d85..68399d6 100644
+--- a/src/3rdparty/angle/src/libEGL/libEGL.cpp
++++ b/src/3rdparty/angle/src/libEGL/libEGL.cpp
+@@ -17,6 +17,9 @@
+ #include "libGLESv2/Texture.h"
+ #include "libGLESv2/main.h"
+ #include "libGLESv2/renderer/SwapChain.h"
++#if defined(ANGLE_ENABLE_D3D11)
++# include "libGLESv2/renderer/d3d/d3d11/Renderer11.h"
++#endif
+
+ #include "libEGL/main.h"
+ #include "libEGL/Display.h"
+@@ -582,25 +585,50 @@ EGLBoolean __stdcall eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surf
+ egl::Display *display = static_cast<egl::Display*>(dpy);
+ egl::Surface *eglSurface = (egl::Surface*)surface;
+
+- if (!validateSurface(display, eglSurface))
+- {
+- return EGL_FALSE;
+- }
+-
+- if (surface == EGL_NO_SURFACE)
+- {
+- recordError(egl::Error(EGL_BAD_SURFACE));
+- return EGL_FALSE;
+- }
+-
+ switch (attribute)
+ {
+ case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
+ {
++ if (!validateSurface(display, eglSurface))
++ {
++ return EGL_FALSE;
++ }
++
++ if (surface == EGL_NO_SURFACE)
++ {
++ recordError(egl::Error(EGL_BAD_SURFACE));
++ return EGL_FALSE;
++ }
++
+ rx::SwapChain *swapchain = eglSurface->getSwapChain();
+ *value = (void*) (swapchain ? swapchain->getShareHandle() : NULL);
+ }
+ break;
++#if defined(ANGLE_ENABLE_D3D11)
++ case EGL_DEVICE_EXT:
++ {
++ if (!validateDisplay(display))
++ {
++ return EGL_FALSE;
++ }
++
++ rx::Renderer *renderer = display->getRenderer();
++ if (!renderer)
++ {
++ *value = NULL;
++ break;
++ }
++
++ if (renderer->getMajorShaderModel() < 4)
++ {
++ recordError(egl::Error(EGL_BAD_CONTEXT));
++ return EGL_FALSE;
++ }
++
++ *value = static_cast<rx::Renderer11*>(renderer)->getDevice();
++ }
++ break;
++#endif
+ default:
+ recordError(egl::Error(EGL_BAD_ATTRIBUTE));
+ return EGL_FALSE;
+--
+1.9.4.msysgit.1
+
diff --git a/0014-Let-ANGLE-use-multithreaded-devices-if-necessary.patch b/0014-Let-ANGLE-use-multithreaded-devices-if-necessary.patch
new file mode 100644
index 000000000000..9ceb34d964a3
--- /dev/null
+++ b/0014-Let-ANGLE-use-multithreaded-devices-if-necessary.patch
@@ -0,0 +1,69 @@
+From 5b3bc73210ed1847d9bd7a94f06cc0d5de8e0b89 Mon Sep 17 00:00:00 2001
+From: Michael Bruning <michael.bruning@digia.com>
+Date: Thu, 13 Nov 2014 15:40:10 +0200
+Subject: [PATCH 14/16] 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 | 10 ++++++++++
+ .../angle/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp | 4 ++++
+ 3 files changed, 15 insertions(+)
+
+diff --git a/src/3rdparty/angle/src/common/platform.h b/src/3rdparty/angle/src/common/platform.h
+index 0065ec7..8b2190d 100644
+--- a/src/3rdparty/angle/src/common/platform.h
++++ b/src/3rdparty/angle/src/common/platform.h
+@@ -57,6 +57,7 @@
+
+ # if defined(ANGLE_ENABLE_D3D11)
+ # include <d3d10_1.h>
++# include <d3d10.h>
+ # include <d3d11.h>
+ # include <d3d11_1.h>
+ # include <dxgi.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 f6ba930..46b9984 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp
+@@ -258,6 +258,16 @@ EGLint Renderer11::initialize()
+ }
+
+ #if !defined(ANGLE_ENABLE_WINDOWS_STORE)
++ 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();
++ }
+ #if !ANGLE_SKIP_DXGI_1_2_CHECK
+ // In order to create a swap chain for an HWND owned by another process, DXGI 1.2 is required.
+ // The easiest way to check is to query for a IDXGIDevice2.
+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 82963ec..4c552b2 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp
+@@ -299,6 +299,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;
++
+ {
+ result = mD3d9->CreateDevice(mAdapter, mDeviceType, mDeviceWindow, behaviorFlags | D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE, &presentParameters, &mDevice);
+ }
+--
+1.9.4.msysgit.1
+
diff --git a/0015-ANGLE-Fix-angle-d3d11-on-MSVC2010.patch b/0015-ANGLE-Fix-angle-d3d11-on-MSVC2010.patch
new file mode 100644
index 000000000000..f78474f11a5b
--- /dev/null
+++ b/0015-ANGLE-Fix-angle-d3d11-on-MSVC2010.patch
@@ -0,0 +1,536 @@
+From d9a9219ea2181dd4c1939d05747a21b67f16a906 Mon Sep 17 00:00:00 2001
+From: Andrew Knight <andrew.knight@theqtcompany.com>
+Date: Thu, 13 Nov 2014 16:33:53 +0200
+Subject: [PATCH 15/16] ANGLE: Fix -angle-d3d11 on MSVC2010
+
+Allow the D3D11 renderer to build with the June 2010 DirectX SDK.
+
+Change-Id: I2343acedab16845d6a0d4a53cf3145f583efc4a7
+---
+ src/3rdparty/angle/src/common/platform.h | 8 +-
+ src/3rdparty/angle/src/libGLESv2/Context.cpp | 8 +-
+ src/3rdparty/angle/src/libGLESv2/Data.h | 2 +-
+ src/3rdparty/angle/src/libGLESv2/State.cpp | 6 +-
+ .../src/libGLESv2/renderer/d3d/RendererD3D.cpp | 4 +-
+ .../libGLESv2/renderer/d3d/d3d11/Renderer11.cpp | 4 +-
+ .../renderer/d3d/d3d11/renderer11_utils.cpp | 137 +++++++++++++++++++++
+ 7 files changed, 156 insertions(+), 13 deletions(-)
+
+diff --git a/src/3rdparty/angle/src/common/platform.h b/src/3rdparty/angle/src/common/platform.h
+index 8b2190d..972eee2 100644
+--- a/src/3rdparty/angle/src/common/platform.h
++++ b/src/3rdparty/angle/src/common/platform.h
+@@ -52,17 +52,23 @@
+
+ # if defined(ANGLE_ENABLE_D3D9)
+ # include <d3d9.h>
++# if !defined(COMPILER_IMPLEMENTATION)
+ # include <d3dcompiler.h>
++# endif
+ # endif
+
+ # if defined(ANGLE_ENABLE_D3D11)
+ # include <d3d10_1.h>
+ # include <d3d10.h>
+ # include <d3d11.h>
+-# include <d3d11_1.h>
+ # include <dxgi.h>
++# if defined(_MSC_VER) && (_MSC_VER >= 1700)
++# include <d3d11_1.h>
+ # include <dxgi1_2.h>
++# endif
++# if !defined(COMPILER_IMPLEMENTATION)
+ # include <d3dcompiler.h>
++# endif
+ # endif
+
+ # if defined(ANGLE_ENABLE_WINDOWS_STORE)
+diff --git a/src/3rdparty/angle/src/libGLESv2/Context.cpp b/src/3rdparty/angle/src/libGLESv2/Context.cpp
+index fe9b1a2..b87689c 100644
+--- a/src/3rdparty/angle/src/libGLESv2/Context.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/Context.cpp
+@@ -168,9 +168,9 @@ Context::~Context()
+ }
+ mIncompleteTextures.clear();
+
+- for (auto &zeroTexture : mZeroTextures)
++ for (TextureMap::iterator i = mZeroTextures.begin(); i != mZeroTextures.end(); i++)
+ {
+- zeroTexture.second.set(NULL);
++ i->second.set(NULL);
+ }
+ mZeroTextures.clear();
+
+@@ -354,7 +354,7 @@ void Context::deleteFenceSync(GLsync fenceSync)
+
+ void Context::deleteVertexArray(GLuint vertexArray)
+ {
+- auto vertexArrayObject = mVertexArrayMap.find(vertexArray);
++ VertexArrayMap::iterator vertexArrayObject = mVertexArrayMap.find(vertexArray);
+
+ if (vertexArrayObject != mVertexArrayMap.end())
+ {
+@@ -460,7 +460,7 @@ FenceSync *Context::getFenceSync(GLsync handle) const
+
+ VertexArray *Context::getVertexArray(GLuint handle) const
+ {
+- auto vertexArray = mVertexArrayMap.find(handle);
++ VertexArrayMap::const_iterator vertexArray = mVertexArrayMap.find(handle);
+
+ if (vertexArray == mVertexArrayMap.end())
+ {
+diff --git a/src/3rdparty/angle/src/libGLESv2/Data.h b/src/3rdparty/angle/src/libGLESv2/Data.h
+index cff872a..9234403 100644
+--- a/src/3rdparty/angle/src/libGLESv2/Data.h
++++ b/src/3rdparty/angle/src/libGLESv2/Data.h
+@@ -14,7 +14,7 @@
+ namespace gl
+ {
+
+-struct Data final
++struct Data
+ {
+ public:
+ Data(GLint clientVersion, const State &state, const Caps &caps,
+diff --git a/src/3rdparty/angle/src/libGLESv2/State.cpp b/src/3rdparty/angle/src/libGLESv2/State.cpp
+index e7acda2..b5b62f5 100644
+--- a/src/3rdparty/angle/src/libGLESv2/State.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/State.cpp
+@@ -665,13 +665,13 @@ void State::detachTexture(const TextureMap &zeroTextures, GLuint texture)
+
+ void State::initializeZeroTextures(const TextureMap &zeroTextures)
+ {
+- for (const auto &zeroTexture : zeroTextures)
++ for (TextureMap::const_iterator i = zeroTextures.begin(); i != zeroTextures.end(); i++)
+ {
+- auto &samplerTextureArray = mSamplerTextures[zeroTexture.first];
++ TextureBindingVector &samplerTextureArray = mSamplerTextures[i->first];
+
+ for (size_t textureUnit = 0; textureUnit < samplerTextureArray.size(); ++textureUnit)
+ {
+- samplerTextureArray[textureUnit].set(zeroTexture.second.get());
++ samplerTextureArray[textureUnit].set(i->second.get());
+ }
+ }
+ }
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/RendererD3D.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/RendererD3D.cpp
+index 6f58243..97da6da 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/RendererD3D.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/RendererD3D.cpp
+@@ -27,9 +27,9 @@ RendererD3D::RendererD3D(egl::Display *display)
+
+ RendererD3D::~RendererD3D()
+ {
+- for (auto &incompleteTexture : mIncompleteTextures)
++ for (gl::TextureMap::iterator i = mIncompleteTextures.begin(); i != mIncompleteTextures.end(); ++i)
+ {
+- incompleteTexture.second.set(NULL);
++ i->second.set(NULL);
+ }
+ mIncompleteTextures.clear();
+ }
+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 46b9984..a28fd78 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp
+@@ -873,7 +873,7 @@ bool Renderer11::applyPrimitiveType(GLenum mode, GLsizei count)
+
+ void Renderer11::unsetSRVsWithResource(gl::SamplerType samplerType, const ID3D11Resource *resource)
+ {
+- auto &currentSRVs = (samplerType == gl::SAMPLER_VERTEX ? mCurVertexSRVs : mCurPixelSRVs);
++ std::vector<ID3D11ShaderResourceView *> &currentSRVs = (samplerType == gl::SAMPLER_VERTEX ? mCurVertexSRVs : mCurPixelSRVs);
+
+ for (size_t resourceIndex = 0; resourceIndex < currentSRVs.size(); ++resourceIndex)
+ {
+@@ -3398,7 +3398,7 @@ Workarounds Renderer11::generateWorkarounds() const
+
+ void Renderer11::setShaderResource(gl::SamplerType shaderType, UINT resourceSlot, ID3D11ShaderResourceView *srv)
+ {
+- auto &currentSRVs = (shaderType == gl::SAMPLER_VERTEX ? mCurVertexSRVs : mCurPixelSRVs);
++ std::vector<ID3D11ShaderResourceView *> &currentSRVs = (shaderType == gl::SAMPLER_VERTEX ? mCurVertexSRVs : mCurPixelSRVs);
+
+ ASSERT(static_cast<size_t>(resourceSlot) < currentSRVs.size());
+
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/renderer11_utils.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/renderer11_utils.cpp
+index cbfe557..5831c57 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/renderer11_utils.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/renderer11_utils.cpp
+@@ -18,6 +18,85 @@
+
+ #include <algorithm>
+
++#ifndef D3D_FL9_1_DEFAULT_MAX_ANISOTROPY
++# define D3D_FL9_1_DEFAULT_MAX_ANISOTROPY 2
++#endif
++#ifndef D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT
++# define D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT 1
++#endif
++#ifndef D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT
++# define D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT 4
++#endif
++#ifndef D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT
++# define D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT 65535
++#endif
++#ifndef D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT
++# define D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT 1048575
++#endif
++#ifndef D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION
++# define D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION 512
++#endif
++#ifndef D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION
++# define D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION 4096
++#endif
++#ifndef D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION
++# define D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION 2048
++#endif
++#ifndef D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION
++# define D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION 256
++#endif
++#ifndef D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION
++# define D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION 4096
++#endif
++#ifndef D3D11_REQ_TEXTURECUBE_DIMENSION
++# define D3D11_REQ_TEXTURECUBE_DIMENSION 16384
++#endif
++#ifndef D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION
++# define D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION 2048
++#endif
++#ifndef D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION
++# define D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION 2048
++#endif
++#ifndef D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP
++# define D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP 32
++#endif
++#ifndef D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP
++# define D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP 32
++#endif
++#ifndef D3D10_1_STANDARD_VERTEX_ELEMENT_COUNT
++# define D3D10_1_STANDARD_VERTEX_ELEMENT_COUNT 32
++#endif
++#ifndef D3D11_STANDARD_VERTEX_ELEMENT_COUNT
++# define D3D11_STANDARD_VERTEX_ELEMENT_COUNT 32
++#endif
++#ifndef D3D10_1_SO_BUFFER_SLOT_COUNT
++# define D3D10_1_SO_BUFFER_SLOT_COUNT 4
++#endif
++#ifndef D3D11_SO_BUFFER_SLOT_COUNT
++# define D3D11_SO_BUFFER_SLOT_COUNT 4
++#endif
++#ifndef D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT
++# define D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT 14
++#endif
++#ifndef D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT
++# define D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT 16
++#endif
++#ifndef D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE
++# define D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE -8
++#endif
++#ifndef D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE
++# define D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE 7
++#endif
++#ifndef D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT
++# define D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT 4096
++#endif
++#ifndef D3D11_PS_INPUT_REGISTER_COUNT
++# define D3D11_PS_INPUT_REGISTER_COUNT 32
++#endif
++#ifndef D3D10_1_VS_OUTPUT_REGISTER_COUNT
++# define D3D10_1_VS_OUTPUT_REGISTER_COUNT 32
++#endif
++
+ namespace rx
+ {
+
+@@ -276,7 +355,9 @@ static bool GetNPOTTextureSupport(D3D_FEATURE_LEVEL featureLevel)
+ {
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return true;
+@@ -294,7 +375,9 @@ static float GetMaximumAnisotropy(D3D_FEATURE_LEVEL featureLevel)
+ {
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_MAX_MAXANISOTROPY;
+
+ case D3D_FEATURE_LEVEL_10_1:
+@@ -314,7 +397,9 @@ static bool GetOcclusionQuerySupport(D3D_FEATURE_LEVEL featureLevel)
+ {
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return true;
+@@ -334,7 +419,9 @@ static bool GetEventQuerySupport(D3D_FEATURE_LEVEL featureLevel)
+
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+@@ -352,7 +439,9 @@ static bool GetInstancingSupport(D3D_FEATURE_LEVEL featureLevel)
+
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+@@ -375,7 +464,9 @@ static bool GetDerivativeInstructionSupport(D3D_FEATURE_LEVEL featureLevel)
+
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+@@ -393,7 +484,9 @@ static size_t GetMaximumSimultaneousRenderTargets(D3D_FEATURE_LEVEL featureLevel
+
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT;
+
+ case D3D_FEATURE_LEVEL_10_1:
+@@ -411,7 +504,9 @@ static size_t GetMaximum2DTextureSize(D3D_FEATURE_LEVEL featureLevel)
+ {
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+
+ case D3D_FEATURE_LEVEL_10_1:
+@@ -429,7 +524,9 @@ static size_t GetMaximumCubeMapTextureSize(D3D_FEATURE_LEVEL featureLevel)
+ {
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURECUBE_DIMENSION;
+
+ case D3D_FEATURE_LEVEL_10_1:
+@@ -447,7 +544,9 @@ static size_t GetMaximum2DTextureArraySize(D3D_FEATURE_LEVEL featureLevel)
+ {
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION;
+
+ case D3D_FEATURE_LEVEL_10_1:
+@@ -465,7 +564,9 @@ static size_t GetMaximum3DTextureSize(D3D_FEATURE_LEVEL featureLevel)
+ {
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION;
+
+ case D3D_FEATURE_LEVEL_10_1:
+@@ -483,7 +584,9 @@ static size_t GetMaximumViewportSize(D3D_FEATURE_LEVEL featureLevel)
+ {
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_VIEWPORT_BOUNDS_MAX;
+
+ case D3D_FEATURE_LEVEL_10_1:
+@@ -507,7 +610,9 @@ static size_t GetMaximumDrawIndexedIndexCount(D3D_FEATURE_LEVEL featureLevel)
+
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return std::numeric_limits<GLint>::max();
+@@ -529,7 +634,9 @@ static size_t GetMaximumDrawVertexCount(D3D_FEATURE_LEVEL featureLevel)
+
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return std::numeric_limits<GLint>::max();
+@@ -546,7 +653,9 @@ static size_t GetMaximumVertexInputSlots(D3D_FEATURE_LEVEL featureLevel)
+ {
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_STANDARD_VERTEX_ELEMENT_COUNT;
+
+ case D3D_FEATURE_LEVEL_10_1: return D3D10_1_STANDARD_VERTEX_ELEMENT_COUNT;
+@@ -566,7 +675,9 @@ static size_t GetMaximumVertexUniformVectors(D3D_FEATURE_LEVEL featureLevel)
+ // TODO(geofflang): Remove hard-coded limit once the gl-uniform-arrays test can pass
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return 1024; // D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT;
+
+ case D3D_FEATURE_LEVEL_10_1:
+@@ -591,7 +702,9 @@ static size_t GetMaximumVertexUniformBlocks(D3D_FEATURE_LEVEL featureLevel)
+ {
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - GetReservedVertexUniformBuffers();
+
+ case D3D_FEATURE_LEVEL_10_1:
+@@ -618,7 +731,9 @@ static size_t GetMaximumVertexOutputVectors(D3D_FEATURE_LEVEL featureLevel)
+
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_VS_OUTPUT_REGISTER_COUNT - GetReservedVertexOutputVectors();
+
+ case D3D_FEATURE_LEVEL_10_1: return D3D10_1_VS_OUTPUT_REGISTER_COUNT - GetReservedVertexOutputVectors();
+@@ -637,7 +752,9 @@ static size_t GetMaximumVertexTextureUnits(D3D_FEATURE_LEVEL featureLevel)
+ {
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT;
+
+ case D3D_FEATURE_LEVEL_10_1:
+@@ -659,7 +776,9 @@ static size_t GetMaximumPixelUniformVectors(D3D_FEATURE_LEVEL featureLevel)
+ // TODO(geofflang): Remove hard-coded limit once the gl-uniform-arrays test can pass
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return 1024; // D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT;
+
+ case D3D_FEATURE_LEVEL_10_1:
+@@ -684,7 +803,9 @@ static size_t GetMaximumPixelUniformBlocks(D3D_FEATURE_LEVEL featureLevel)
+ {
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - GetReservedPixelUniformBuffers();
+
+ case D3D_FEATURE_LEVEL_10_1:
+@@ -703,7 +824,9 @@ static size_t GetMaximumPixelInputVectors(D3D_FEATURE_LEVEL featureLevel)
+ {
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_PS_INPUT_REGISTER_COUNT - GetReservedVertexOutputVectors();
+
+ case D3D_FEATURE_LEVEL_10_1:
+@@ -722,7 +845,9 @@ static size_t GetMaximumPixelTextureUnits(D3D_FEATURE_LEVEL featureLevel)
+ {
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT;
+
+ case D3D_FEATURE_LEVEL_10_1:
+@@ -741,7 +866,9 @@ static int GetMinimumTexelOffset(D3D_FEATURE_LEVEL featureLevel)
+ {
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE;
+
+ case D3D_FEATURE_LEVEL_10_1:
+@@ -760,7 +887,9 @@ static int GetMaximumTexelOffset(D3D_FEATURE_LEVEL featureLevel)
+ {
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE;
+@@ -783,7 +912,9 @@ static size_t GetMaximumConstantBufferSize(D3D_FEATURE_LEVEL featureLevel)
+
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT * bytesPerComponent;
+
+ case D3D_FEATURE_LEVEL_10_1:
+@@ -802,7 +933,9 @@ static size_t GetMaximumStreamOutputBuffers(D3D_FEATURE_LEVEL featureLevel)
+ {
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_SO_BUFFER_SLOT_COUNT;
+
+ case D3D_FEATURE_LEVEL_10_1: return D3D10_1_SO_BUFFER_SLOT_COUNT;
+@@ -820,7 +953,9 @@ static size_t GetMaximumStreamOutputInterleavedComponents(D3D_FEATURE_LEVEL feat
+ {
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0:
+
+ case D3D_FEATURE_LEVEL_10_1:
+@@ -838,7 +973,9 @@ static size_t GetMaximumStreamOutputSeparateComponents(D3D_FEATURE_LEVEL feature
+ {
+ switch (featureLevel)
+ {
++#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ case D3D_FEATURE_LEVEL_11_1:
++#endif
+ case D3D_FEATURE_LEVEL_11_0: return GetMaximumStreamOutputInterleavedComponents(featureLevel) /
+ GetMaximumStreamOutputBuffers(featureLevel);
+
+--
+1.9.4.msysgit.1
+
diff --git a/0016-ANGLE-Fix-compilation-with-MinGW-D3D11.patch b/0016-ANGLE-Fix-compilation-with-MinGW-D3D11.patch
new file mode 100644
index 000000000000..e3df95d8bf73
--- /dev/null
+++ b/0016-ANGLE-Fix-compilation-with-MinGW-D3D11.patch
@@ -0,0 +1,169 @@
+From 43c8ceb17ccd6d5ae13a07c6d01b45eb40983917 Mon Sep 17 00:00:00 2001
+From: Andrew Knight <andrew.knight@theqtcompany.com>
+Date: Tue, 11 Nov 2014 14:36:43 +0200
+Subject: [PATCH 16/16] ANGLE: Fix compilation with MinGW + D3D11
+
+Provide workarounds for things GCC doesn't like, and define a few
+missing definitions not found in the MinGW headers.
+
+Change-Id: I254c208209c0071fae5efb6727f2b3cfd5542da6
+---
+ src/3rdparty/angle/src/common/platform.h | 73 ++++++++++++++++++++++
+ .../src/libGLESv2/renderer/d3d/HLSLCompiler.cpp | 6 ++
+ .../libGLESv2/renderer/d3d/d3d11/Renderer11.cpp | 2 +-
+ .../renderer/d3d/d3d11/renderer11_utils.cpp | 2 +-
+ .../src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp | 4 +-
+ 5 files changed, 83 insertions(+), 4 deletions(-)
+
+diff --git a/src/3rdparty/angle/src/common/platform.h b/src/3rdparty/angle/src/common/platform.h
+index 972eee2..0001e71 100644
+--- a/src/3rdparty/angle/src/common/platform.h
++++ b/src/3rdparty/angle/src/common/platform.h
+@@ -81,6 +81,79 @@
+ # endif
+ # endif
+
++# if defined(__MINGW32__) // Missing defines on MinGW
++typedef enum D3D11_MAP_FLAG
++{
++ D3D11_MAP_FLAG_DO_NOT_WAIT = 0x100000L
++} D3D11_MAP_FLAG;
++typedef struct D3D11_QUERY_DATA_SO_STATISTICS
++{
++ UINT64 NumPrimitivesWritten;
++ UINT64 PrimitivesStorageNeeded;
++} D3D11_QUERY_DATA_SO_STATISTICS;
++typedef HRESULT (WINAPI *PFN_D3D11_CREATE_DEVICE)(
++ IDXGIAdapter *, D3D_DRIVER_TYPE, HMODULE, UINT, CONST D3D_FEATURE_LEVEL *,
++ UINT FeatureLevels, UINT, ID3D11Device **, D3D_FEATURE_LEVEL *, ID3D11DeviceContext **);
++#define D3D11_MESSAGE_CATEGORY UINT
++#define D3D11_MESSAGE_SEVERITY UINT
++#define D3D11_MESSAGE_ID UINT
++struct D3D11_MESSAGE;
++typedef struct D3D11_INFO_QUEUE_FILTER_DESC
++{
++ UINT NumCategories;
++ D3D11_MESSAGE_CATEGORY *pCategoryList;
++ UINT NumSeverities;
++ D3D11_MESSAGE_SEVERITY *pSeverityList;
++ UINT NumIDs;
++ D3D11_MESSAGE_ID *pIDList;
++} D3D11_INFO_QUEUE_FILTER_DESC;
++typedef struct D3D11_INFO_QUEUE_FILTER
++{
++ D3D11_INFO_QUEUE_FILTER_DESC AllowList;
++ D3D11_INFO_QUEUE_FILTER_DESC DenyList;
++} D3D11_INFO_QUEUE_FILTER;
++static const IID IID_ID3D11InfoQueue = { 0x6543dbb6, 0x1b48, 0x42f5, 0xab, 0x82, 0xe9, 0x7e, 0xc7, 0x43, 0x26, 0xf6 };
++MIDL_INTERFACE("6543dbb6-1b48-42f5-ab82-e97ec74326f6") ID3D11InfoQueue : public IUnknown
++{
++public:
++ virtual HRESULT __stdcall SetMessageCountLimit(UINT64) = 0;
++ virtual void __stdcall ClearStoredMessages() = 0;
++ virtual HRESULT __stdcall GetMessage(UINT64, D3D11_MESSAGE *, SIZE_T *) = 0;
++ virtual UINT64 __stdcall GetNumMessagesAllowedByStorageFilter() = 0;
++ virtual UINT64 __stdcall GetNumMessagesDeniedByStorageFilter() = 0;
++ virtual UINT64 __stdcall GetNumStoredMessages() = 0;
++ virtual UINT64 __stdcall GetNumStoredMessagesAllowedByRetrievalFilter() = 0;
++ virtual UINT64 __stdcall GetNumMessagesDiscardedByMessageCountLimit() = 0;
++ virtual UINT64 __stdcall GetMessageCountLimit() = 0;
++ virtual HRESULT __stdcall AddStorageFilterEntries(D3D11_INFO_QUEUE_FILTER *) = 0;
++ virtual HRESULT __stdcall GetStorageFilter(D3D11_INFO_QUEUE_FILTER *, SIZE_T *) = 0;
++ virtual void __stdcall ClearStorageFilter() = 0;
++ virtual HRESULT __stdcall PushEmptyStorageFilter() = 0;
++ virtual HRESULT __stdcall PushCopyOfStorageFilter() = 0;
++ virtual HRESULT __stdcall PushStorageFilter(D3D11_INFO_QUEUE_FILTER *) = 0;
++ virtual void __stdcall PopStorageFilter() = 0;
++ virtual UINT __stdcall GetStorageFilterStackSize() = 0;
++ virtual HRESULT __stdcall AddRetrievalFilterEntries(D3D11_INFO_QUEUE_FILTER *) = 0;
++ virtual HRESULT __stdcall GetRetrievalFilter(D3D11_INFO_QUEUE_FILTER *, SIZE_T *) = 0;
++ virtual void __stdcall ClearRetrievalFilter() = 0;
++ virtual HRESULT __stdcall PushEmptyRetrievalFilter() = 0;
++ virtual HRESULT __stdcall PushCopyOfRetrievalFilter() = 0;
++ virtual HRESULT __stdcall PushRetrievalFilter(D3D11_INFO_QUEUE_FILTER *) = 0;
++ virtual void __stdcall PopRetrievalFilter() = 0;
++ virtual UINT __stdcall GetRetrievalFilterStackSize() = 0;
++ virtual HRESULT __stdcall AddMessage(D3D11_MESSAGE_CATEGORY, D3D11_MESSAGE_SEVERITY, D3D11_MESSAGE_ID, LPCSTR) = 0;
++ virtual HRESULT __stdcall AddApplicationMessage(D3D11_MESSAGE_SEVERITY, LPCSTR) = 0;
++ virtual HRESULT __stdcall SetBreakOnCategory(D3D11_MESSAGE_CATEGORY, BOOL) = 0;
++ virtual HRESULT __stdcall SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY, BOOL) = 0;
++ virtual HRESULT __stdcall SetBreakOnID(D3D11_MESSAGE_ID, BOOL) = 0;
++ virtual BOOL __stdcall GetBreakOnCategory(D3D11_MESSAGE_CATEGORY) = 0;
++ virtual BOOL __stdcall GetBreakOnSeverity(D3D11_MESSAGE_SEVERITY) = 0;
++ virtual BOOL __stdcall GetBreakOnID(D3D11_MESSAGE_ID) = 0;
++ virtual void __stdcall SetMuteDebugOutput(BOOL) = 0;
++ virtual BOOL __stdcall GetMuteDebugOutput() = 0;
++};
++#endif // __MINGW32__
++
+ # undef near
+ # undef far
+ #endif
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp
+index 9d003b4..776d92b 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp
+@@ -14,6 +14,12 @@
+ #ifndef QT_D3DCOMPILER_DLL
+ #define QT_D3DCOMPILER_DLL D3DCOMPILER_DLL
+ #endif
++#ifndef D3DCOMPILE_RESERVED16
++#define D3DCOMPILE_RESERVED16 (1 << 16)
++#endif
++#ifndef D3DCOMPILE_RESERVED17
++#define D3DCOMPILE_RESERVED17 (1 << 17)
++#endif
+
+ // Definitions local to the translation unit
+ namespace
+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 a28fd78..e6d7f30 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp
+@@ -333,7 +333,7 @@ EGLint Renderer11::initialize()
+ // Disable some spurious D3D11 debug warnings to prevent them from flooding the output log
+ #if defined(ANGLE_SUPPRESS_D3D11_HAZARD_WARNINGS) && defined(_DEBUG)
+ ID3D11InfoQueue *infoQueue;
+- result = mDevice->QueryInterface(__uuidof(ID3D11InfoQueue), (void **)&infoQueue);
++ result = mDevice->QueryInterface(IID_ID3D11InfoQueue, (void **)&infoQueue);
+
+ if (SUCCEEDED(result))
+ {
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/renderer11_utils.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/renderer11_utils.cpp
+index 5831c57..121aa3b 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/renderer11_utils.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/renderer11_utils.cpp
+@@ -1196,7 +1196,7 @@ void SetPositionLayerTexCoord3DVertex(PositionLayerTexCoord3DVertex* vertex, flo
+
+ HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name)
+ {
+-#if defined(_DEBUG)
++#if defined(_DEBUG) && !defined(__MINGW32__)
+ return resource->SetPrivateData(WKPDID_D3DDebugObjectName, strlen(name), name);
+ #else
+ return S_OK;
+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 4c552b2..601cd24 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp
+@@ -200,7 +200,7 @@ EGLint Renderer9::initialize()
+ if (ANGLE_D3D9EX == ANGLE_ENABLED && Direct3DCreate9ExPtr && SUCCEEDED(Direct3DCreate9ExPtr(D3D_SDK_VERSION, &mD3d9Ex)))
+ {
+ ASSERT(mD3d9Ex);
+- mD3d9Ex->QueryInterface(__uuidof(IDirect3D9), reinterpret_cast<void**>(&mD3d9));
++ mD3d9Ex->QueryInterface(IID_IDirect3D9, reinterpret_cast<void**>(&mD3d9));
+ ASSERT(mD3d9);
+ }
+ else
+@@ -324,7 +324,7 @@ EGLint Renderer9::initialize()
+
+ if (mD3d9Ex)
+ {
+- result = mDevice->QueryInterface(__uuidof(IDirect3DDevice9Ex), (void**)&mDeviceEx);
++ result = mDevice->QueryInterface(IID_IDirect3DDevice9Ex, (void**)&mDeviceEx);
+ ASSERT(SUCCEEDED(result));
+ }
+
+--
+1.9.4.msysgit.1
+
diff --git a/0017-ANGLE-Fix-compilation-with-D3D9.patch b/0017-ANGLE-Fix-compilation-with-D3D9.patch
new file mode 100644
index 000000000000..4ada6d41d262
--- /dev/null
+++ b/0017-ANGLE-Fix-compilation-with-D3D9.patch
@@ -0,0 +1,62 @@
+From d7839cc052de126cc3b457fe41963fd9c7e91846 Mon Sep 17 00:00:00 2001
+From: Kai Koehne <kai.koehne@theqtcompany.com>
+Date: Mon, 17 Nov 2014 15:10:10 +0100
+Subject: [PATCH] ANGLE: Fix compilation with D3D9
+
+Fixes a regression introduced in c6df5fe3ed0f2a722 that
+broke compilation with d3d9 (namely, -target xp).
+
+Task-number: QTBUG-42714
+Change-Id: I1a5e9682d5463bfa082a5d0c062399a131a7cf52
+---
+ src/3rdparty/angle/src/common/NativeWindow.h | 7 ++++++-
+ src/3rdparty/angle/src/common/platform.h | 1 +
+ src/3rdparty/angle/src/common/win32/NativeWindow.cpp | 2 +-
+ 3 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/src/3rdparty/angle/src/common/NativeWindow.h b/src/3rdparty/angle/src/common/NativeWindow.h
+index 9e93aea..c4a0e42 100644
+--- a/src/3rdparty/angle/src/common/NativeWindow.h
++++ b/src/3rdparty/angle/src/common/NativeWindow.h
+@@ -54,7 +54,12 @@ public:
+ bool getClientRect(LPRECT rect);
+ bool isIconic();
+
+- HRESULT createSwapChain(ID3D11Device* device, DXGIFactory* factory,
++# if defined(ANGLE_ENABLE_D3D11)
++ typedef ID3D11Device Device;
++#else
++ typedef IDirect3DDevice9 Device;
++#endif
++ HRESULT createSwapChain(Device* device, DXGIFactory* factory,
+ DXGI_FORMAT format, UINT width, UINT height,
+ DXGISwapChain** swapChain);
+
+diff --git a/src/3rdparty/angle/src/common/platform.h b/src/3rdparty/angle/src/common/platform.h
+index 0001e71..5bf97f9 100644
+--- a/src/3rdparty/angle/src/common/platform.h
++++ b/src/3rdparty/angle/src/common/platform.h
+@@ -52,6 +52,7 @@
+
+ # if defined(ANGLE_ENABLE_D3D9)
+ # include <d3d9.h>
++# include <dxgi.h>
+ # if !defined(COMPILER_IMPLEMENTATION)
+ # include <d3dcompiler.h>
+ # endif
+diff --git a/src/3rdparty/angle/src/common/win32/NativeWindow.cpp b/src/3rdparty/angle/src/common/win32/NativeWindow.cpp
+index 2440747..46082a2 100644
+--- a/src/3rdparty/angle/src/common/win32/NativeWindow.cpp
++++ b/src/3rdparty/angle/src/common/win32/NativeWindow.cpp
+@@ -35,7 +35,7 @@ bool NativeWindow::isIconic()
+ return IsIconic(mWindow) == TRUE;
+ }
+
+-HRESULT NativeWindow::createSwapChain(ID3D11Device* device, DXGIFactory* factory,
++HRESULT NativeWindow::createSwapChain(NativeWindow::Device* device, DXGIFactory* factory,
+ DXGI_FORMAT format, unsigned int width, unsigned int height,
+ DXGISwapChain** swapChain)
+ {
+--
+1.9.4.msysgit.0
+
diff --git a/0018-ANGLE-Fix-releasing-textures-after-we-kill-D3D11.patch b/0018-ANGLE-Fix-releasing-textures-after-we-kill-D3D11.patch
new file mode 100644
index 000000000000..97847ad68479
--- /dev/null
+++ b/0018-ANGLE-Fix-releasing-textures-after-we-kill-D3D11.patch
@@ -0,0 +1,106 @@
+From 014d3fcf6011109491b0489da9c1abb1fdc6dbdc Mon Sep 17 00:00:00 2001
+From: Kai Koehne <kai.koehne@theqtcompany.com>
+Date: Mon, 24 Nov 2014 10:52:03 +0100
+Subject: [PATCH] ANGLE: Fix releasing textures after we kill D3D11
+
+Cherry-pick upstream commit cc4cd2925b9a4f1142a86df131345a861c9d7cd9
+to fix crashes on exit.
+
+Task-number: QTBUG-42772
+Change-Id: Ib74be17f2b5fdd58f9e0568e1da74ba19e943019
+---
+ src/3rdparty/angle/src/libGLESv2/Context.cpp | 6 ------
+ src/3rdparty/angle/src/libGLESv2/Context.h | 1 -
+ src/3rdparty/angle/src/libGLESv2/renderer/d3d/RendererD3D.cpp | 5 +++++
+ src/3rdparty/angle/src/libGLESv2/renderer/d3d/RendererD3D.h | 2 ++
+ src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp | 2 ++
+ src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp | 2 ++
+ 6 files changed, 11 insertions(+), 7 deletions(-)
+
+diff --git a/src/3rdparty/angle/src/libGLESv2/Context.cpp b/src/3rdparty/angle/src/libGLESv2/Context.cpp
+index b87689c..3772da6 100644
+--- a/src/3rdparty/angle/src/libGLESv2/Context.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/Context.cpp
+@@ -162,12 +162,6 @@ Context::~Context()
+ deleteTransformFeedback(mTransformFeedbackMap.begin()->first);
+ }
+
+- for (TextureMap::iterator i = mIncompleteTextures.begin(); i != mIncompleteTextures.end(); i++)
+- {
+- i->second.set(NULL);
+- }
+- mIncompleteTextures.clear();
+-
+ for (TextureMap::iterator i = mZeroTextures.begin(); i != mZeroTextures.end(); i++)
+ {
+ i->second.set(NULL);
+diff --git a/src/3rdparty/angle/src/libGLESv2/Context.h b/src/3rdparty/angle/src/libGLESv2/Context.h
+index 1e890de..0699592 100644
+--- a/src/3rdparty/angle/src/libGLESv2/Context.h
++++ b/src/3rdparty/angle/src/libGLESv2/Context.h
+@@ -247,7 +247,6 @@ class Context
+ int mClientVersion;
+
+ TextureMap mZeroTextures;
+- TextureMap mIncompleteTextures;
+
+ typedef std::unordered_map<GLuint, Framebuffer*> FramebufferMap;
+ FramebufferMap mFramebufferMap;
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/RendererD3D.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/RendererD3D.cpp
+index 97da6da..5cddd8a 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/RendererD3D.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/RendererD3D.cpp
+@@ -27,6 +27,11 @@ RendererD3D::RendererD3D(egl::Display *display)
+
+ RendererD3D::~RendererD3D()
+ {
++ cleanup();
++}
++
++void RendererD3D::cleanup()
++{
+ for (gl::TextureMap::iterator i = mIncompleteTextures.begin(); i != mIncompleteTextures.end(); ++i)
+ {
+ i->second.set(NULL);
+diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/RendererD3D.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/RendererD3D.h
+index 9919207..a2f7787 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/RendererD3D.h
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/RendererD3D.h
+@@ -160,6 +160,8 @@ class RendererD3D : public Renderer
+ const gl::Rectangle *scissor, bool blitRenderTarget,
+ bool blitDepth, bool blitStencil, GLenum filter) = 0;
+
++ void cleanup();
++
+ egl::Display *mDisplay;
+
+ private:
+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 e6d7f30..777308e 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp
+@@ -1870,6 +1870,8 @@ bool Renderer11::testDeviceResettable()
+
+ void Renderer11::release()
+ {
++ RendererD3D::cleanup();
++
+ releaseShaderCompiler();
+ releaseDeviceResources();
+
+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 601cd24..18e6e2d 100644
+--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp
+@@ -151,6 +151,8 @@ Renderer9::~Renderer9()
+
+ void Renderer9::release()
+ {
++ RendererD3D::cleanup();
++
+ releaseShaderCompiler();
+ releaseDeviceResources();
+
+--
+1.9.4.msysgit.0
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..61e5a4304fd5
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,211 @@
+# Maintainer: ant32 <antreimer@gmail.com>
+# Contributor: Filip Brcic <brcha@gna.org>
+# Contributor: xantares
+# Contributor: jellysheep <max DOT mail AT dameweb DOT de>
+
+pkgname=mingw-w64-angleproject
+pkgver=2.1.r3427.30d6c25
+pkgrel=2
+pkgdesc='Angle project (mingw-w64)'
+arch=('any')
+url='http://code.google.com/p/angleproject/'
+license=('BSD')
+depends=('mingw-w64-crt')
+makedepends=('mingw-w64-gcc' 'gyp-svn' 'git' 'python')
+options=('!strip' '!buildflags' 'staticlibs')
+source=('angleproject::git+https://chromium.googlesource.com/angle/angle#commit=30d6c25'
+ 'libGLESv2_mingw32.def'
+ 'libEGL_mingw32.def'
+ '0000-General-fixes-for-ANGLE-2.1.patch'
+ '0004-Make-it-possible-to-link-ANGLE-statically-for-single.patch'
+ '0008-ANGLE-Dynamically-load-D3D-compiler-from-a-list-or-t.patch'
+ '0009-ANGLE-Support-WinRT.patch'
+ '0010-ANGLE-Enable-D3D11-for-feature-level-9-cards.patch'
+ '0012-ANGLE-fix-semantic-index-lookup.patch'
+ '0013-ANGLE-Add-support-for-querying-platform-device.patch'
+ '0014-Let-ANGLE-use-multithreaded-devices-if-necessary.patch'
+ '0015-ANGLE-Fix-angle-d3d11-on-MSVC2010.patch'
+ '0016-ANGLE-Fix-compilation-with-MinGW-D3D11.patch'
+ '0017-ANGLE-Fix-compilation-with-D3D9.patch'
+ '0018-ANGLE-Fix-releasing-textures-after-we-kill-D3D11.patch'
+ 'angleproject-undo-mingw-org-compatibility.patch'
+ 'angleproject-undo-mingw-org-compatibility2.patch'
+ 'angleproject-disable-debug-annotations.patch'
+ 'angleproject-undo-shader-renames.patch'
+ 'angleproject-prevent-multiple-definition-errors.patch'
+ 'commit-4de44cb'
+ 'commit-409078f'
+ 'angleproject-include-import-library-and-use-def-file.patch'
+ 'angleproject-export-shader-symbols.patch')
+md5sums=('SKIP'
+ 'ebee3837c9f9ad9e9b49061a2274b963'
+ '7d563b2218692a5ea232c1a7aa77e2a1'
+ 'b14a834c2d51c7af99f8aaf089851d23'
+ 'fa43f37117af18de3badfc4481ee3639'
+ 'fe69049b10928166ef62e1786a13e61b'
+ 'e573a80dec8b594bf6244ea4a28ce438'
+ 'b64f5fc4838d7157753f8255613ca511'
+ 'baf253bebf28653468e18b92d84f4431'
+ '25b88bcf7132e62c6717c145177ea157'
+ '8fdd8266b8b2c276dbf4e66d2947e5e3'
+ 'fbd26095e88c8e6930edc50c1c7dc0a8'
+ '5f80ebeebded4a4bb80cd03e3075dae5'
+ '780bc9ce3c0008910707b2df20c3430c'
+ '2787c0a067665b02c161c7392b7175e4'
+ 'b8f289095e5a64514f3a7adb680fc3d3'
+ 'd5c2ca6cb655070ac75a035376e8b052'
+ 'f2289e55621764d05e16a71ba09dd779'
+ 'f44242b0abb63290bd571a953bae34b9'
+ '8f54b19db99483c9ee37054d302bf806'
+ 'cce58c740f92bf1b2f7ca4a58999a5fc'
+ 'a94c3e8bfe9e62198b8b51311f28c9a5'
+ '8374ba08ca0cc5620ac2c94209122134'
+ '19a72088f614a5f22004b2687a73f3ad')
+_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
+
+#pkgver() {
+# cd "$srcdir/angleproject"
+# grep -E "^#define ANGLE_M..OR_VERSION [0-9]+$" src/common/version.h | sed 's/#define ANGLE_M..OR_VERSION //' | tr '\n' '.'
+# printf "r%s.%s\n" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+#}
+
+prepare() {
+ cd "${srcdir}/angleproject"
+
+ # Install additional .def files
+ cp ../libGLESv2_mingw32.def src/libGLESv2/
+ cp ../libEGL_mingw32.def src/libEGL/
+
+ # Patches taken from Qt5
+ # https://qt.gitorious.org/qt/qtbase/source/2302d386c7a1aa1a96658f79c236d6b8a59db7ac:src/angle/patches
+ patch -p4 -i ../0000-General-fixes-for-ANGLE-2.1.patch
+ patch -p4 -i ../0004-Make-it-possible-to-link-ANGLE-statically-for-single.patch
+ patch -p4 -i ../0008-ANGLE-Dynamically-load-D3D-compiler-from-a-list-or-t.patch
+ patch -p4 -i ../0009-ANGLE-Support-WinRT.patch
+ patch -p4 -i ../0010-ANGLE-Enable-D3D11-for-feature-level-9-cards.patch
+ patch -p4 -i ../0012-ANGLE-fix-semantic-index-lookup.patch
+ patch -p4 -i ../0013-ANGLE-Add-support-for-querying-platform-device.patch
+ patch -p4 -i ../0014-Let-ANGLE-use-multithreaded-devices-if-necessary.patch
+ patch -p4 -i ../0015-ANGLE-Fix-angle-d3d11-on-MSVC2010.patch
+ patch -p4 -i ../0016-ANGLE-Fix-compilation-with-MinGW-D3D11.patch
+ patch -p4 -i ../0017-ANGLE-Fix-compilation-with-D3D9.patch
+ patch -p4 -i ../0018-ANGLE-Fix-releasing-textures-after-we-kill-D3D11.patch
+
+ # Undo a change from 0016-ANGLE-Fix-compilation-with-MinGW-D3D11.patch which
+ # implements some missing stuff from the mingw.org toolchain, but which already
+ # exists in the mingw-w64 toolchain (and causes breakage)
+ patch -p1 -i ../angleproject-undo-mingw-org-compatibility.patch
+
+ # Same as above but introduced by a change from 0015-ANGLE-Fix-angle-d3d11-on-MSVC2010.patch
+ patch -p1 -i ../angleproject-undo-mingw-org-compatibility2.patch
+
+ # Disable some debug code as it depends on the ID3DUserDefinedAnnotation
+ # interface which isn't available in mingw-w64 yet
+ # Patch for this is currently pending at http://source.winehq.org/patches/data/108405
+ patch -p1 -i ../angleproject-disable-debug-annotations.patch
+
+ # Undo a change from 0000-General-fixes-for-ANGLE-2.1.patch which renames
+ # some shader references, but which doesn't rename the precompiled shaders
+ patch -p1 -i ../angleproject-undo-shader-renames.patch
+
+ # Prevent multiple definition errors during the final link of libGLESv2
+ patch -p1 -i ../angleproject-prevent-multiple-definition-errors.patch
+
+ # Revert commit 4de44cb and commit 409078f as qt5-qtwebkit still depends on it
+ patch -p1 -R -i ../commit-4de44cb
+ patch -p1 -R -i ../commit-409078f
+
+ # Make sure an import library is created and the correct .def file is used during the build
+ patch -p1 -i ../angleproject-include-import-library-and-use-def-file.patch
+
+ # WebKit depends on symbols which are used in the static library called translator_hlsl
+ # This static library is linked into the libGLESv2 shared library
+ # To allow building WebKit export the required symbols in the libGLESv2 shared library
+ patch -p1 -i ../angleproject-export-shader-symbols.patch
+
+ # Executing .bat scripts on Linux is a no-go so make this a no-op
+ echo "" > src/copy_compiler_dll.bat
+ chmod +x src/copy_compiler_dll.bat
+}
+
+build() {
+ cd "${srcdir}/angleproject"
+
+ export CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4"
+ export CXXFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4"
+ unset LDFLAGS
+
+ for _arch in ${_architectures}; do
+ mkdir -p build-${_arch} && pushd build-${_arch}
+
+ export CXX="${_arch}-g++"
+ export AR="${_arch}-ar"
+
+ if [ "${_arch}" = "i686-w64-mingw32" ]; then
+ target="win32"
+ else
+ target="win64"
+ fi
+
+ gyp -D OS=win -D TARGET=$target -D MSVS_VERSION="" --depth . -I ../build/common.gypi ../src/angle.gyp
+
+ # Make sure the correct libraries are linked in
+ sed -i s@'^LIBS :='@'LIBS := -ld3d9 -ldxguid'@ ../src/libGLESv2.target.mk
+ sed -i s@'^LIBS :='@'LIBS := -ld3d9 -ldxguid -L. -lGLESv2'@ ../src/libEGL.target.mk
+
+ make V=1 CXXFLAGS="-std=c++11 -msse2 -DUNICODE -D_UNICODE -g"
+
+ # Also build static libraries (which are needed by the static Qt build)
+ ${AR} rcs libGLESv2.a \
+ out/Debug/obj.target/src/common/*.o \
+ out/Debug/obj.target/src/common/win32/*.o \
+ out/Debug/obj.target/src/compiler/translator/*.o \
+ out/Debug/obj.target/src/compiler/translator/depgraph/*.o \
+ out/Debug/obj.target/src/compiler/translator/timing/*.o \
+ out/Debug/obj.target/src/compiler/preprocessor/*.o \
+ out/Debug/obj.target/src/third_party/compiler/*.o \
+ out/Debug/obj.target/src/third_party/murmurhash/*.o \
+ out/Debug/obj.target/src/third_party/systeminfo/*.o \
+ out/Debug/obj.target/src/libGLESv2/*.o \
+ out/Debug/obj.target/src/libGLESv2/renderer/*.o \
+ out/Debug/obj.target/src/libGLESv2/renderer/d3d/*.o \
+ out/Debug/obj.target/src/libGLESv2/renderer/d3d/d3d9/*.o \
+ out/Debug/obj.target/src/libGLESv2/renderer/d3d/d3d11/*.o
+
+ ${AR} rcs libEGL.a \
+ out/Debug/obj.target/libEGL/../src/common/RefCountObject.o \
+ out/Debug/obj.target/libEGL/../src/common/angleutils.o \
+ out/Debug/obj.target/libEGL/../src/common/debug.o \
+ out/Debug/obj.target/libEGL/../src/common/event_tracer.o \
+ out/Debug/obj.target/libEGL/../src/common/mathutil.o \
+ out/Debug/obj.target/libEGL/../src/common/tls.o \
+ out/Debug/obj.target/libEGL/../src/common/utilities.o \
+ out/Debug/obj.target/libEGL/../src/libEGL/AttributeMap.o \
+ out/Debug/obj.target/libEGL/../src/libEGL/Config.o \
+ out/Debug/obj.target/libEGL/../src/libEGL/Display.o \
+ out/Debug/obj.target/libEGL/../src/libEGL/Error.o \
+ out/Debug/obj.target/libEGL/../src/libEGL/Surface.o \
+ out/Debug/obj.target/libEGL/../src/libEGL/libEGL.o \
+ out/Debug/obj.target/libEGL/../src/libEGL/main.o \
+ out/Debug/obj.target/libEGL/../src/common/win32/NativeWindow.o
+
+ popd
+ done
+}
+
+package() {
+ for _arch in ${_architectures}; do
+ cd "${srcdir}/angleproject/build-${_arch}"
+ mkdir -p "${pkgdir}/usr/${_arch}/"{bin,lib,include}
+ install out/Debug/src/libGLESv2.so "${pkgdir}/usr/${_arch}/bin/libGLESv2.dll"
+ install out/Debug/src/libEGL.so "${pkgdir}/usr/${_arch}/bin/libEGL.dll"
+ install libGLESv2.a "${pkgdir}/usr/${_arch}/lib/"
+ install libEGL.a "${pkgdir}/usr/${_arch}/lib/"
+ install libGLESv2.dll.a "${pkgdir}/usr/${_arch}/lib/"
+ install libEGL.dll.a "${pkgdir}/usr/${_arch}/lib/"
+ cp -Rv ../include/* "${pkgdir}/usr/${_arch}/include/"
+
+ ${_arch}-strip --strip-unneeded "${pkgdir}/usr/${_arch}/bin/"*.dll
+ ${_arch}-strip -g "${pkgdir}/usr/${_arch}/lib/"*.a
+ done
+}
diff --git a/angleproject-disable-debug-annotations.patch b/angleproject-disable-debug-annotations.patch
new file mode 100644
index 000000000000..1df4e5ca8323
--- /dev/null
+++ b/angleproject-disable-debug-annotations.patch
@@ -0,0 +1,33 @@
+--- angle/src/libGLESv2.gypi.orig 2014-12-29 14:50:37.625335694 +0100
++++ angle/src/libGLESv2.gypi 2014-12-29 14:51:18.659761527 +0100
+@@ -483,11 +483,6 @@
+ {
+ 'Debug_Base':
+ {
+- 'defines':
+- [
+- 'ANGLE_ENABLE_DEBUG_ANNOTATIONS',
+- 'ANGLE_GENERATE_SHADER_DEBUG_INFO'
+- ],
+ 'msvs_settings':
+ {
+ 'VCLinkerTool':
+--- angle/src/libEGL.gypi.orig 2014-12-29 16:05:56.119799976 +0100
++++ angle/src/libEGL.gypi 2014-12-29 16:06:17.452019110 +0100
+@@ -171,16 +171,6 @@
+ ],
+ },
+ },
+- 'configurations':
+- {
+- 'Debug_Base':
+- {
+- 'defines':
+- [
+- 'ANGLE_ENABLE_DEBUG_ANNOTATIONS',
+- ],
+- },
+- },
+ },
+ ],
+ },
diff --git a/angleproject-export-shader-symbols.patch b/angleproject-export-shader-symbols.patch
new file mode 100644
index 000000000000..91bc3376383a
--- /dev/null
+++ b/angleproject-export-shader-symbols.patch
@@ -0,0 +1,36 @@
+--- angle/src/libGLESv2/libGLESv2.def.orig 2014-12-30 12:59:07.560620988 +0100
++++ angle/src/libGLESv2/libGLESv2.def 2014-12-30 13:00:22.381399755 +0100
+@@ -294,3 +294,15 @@
+ glBindTexImage @158 NONAME
+ glCreateRenderer @177 NONAME
+ glDestroyRenderer @178 NONAME
++
++ ; WebKit dependencies
++ ShInitBuiltInResources @300 NONAME
++ ShInitialize @301 NONAME
++ ShDestruct @302 NONAME
++ ShGetInfo @303 NONAME
++ ShGetInfoLog @304 NONAME
++ ShGetVariableInfo @305 NONAME
++ ShGetObjectCode @306 NONAME
++ ShCompile @307 NONAME
++ ShConstructCompiler @308 NONAME
++
+--- angle/src/libGLESv2/libGLESv2_mingw32.def.orig 2014-12-30 12:59:07.561620998 +0100
++++ angle/src/libGLESv2/libGLESv2_mingw32.def 2014-12-30 13:01:37.782182097 +0100
+@@ -294,3 +294,15 @@
+ glBindTexImage@4 @158 NONAME
+ glCreateRenderer @177 NONAME
+ glDestroyRenderer @178 NONAME
++
++ ; WebKit dependencies
++ ShInitBuiltInResources @300 NONAME
++ ShInitialize @301 NONAME
++ ShDestruct @302 NONAME
++ ShGetInfo @303 NONAME
++ ShGetInfoLog @304 NONAME
++ ShGetVariableInfo @305 NONAME
++ ShGetObjectCode @306 NONAME
++ ShCompile @307 NONAME
++ ShConstructCompiler @308 NONAME
++
diff --git a/angleproject-include-import-library-and-use-def-file.patch b/angleproject-include-import-library-and-use-def-file.patch
new file mode 100644
index 000000000000..034a2e0d9d48
--- /dev/null
+++ b/angleproject-include-import-library-and-use-def-file.patch
@@ -0,0 +1,30 @@
+--- angle/src/libGLESv2.gypi.orig 2014-12-29 16:26:05.272220904 +0100
++++ angle/src/libGLESv2.gypi 2014-12-29 16:27:33.694129236 +0100
+@@ -531,6 +531,12 @@
+ {
+ 'msvs_enable_winphone' : '1',
+ }],
++ ['TARGET=="win32"', {
++ 'ldflags': [ '-Wl,--out-implib,libGLESv2.dll.a ../src/libGLESv2/libGLESv2_mingw32.def' ],
++ }],
++ ['TARGET=="win64"', {
++ 'ldflags': [ '-Wl,--out-implib,libGLESv2.dll.a ../src/libGLESv2/libGLESv2.def' ],
++ }],
+ ],
+ 'configurations':
+ {
+--- angle/src/libEGL.gypi.orig 2014-12-29 16:27:51.546312626 +0100
++++ angle/src/libEGL.gypi 2014-12-29 16:28:53.332947338 +0100
+@@ -146,6 +146,12 @@
+ {
+ 'msvs_enable_winphone' : '1',
+ }],
++ ['TARGET=="win32"', {
++ 'ldflags': [ '-Wl,--out-implib,libEGL.dll.a ../src/libEGL/libEGL_mingw32.def' ],
++ }],
++ ['TARGET=="win64"', {
++ 'ldflags': [ '-Wl,--out-implib,libEGL.dll.a ../src/libEGL/libEGL.def' ],
++ }],
+ ],
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'msvs_settings':
diff --git a/angleproject-prevent-multiple-definition-errors.patch b/angleproject-prevent-multiple-definition-errors.patch
new file mode 100644
index 000000000000..836fffcd20f7
--- /dev/null
+++ b/angleproject-prevent-multiple-definition-errors.patch
@@ -0,0 +1,39 @@
+--- angle/src/libGLESv2.gypi.orig 2014-12-29 15:37:12.356076212 +0100
++++ angle/src/libGLESv2.gypi 2014-12-29 15:37:36.310322769 +0100
+@@ -21,25 +21,11 @@
+ '../include/GLSLANG/ShaderVars.h',
+ '../include/KHR/khrplatform.h',
+ '../include/angle_gl.h',
+- 'common/RefCountObject.cpp',
+- 'common/RefCountObject.h',
+- 'common/angleutils.cpp',
+- 'common/angleutils.h',
+- 'common/blocklayout.cpp',
+- 'common/blocklayout.h',
+ 'common/debug.cpp',
+ 'common/debug.h',
+- 'common/event_tracer.cpp',
+- 'common/event_tracer.h',
+ 'common/features.h',
+- 'common/mathutil.cpp',
+- 'common/mathutil.h',
+ 'common/platform.h',
+ 'common/NativeWindow.h',
+- 'common/tls.cpp',
+- 'common/tls.h',
+- 'common/utilities.cpp',
+- 'common/utilities.h',
+ 'common/version.h',
+ 'libGLESv2/BinaryStream.h',
+ 'libGLESv2/Buffer.cpp',
+--- angle/src/compiler.gypi.orig 2014-12-30 16:14:45.387688544 +0100
++++ angle/src/compiler.gypi 2014-12-30 16:14:52.091758591 +0100
+@@ -27,8 +27,6 @@
+ 'common/angleutils.cpp',
+ 'common/blocklayout.cpp',
+ 'common/blocklayout.h',
+- 'common/debug.cpp',
+- 'common/debug.h',
+ 'common/event_tracer.cpp',
+ 'common/event_tracer.h',
+ 'common/mathutil.cpp',
diff --git a/angleproject-undo-mingw-org-compatibility.patch b/angleproject-undo-mingw-org-compatibility.patch
new file mode 100644
index 000000000000..4496d6992d36
--- /dev/null
+++ b/angleproject-undo-mingw-org-compatibility.patch
@@ -0,0 +1,11 @@
+--- angle/src/common/platform.h.orig 2014-12-29 14:28:40.707691427 +0100
++++ angle/src/common/platform.h 2014-12-29 14:28:57.662866462 +0100
+@@ -82,7 +82,7 @@
+ # endif
+ # endif
+
+-# if defined(__MINGW32__) // Missing defines on MinGW
++# if defined(__MINGW32__) && 0 // Missing defines on MinGW
+ typedef enum D3D11_MAP_FLAG
+ {
+ D3D11_MAP_FLAG_DO_NOT_WAIT = 0x100000L
diff --git a/angleproject-undo-mingw-org-compatibility2.patch b/angleproject-undo-mingw-org-compatibility2.patch
new file mode 100644
index 000000000000..f4db2817cb97
--- /dev/null
+++ b/angleproject-undo-mingw-org-compatibility2.patch
@@ -0,0 +1,13 @@
+--- angle/src/common/platform.h.orig 2014-12-30 22:25:05.452862806 +0100
++++ angle/src/common/platform.h 2014-12-30 22:25:23.828052663 +0100
+@@ -63,9 +63,9 @@
+ # include <d3d10.h>
+ # include <d3d11.h>
+ # include <dxgi.h>
++# include <dxgi1_2.h>
+ # if defined(_MSC_VER) && (_MSC_VER >= 1700)
+ # include <d3d11_1.h>
+-# include <dxgi1_2.h>
+ # endif
+ # if !defined(COMPILER_IMPLEMENTATION)
+ # include <d3dcompiler.h>
diff --git a/angleproject-undo-shader-renames.patch b/angleproject-undo-shader-renames.patch
new file mode 100644
index 000000000000..470756ab8dc0
--- /dev/null
+++ b/angleproject-undo-shader-renames.patch
@@ -0,0 +1,162 @@
+--- angle/src/libGLESv2/renderer/d3d/d3d9/Blit9.cpp 2014-12-29 14:58:14.398042285 +0100
++++ angle/src/libGLESv2/renderer/d3d/d3d9/Blit9.cpp.orig 2014-12-29 14:57:55.097843925 +0100
+@@ -27,20 +27,20 @@
+
+ const BYTE* const g_shaderCode[] =
+ {
+- g_vs20_VS_standard,
+- g_vs20_VS_flipy,
+- g_ps20_PS_passthrough,
+- g_ps20_PS_luminance,
+- g_ps20_PS_componentmask
++ g_vs20_standardvs,
++ g_vs20_flipyvs,
++ g_ps20_passthroughps,
++ g_ps20_luminanceps,
++ g_ps20_componentmaskps
+ };
+
+ const size_t g_shaderSize[] =
+ {
+- sizeof(g_vs20_VS_standard),
+- sizeof(g_vs20_VS_flipy),
+- sizeof(g_ps20_PS_passthrough),
+- sizeof(g_ps20_PS_luminance),
+- sizeof(g_ps20_PS_componentmask)
++ sizeof(g_vs20_standardvs),
++ sizeof(g_vs20_flipyvs),
++ sizeof(g_ps20_passthroughps),
++ sizeof(g_ps20_luminanceps),
++ sizeof(g_ps20_componentmaskps)
+ };
+ }
+
+--- angle/src/libGLESv2/renderer/d3d/d3d11/Blit11.cpp.orig 2014-12-29 15:05:57.769805226 +0100
++++ angle/src/libGLESv2/renderer/d3d/d3d11/Blit11.cpp 2014-12-29 15:06:40.179241153 +0100
+@@ -13,39 +13,39 @@
+ #include "libGLESv2/main.h"
+ #include "libGLESv2/formatutils.h"
+
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthrough2dvs.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughdepth2dps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2duips.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dips.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2dps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2duips.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2dips.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg2dps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg2duips.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg2dips.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr2dps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr2duips.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr2dips.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughlum2dps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2dps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughdepth2d11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dui11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2di11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2d11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2dui11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2di11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg2d11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg2dui11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg2di11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr2d11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr2dui11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr2di11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughlum2d11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2d11ps.h"
+
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthrough3dvs.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthrough3dgs.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3dps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3duips.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3dips.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3dps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3duips.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3dips.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg3dps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg3duips.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg3dips.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr3dps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr3duips.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr3dips.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughlum3dps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha3dps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthrough3d11vs.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthrough3d11gs.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3dui11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3di11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3d11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3dui11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3di11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg3d11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg3dui11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrg3di11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr3d11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr3dui11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughr3di11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughlum3d11ps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h"
+
+ #include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/swizzlef2dps.h"
+ #include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/swizzlei2dps.h"
+--- angle/src/libGLESv2/renderer/d3d/d3d11/Clear11.cpp.orig 2014-12-29 15:07:22.962680910 +0100
++++ angle/src/libGLESv2/renderer/d3d/d3d11/Clear11.cpp 2014-12-29 15:07:33.924793589 +0100
+@@ -15,14 +15,14 @@
+ #include "libGLESv2/FramebufferAttachment.h"
+
+ // Precompiled shaders
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearfloatvs.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearfloatps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearfloat11vs.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps.h"
+
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearuintvs.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearuintps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearuint11vs.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearuint11ps.h"
+
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearsintvs.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearsintps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearsint11vs.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/clearsint11ps.h"
+
+ namespace rx
+ {
+--- angle/src/libGLESv2/renderer/d3d/d3d11/PixelTransfer11.cpp.orig 2014-12-29 15:08:04.781110747 +0100
++++ angle/src/libGLESv2/renderer/d3d/d3d11/PixelTransfer11.cpp 2014-12-29 15:08:16.912235446 +0100
+@@ -22,11 +22,11 @@
+ #include "libGLESv2/Context.h"
+
+ // Precompiled shaders
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexturevs.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexturegs.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexture_4fps.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexture_4ips.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexture_4uips.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_vs.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_gs.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4f.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4i.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4ui.h"
+
+ namespace rx
+ {
+--- angle/src/libGLESv2/renderer/d3d/d3d11/SwapChain11.cpp.orig 2014-12-29 15:08:54.720624075 +0100
++++ angle/src/libGLESv2/renderer/d3d/d3d11/SwapChain11.cpp 2014-12-29 15:09:04.775727437 +0100
+@@ -12,8 +12,8 @@
+ #include "libGLESv2/renderer/d3d/d3d11/Renderer11.h"
+
+ // Precompiled shaders
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthrough2dvs.h"
+-#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dps.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h"
++#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h"
+
+ #include "common/features.h"
+ #include "common/NativeWindow.h"
diff --git a/commit-409078f b/commit-409078f
new file mode 100644
index 000000000000..af016deb7c7b
--- /dev/null
+++ b/commit-409078f
@@ -0,0 +1,363 @@
+commit 409078f1e7c4ec79a1cbc58e3d0b3c399831ac5b
+Author: Zhenyao Mo <zmo@chromium.org>
+Date: Tue Oct 28 13:23:18 2014 -0700
+
+ Remove ShGetVariableInfo() and related code.
+
+ BUG=angle:775
+ TEST=chromium builds and runs fine
+
+ Change-Id: Ic62d3a3c9a8f034880b77a96f7f1c6be2691985e
+ Reviewed-on: https://chromium-review.googlesource.com/226004
+ Tested-by: Zhenyao Mo <zmo@chromium.org>
+ Reviewed-by: Jamie Madill <jmadill@chromium.org>
+ Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
+
+diff --git a/include/GLSLANG/ShaderLang.h b/include/GLSLANG/ShaderLang.h
+index 76012cf..def4946 100644
+--- a/include/GLSLANG/ShaderLang.h
++++ b/include/GLSLANG/ShaderLang.h
+@@ -48,7 +48,7 @@ extern "C" {
+
+ // Version number for shader translation API.
+ // It is incremented every time the API changes.
+-#define ANGLE_SH_VERSION 130
++#define ANGLE_SH_VERSION 131
+
+ typedef enum {
+ SH_GLES2_SPEC = 0x8B40,
+@@ -86,21 +86,8 @@ typedef enum {
+ } ShShaderOutput;
+
+ typedef enum {
+- SH_PRECISION_HIGHP = 0x5001,
+- SH_PRECISION_MEDIUMP = 0x5002,
+- SH_PRECISION_LOWP = 0x5003,
+- SH_PRECISION_UNDEFINED = 0
+-} ShPrecisionType;
+-
+-typedef enum {
+ SH_INFO_LOG_LENGTH = 0x8B84,
+ SH_OBJECT_CODE_LENGTH = 0x8B88, // GL_SHADER_SOURCE_LENGTH
+- SH_ACTIVE_UNIFORMS = 0x8B86,
+- SH_ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87,
+- SH_ACTIVE_ATTRIBUTES = 0x8B89,
+- SH_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A,
+- SH_VARYINGS = 0x8BBB,
+- SH_VARYING_MAX_LENGTH = 0x8BBC,
+ SH_MAPPED_NAME_MAX_LENGTH = 0x6000,
+ SH_NAME_MAX_LENGTH = 0x6001,
+ SH_HASHED_NAME_MAX_LENGTH = 0x6002,
+@@ -364,17 +351,6 @@ COMPILER_EXPORT int ShCompile(
+ // including the null termination character.
+ // SH_OBJECT_CODE_LENGTH: the number of characters in the object code
+ // including the null termination character.
+-// SH_ACTIVE_ATTRIBUTES: the number of active attribute variables.
+-// SH_ACTIVE_ATTRIBUTE_MAX_LENGTH: the length of the longest active attribute
+-// variable name including the null
+-// termination character.
+-// SH_ACTIVE_UNIFORMS: the number of active uniform variables.
+-// SH_ACTIVE_UNIFORM_MAX_LENGTH: the length of the longest active uniform
+-// variable name including the null
+-// termination character.
+-// SH_VARYINGS: the number of varying variables.
+-// SH_VARYING_MAX_LENGTH: the length of the longest varying variable name
+-// including the null termination character.
+ // SH_MAPPED_NAME_MAX_LENGTH: the length of the mapped variable name including
+ // the null termination character.
+ // SH_NAME_MAX_LENGTH: the max length of a user-defined name including the
+@@ -410,44 +386,6 @@ COMPILER_EXPORT void ShGetInfoLog(const ShHandle handle, char* infoLog);
+ // ShGetInfo with SH_OBJECT_CODE_LENGTH.
+ COMPILER_EXPORT void ShGetObjectCode(const ShHandle handle, char* objCode);
+
+-// Returns information about a shader variable.
+-// Parameters:
+-// handle: Specifies the compiler
+-// variableType: Specifies the variable type; options include
+-// SH_ACTIVE_ATTRIBUTES, SH_ACTIVE_UNIFORMS, SH_VARYINGS.
+-// index: Specifies the index of the variable to be queried.
+-// length: Returns the number of characters actually written in the string
+-// indicated by name (excluding the null terminator) if a value other
+-// than NULL is passed.
+-// size: Returns the size of the variable.
+-// type: Returns the data type of the variable.
+-// precision: Returns the precision of the variable.
+-// staticUse: Returns 1 if the variable is accessed in a statement after
+-// pre-processing, whether or not run-time flow of control will
+-// cause that statement to be executed.
+-// Returns 0 otherwise.
+-// name: Returns a null terminated string containing the name of the
+-// variable. It is assumed that name has enough memory to accormodate
+-// the variable name. The size of the buffer required to store the
+-// variable name can be obtained by calling ShGetInfo with
+-// SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, SH_ACTIVE_UNIFORM_MAX_LENGTH,
+-// SH_VARYING_MAX_LENGTH.
+-// mappedName: Returns a null terminated string containing the mapped name of
+-// the variable, It is assumed that mappedName has enough memory
+-// (SH_MAPPED_NAME_MAX_LENGTH), or NULL if don't care about the
+-// mapped name. If the name is not mapped, then name and mappedName
+-// are the same.
+-COMPILER_EXPORT void ShGetVariableInfo(const ShHandle handle,
+- ShShaderInfo variableType,
+- int index,
+- size_t* length,
+- int* size,
+- sh::GLenum* type,
+- ShPrecisionType* precision,
+- int* staticUse,
+- char* name,
+- char* mappedName);
+-
+ // Returns information about a name hashing entry from the latest compile.
+ // Parameters:
+ // handle: Specifies the compiler
+diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp
+index 2824064..a93d7e6 100644
+--- a/src/compiler/translator/Compiler.cpp
++++ b/src/compiler/translator/Compiler.cpp
+@@ -384,7 +384,6 @@ void TCompiler::clearResults()
+ uniforms.clear();
+ expandedUniforms.clear();
+ varyings.clear();
+- expandedVaryings.clear();
+ interfaceBlocks.clear();
+
+ builtInFunctionEmulator.Cleanup();
+@@ -518,10 +517,8 @@ void TCompiler::collectVariables(TIntermNode* root)
+ symbolTable);
+ root->traverse(&collect);
+
+- // For backwards compatiblity with ShGetVariableInfo, expand struct
+- // uniforms and varyings into separate variables for each field.
+- sh::ExpandVariables(uniforms, &expandedUniforms);
+- sh::ExpandVariables(varyings, &expandedVaryings);
++ // This is for enforcePackingRestriction().
++ sh::ExpandUniforms(uniforms, &expandedUniforms);
+ }
+
+ bool TCompiler::enforcePackingRestrictions()
+diff --git a/src/compiler/translator/Compiler.h b/src/compiler/translator/Compiler.h
+index 6d1e225..145ecb4 100644
+--- a/src/compiler/translator/Compiler.h
++++ b/src/compiler/translator/Compiler.h
+@@ -72,9 +72,7 @@ class TCompiler : public TShHandleBase
+ const std::vector<sh::Attribute> &getAttributes() const { return attributes; }
+ const std::vector<sh::Attribute> &getOutputVariables() const { return outputVariables; }
+ const std::vector<sh::Uniform> &getUniforms() const { return uniforms; }
+- const std::vector<sh::ShaderVariable> &getExpandedUniforms() const { return expandedUniforms; }
+ const std::vector<sh::Varying> &getVaryings() const { return varyings; }
+- const std::vector<sh::ShaderVariable> &getExpandedVaryings() const { return expandedVaryings; }
+ const std::vector<sh::InterfaceBlock> &getInterfaceBlocks() const { return interfaceBlocks; }
+
+ ShHashFunction64 getHashFunction() const { return hashFunction; }
+@@ -144,7 +142,6 @@ class TCompiler : public TShHandleBase
+ std::vector<sh::Uniform> uniforms;
+ std::vector<sh::ShaderVariable> expandedUniforms;
+ std::vector<sh::Varying> varyings;
+- std::vector<sh::ShaderVariable> expandedVaryings;
+ std::vector<sh::InterfaceBlock> interfaceBlocks;
+
+ private:
+diff --git a/src/compiler/translator/ShaderLang.cpp b/src/compiler/translator/ShaderLang.cpp
+index 144ef90..35dac5f 100644
+--- a/src/compiler/translator/ShaderLang.cpp
++++ b/src/compiler/translator/ShaderLang.cpp
+@@ -37,72 +37,6 @@ bool isInitialized = false;
+ // and the shading language compiler.
+ //
+
+-static bool CheckVariableMaxLengths(const ShHandle handle,
+- size_t expectedValue)
+-{
+- size_t activeUniformLimit = 0;
+- ShGetInfo(handle, SH_ACTIVE_UNIFORM_MAX_LENGTH, &activeUniformLimit);
+- size_t activeAttribLimit = 0;
+- ShGetInfo(handle, SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, &activeAttribLimit);
+- size_t varyingLimit = 0;
+- ShGetInfo(handle, SH_VARYING_MAX_LENGTH, &varyingLimit);
+- return (expectedValue == activeUniformLimit &&
+- expectedValue == activeAttribLimit &&
+- expectedValue == varyingLimit);
+-}
+-
+-bool CheckMappedNameMaxLength(const ShHandle handle, size_t expectedValue)
+-{
+- size_t mappedNameMaxLength = 0;
+- ShGetInfo(handle, SH_MAPPED_NAME_MAX_LENGTH, &mappedNameMaxLength);
+- return (expectedValue == mappedNameMaxLength);
+-}
+-
+-template <typename VarT>
+-const sh::ShaderVariable *ReturnVariable(const std::vector<VarT> &infoList, int index)
+-{
+- if (index < 0 || static_cast<size_t>(index) >= infoList.size())
+- {
+- return NULL;
+- }
+-
+- return &infoList[index];
+-}
+-
+-const sh::ShaderVariable *GetVariable(const TCompiler *compiler, ShShaderInfo varType, int index)
+-{
+- switch (varType)
+- {
+- case SH_ACTIVE_ATTRIBUTES:
+- return ReturnVariable(compiler->getAttributes(), index);
+- case SH_ACTIVE_UNIFORMS:
+- return ReturnVariable(compiler->getExpandedUniforms(), index);
+- case SH_VARYINGS:
+- return ReturnVariable(compiler->getExpandedVaryings(), index);
+- default:
+- UNREACHABLE();
+- return NULL;
+- }
+-}
+-
+-ShPrecisionType ConvertPrecision(sh::GLenum precision)
+-{
+- switch (precision)
+- {
+- case GL_HIGH_FLOAT:
+- case GL_HIGH_INT:
+- return SH_PRECISION_HIGHP;
+- case GL_MEDIUM_FLOAT:
+- case GL_MEDIUM_INT:
+- return SH_PRECISION_MEDIUMP;
+- case GL_LOW_FLOAT:
+- case GL_LOW_INT:
+- return SH_PRECISION_LOWP;
+- default:
+- return SH_PRECISION_UNDEFINED;
+- }
+-}
+-
+ template <typename VarT>
+ const std::vector<VarT> *GetVariableList(const TCompiler *compiler, ShaderVariableType variableType);
+
+@@ -315,24 +249,6 @@ void ShGetInfo(const ShHandle handle, ShShaderInfo pname, size_t* params)
+ case SH_OBJECT_CODE_LENGTH:
+ *params = compiler->getInfoSink().obj.size() + 1;
+ break;
+- case SH_ACTIVE_UNIFORMS:
+- *params = compiler->getExpandedUniforms().size();
+- break;
+- case SH_ACTIVE_UNIFORM_MAX_LENGTH:
+- *params = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
+- break;
+- case SH_ACTIVE_ATTRIBUTES:
+- *params = compiler->getAttributes().size();
+- break;
+- case SH_ACTIVE_ATTRIBUTE_MAX_LENGTH:
+- *params = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
+- break;
+- case SH_VARYINGS:
+- *params = compiler->getExpandedVaryings().size();
+- break;
+- case SH_VARYING_MAX_LENGTH:
+- *params = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
+- break;
+ case SH_MAPPED_NAME_MAX_LENGTH:
+ // Use longer length than MAX_SHORTENED_IDENTIFIER_SIZE to
+ // handle array and struct dereferences.
+@@ -400,58 +316,6 @@ void ShGetObjectCode(const ShHandle handle, char* objCode)
+ strcpy(objCode, infoSink.obj.c_str());
+ }
+
+-void ShGetVariableInfo(const ShHandle handle,
+- ShShaderInfo varType,
+- int index,
+- size_t* length,
+- int* size,
+- sh::GLenum* type,
+- ShPrecisionType* precision,
+- int* staticUse,
+- char* name,
+- char* mappedName)
+-{
+- if (!handle || !size || !type || !precision || !staticUse || !name)
+- return;
+- ASSERT((varType == SH_ACTIVE_ATTRIBUTES) ||
+- (varType == SH_ACTIVE_UNIFORMS) ||
+- (varType == SH_VARYINGS));
+-
+- TShHandleBase* base = reinterpret_cast<TShHandleBase*>(handle);
+- TCompiler* compiler = base->getAsCompiler();
+- if (compiler == 0)
+- return;
+-
+- const sh::ShaderVariable *varInfo = GetVariable(compiler, varType, index);
+- if (!varInfo)
+- {
+- return;
+- }
+-
+- if (length) *length = varInfo->name.size();
+- *size = varInfo->elementCount();
+- *type = varInfo->type;
+- *precision = ConvertPrecision(varInfo->precision);
+- *staticUse = varInfo->staticUse ? 1 : 0;
+-
+- // This size must match that queried by
+- // SH_ACTIVE_UNIFORM_MAX_LENGTH, SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, SH_VARYING_MAX_LENGTH
+- // in ShGetInfo, below.
+- size_t variableLength = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
+- ASSERT(CheckVariableMaxLengths(handle, variableLength));
+- strncpy(name, varInfo->name.c_str(), variableLength);
+- name[variableLength - 1] = 0;
+- if (mappedName)
+- {
+- // This size must match that queried by
+- // SH_MAPPED_NAME_MAX_LENGTH in ShGetInfo, below.
+- size_t maxMappedNameLength = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
+- ASSERT(CheckMappedNameMaxLength(handle, maxMappedNameLength));
+- strncpy(mappedName, varInfo->mappedName.c_str(), maxMappedNameLength);
+- mappedName[maxMappedNameLength - 1] = 0;
+- }
+-}
+-
+ void ShGetNameHashingEntry(const ShHandle handle,
+ int index,
+ char* name,
+diff --git a/src/compiler/translator/VariableInfo.cpp b/src/compiler/translator/VariableInfo.cpp
+index cd92706..d8e1378 100644
+--- a/src/compiler/translator/VariableInfo.cpp
++++ b/src/compiler/translator/VariableInfo.cpp
+@@ -466,9 +466,8 @@ bool CollectVariables::visitBinary(Visit, TIntermBinary *binaryNode)
+ return true;
+ }
+
+-template <typename VarT>
+-void ExpandVariables(const std::vector<VarT> &compact,
+- std::vector<ShaderVariable> *expanded)
++void ExpandUniforms(const std::vector<Uniform> &compact,
++ std::vector<ShaderVariable> *expanded)
+ {
+ for (size_t variableIndex = 0; variableIndex < compact.size(); variableIndex++)
+ {
+@@ -477,7 +476,4 @@ void ExpandVariables(const std::vector<VarT> &compact,
+ }
+ }
+
+-template void ExpandVariables(const std::vector<Uniform> &, std::vector<ShaderVariable> *);
+-template void ExpandVariables(const std::vector<Varying> &, std::vector<ShaderVariable> *);
+-
+ }
+diff --git a/src/compiler/translator/VariableInfo.h b/src/compiler/translator/VariableInfo.h
+index 9c6b6ba..92d376d 100644
+--- a/src/compiler/translator/VariableInfo.h
++++ b/src/compiler/translator/VariableInfo.h
+@@ -59,10 +59,9 @@ class CollectVariables : public TIntermTraverser
+ const TSymbolTable &mSymbolTable;
+ };
+
+-// Expand struct variables to flattened lists of split variables
+-template <typename VarT>
+-void ExpandVariables(const std::vector<VarT> &compact,
+- std::vector<ShaderVariable> *expanded);
++// Expand struct uniforms to flattened lists of split variables
++void ExpandUniforms(const std::vector<Uniform> &compact,
++ std::vector<ShaderVariable> *expanded);
+
+ }
+
diff --git a/commit-4de44cb b/commit-4de44cb
new file mode 100644
index 000000000000..4c1c63ecbe83
--- /dev/null
+++ b/commit-4de44cb
@@ -0,0 +1,747 @@
+commit 4de44cb67e9e36966fb1993c0be35659a47182ef
+Author: Zhenyao Mo <zmo@chromium.org>
+Date: Wed Oct 29 18:03:46 2014 -0700
+
+ Change ShaderLang APIs from c style to c++ style.
+
+ BUG=angle:816
+ TEST=gpu_unittests,angle_unittests,webgl_conformance
+
+ Change-Id: I0b46c11f6055a82511bb946a6dc491360835526e
+ Reviewed-on: https://chromium-review.googlesource.com/226410
+ Reviewed-by: Zhenyao Mo <zmo@chromium.org>
+ Tested-by: Zhenyao Mo <zmo@chromium.org>
+
+diff --git a/include/GLSLANG/ShaderLang.h b/include/GLSLANG/ShaderLang.h
+index 0c1f8a0..647fed6 100644
+--- a/include/GLSLANG/ShaderLang.h
++++ b/include/GLSLANG/ShaderLang.h
+@@ -27,6 +27,10 @@
+
+ #include "KHR/khrplatform.h"
+
++#include <map>
++#include <string>
++#include <vector>
++
+ //
+ // This is the platform independent interface between an OGL driver
+ // and the shading language compiler.
+@@ -42,13 +46,9 @@ typedef unsigned int GLenum;
+ // Note: make sure to increment ANGLE_SH_VERSION when changing ShaderVars.h
+ #include "ShaderVars.h"
+
+-#ifdef __cplusplus
+-extern "C" {
+-#endif
+-
+ // Version number for shader translation API.
+ // It is incremented every time the API changes.
+-#define ANGLE_SH_VERSION 131
++#define ANGLE_SH_VERSION 132
+
+ typedef enum {
+ SH_GLES2_SPEC = 0x8B40,
+@@ -88,18 +88,6 @@ typedef enum {
+ SH_HLSL11_OUTPUT = 0x8B48
+ } ShShaderOutput;
+
+-typedef enum {
+- SH_INFO_LOG_LENGTH = 0x8B84,
+- SH_OBJECT_CODE_LENGTH = 0x8B88, // GL_SHADER_SOURCE_LENGTH
+- SH_MAPPED_NAME_MAX_LENGTH = 0x6000,
+- SH_NAME_MAX_LENGTH = 0x6001,
+- SH_HASHED_NAME_MAX_LENGTH = 0x6002,
+- SH_HASHED_NAMES_COUNT = 0x6003,
+- SH_SHADER_VERSION = 0x6004,
+- SH_RESOURCES_STRING_LENGTH = 0x6005,
+- SH_OUTPUT_TYPE = 0x6006
+-} ShShaderInfo;
+-
+ // Compile options.
+ typedef enum {
+ SH_VALIDATE = 0,
+@@ -198,14 +186,14 @@ typedef enum {
+ //
+ // Driver must call this first, once, before doing any other
+ // compiler operations.
+-// If the function succeeds, the return value is nonzero, else zero.
++// If the function succeeds, the return value is true, else false.
+ //
+-COMPILER_EXPORT int ShInitialize();
++COMPILER_EXPORT bool ShInitialize();
+ //
+ // Driver should call this at shutdown.
+-// If the function succeeds, the return value is nonzero, else zero.
++// If the function succeeds, the return value is true, else false.
+ //
+-COMPILER_EXPORT int ShFinalize();
++COMPILER_EXPORT bool ShFinalize();
+
+ // The 64 bits hash function. The first parameter is the input string; the
+ // second parameter is the string length.
+@@ -273,7 +261,7 @@ typedef struct
+ // Parameters:
+ // resources: The object to initialize. Will be comparable with memcmp.
+ //
+-COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources* resources);
++COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources *resources);
+
+ //
+ // ShHandle held by but opaque to the driver. It is allocated,
+@@ -282,18 +270,15 @@ COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources* resources);
+ //
+ // If handle creation fails, 0 will be returned.
+ //
+-typedef void* ShHandle;
++typedef void *ShHandle;
+
+ //
+-// Returns the a concatenated list of the items in ShBuiltInResources as a string.
++// Returns the a concatenated list of the items in ShBuiltInResources as a
++// null-terminated string.
+ // This function must be updated whenever ShBuiltInResources is changed.
+ // Parameters:
+ // handle: Specifies the handle of the compiler to be used.
+-// outStringLen: Specifies the size of the buffer, in number of characters. The size
+-// of the buffer required to store the resources string can be obtained
+-// by calling ShGetInfo with SH_RESOURCES_STRING_LENGTH.
+-// outStr: Returns a null-terminated string representing all the built-in resources.
+-COMPILER_EXPORT void ShGetBuiltInResourcesString(const ShHandle handle, size_t outStringLen, char *outStr);
++COMPILER_EXPORT const std::string &ShGetBuiltInResourcesString(const ShHandle handle);
+
+ //
+ // Driver calls these to create and destroy compiler objects.
+@@ -311,12 +296,12 @@ COMPILER_EXPORT ShHandle ShConstructCompiler(
+ sh::GLenum type,
+ ShShaderSpec spec,
+ ShShaderOutput output,
+- const ShBuiltInResources* resources);
++ const ShBuiltInResources *resources);
+ COMPILER_EXPORT void ShDestruct(ShHandle handle);
+
+ //
+ // Compiles the given shader source.
+-// If the function succeeds, the return value is nonzero, else zero.
++// If the function succeeds, the return value is true, else false.
+ // Parameters:
+ // handle: Specifies the handle of compiler to be used.
+ // shaderStrings: Specifies an array of pointers to null-terminated strings
+@@ -338,74 +323,36 @@ COMPILER_EXPORT void ShDestruct(ShHandle handle);
+ // SH_VARIABLES: Extracts attributes, uniforms, and varyings.
+ // Can be queried by calling ShGetVariableInfo().
+ //
+-COMPILER_EXPORT int ShCompile(
++COMPILER_EXPORT bool ShCompile(
+ const ShHandle handle,
+- const char* const shaderStrings[],
++ const char * const shaderStrings[],
+ size_t numStrings,
+- int compileOptions
+- );
++ int compileOptions);
+
+-// Returns a parameter from a compiled shader.
+-// Parameters:
+-// handle: Specifies the compiler
+-// pname: Specifies the parameter to query.
+-// The following parameters are defined:
+-// SH_INFO_LOG_LENGTH: the number of characters in the information log
+-// including the null termination character.
+-// SH_OBJECT_CODE_LENGTH: the number of characters in the object code
+-// including the null termination character.
+-// SH_MAPPED_NAME_MAX_LENGTH: the length of the mapped variable name including
+-// the null termination character.
+-// SH_NAME_MAX_LENGTH: the max length of a user-defined name including the
+-// null termination character.
+-// SH_HASHED_NAME_MAX_LENGTH: the max length of a hashed name including the
+-// null termination character.
+-// SH_HASHED_NAMES_COUNT: the number of hashed names from the latest compile.
+-// SH_SHADER_VERSION: the version of the shader language
+-// SH_OUTPUT_TYPE: the currently set language output type
+-//
+-// params: Requested parameter
+-COMPILER_EXPORT void ShGetInfo(const ShHandle handle,
+- ShShaderInfo pname,
+- size_t* params);
++// Return the version of the shader language.
++COMPILER_EXPORT int ShGetShaderVersion(const ShHandle handle);
++
++// Return the currently set language output type.
++COMPILER_EXPORT ShShaderOutput ShGetShaderOutputType(
++ const ShHandle handle);
+
+-// Returns nul-terminated information log for a compiled shader.
++// Returns null-terminated information log for a compiled shader.
+ // Parameters:
+ // handle: Specifies the compiler
+-// infoLog: Specifies an array of characters that is used to return
+-// the information log. It is assumed that infoLog has enough memory
+-// to accomodate the information log. The size of the buffer required
+-// to store the returned information log can be obtained by calling
+-// ShGetInfo with SH_INFO_LOG_LENGTH.
+-COMPILER_EXPORT void ShGetInfoLog(const ShHandle handle, char* infoLog);
++COMPILER_EXPORT const std::string &ShGetInfoLog(const ShHandle handle);
+
+ // Returns null-terminated object code for a compiled shader.
+ // Parameters:
+ // handle: Specifies the compiler
+-// infoLog: Specifies an array of characters that is used to return
+-// the object code. It is assumed that infoLog has enough memory to
+-// accomodate the object code. The size of the buffer required to
+-// store the returned object code can be obtained by calling
+-// ShGetInfo with SH_OBJECT_CODE_LENGTH.
+-COMPILER_EXPORT void ShGetObjectCode(const ShHandle handle, char* objCode);
+-
+-// Returns information about a name hashing entry from the latest compile.
++COMPILER_EXPORT const std::string &ShGetObjectCode(const ShHandle handle);
++
++// Returns a (original_name, hash) map containing all the user defined
++// names in the shader, including variable names, function names, struct
++// names, and struct field names.
+ // Parameters:
+ // handle: Specifies the compiler
+-// index: Specifies the index of the name hashing entry to be queried.
+-// name: Returns a null terminated string containing the user defined name.
+-// It is assumed that name has enough memory to accomodate the name.
+-// The size of the buffer required to store the user defined name can
+-// be obtained by calling ShGetInfo with SH_NAME_MAX_LENGTH.
+-// hashedName: Returns a null terminated string containing the hashed name of
+-// the uniform variable, It is assumed that hashedName has enough
+-// memory to accomodate the name. The size of the buffer required
+-// to store the name can be obtained by calling ShGetInfo with
+-// SH_HASHED_NAME_MAX_LENGTH.
+-COMPILER_EXPORT void ShGetNameHashingEntry(const ShHandle handle,
+- int index,
+- char* name,
+- char* hashedName);
++COMPILER_EXPORT const std::map<std::string, std::string> *ShGetNameHashingMap(
++ const ShHandle handle);
+
+ // Shader variable inspection.
+ // Returns a pointer to a list of variables of the designated type.
+@@ -425,17 +372,17 @@ typedef struct
+ int size;
+ } ShVariableInfo;
+
+-// Returns 1 if the passed in variables pack in maxVectors following
++// Returns true if the passed in variables pack in maxVectors following
+ // the packing rules from the GLSL 1.017 spec, Appendix A, section 7.
+-// Returns 0 otherwise. Also look at the SH_ENFORCE_PACKING_RESTRICTIONS
++// Returns false otherwise. Also look at the SH_ENFORCE_PACKING_RESTRICTIONS
+ // flag above.
+ // Parameters:
+ // maxVectors: the available rows of registers.
+ // varInfoArray: an array of variable info (types and sizes).
+ // varInfoArraySize: the size of the variable array.
+-COMPILER_EXPORT int ShCheckVariablesWithinPackingLimits(
++COMPILER_EXPORT bool ShCheckVariablesWithinPackingLimits(
+ int maxVectors,
+- ShVariableInfo* varInfoArray,
++ ShVariableInfo *varInfoArray,
+ size_t varInfoArraySize);
+
+ // Gives the compiler-assigned register for an interface block.
+@@ -446,7 +393,7 @@ COMPILER_EXPORT int ShCheckVariablesWithinPackingLimits(
+ // interfaceBlockName: Specifies the interface block
+ // indexOut: output variable that stores the assigned register
+ COMPILER_EXPORT bool ShGetInterfaceBlockRegister(const ShHandle handle,
+- const char *interfaceBlockName,
++ const std::string &interfaceBlockName,
+ unsigned int *indexOut);
+
+ // Gives the compiler-assigned register for uniforms in the default
+@@ -458,11 +405,7 @@ COMPILER_EXPORT bool ShGetInterfaceBlockRegister(const ShHandle handle,
+ // interfaceBlockName: Specifies the uniform
+ // indexOut: output variable that stores the assigned register
+ COMPILER_EXPORT bool ShGetUniformRegister(const ShHandle handle,
+- const char *uniformName,
++ const std::string &uniformName,
+ unsigned int *indexOut);
+
+-#ifdef __cplusplus
+-}
+-#endif
+-
+ #endif // _COMPILER_INTERFACE_INCLUDED_
+diff --git a/src/compiler/translator/Compiler.h b/src/compiler/translator/Compiler.h
+index 145ecb4..b6c9d13 100644
+--- a/src/compiler/translator/Compiler.h
++++ b/src/compiler/translator/Compiler.h
+@@ -80,7 +80,7 @@ class TCompiler : public TShHandleBase
+ TSymbolTable& getSymbolTable() { return symbolTable; }
+ ShShaderSpec getShaderSpec() const { return shaderSpec; }
+ ShShaderOutput getOutputType() const { return outputType; }
+- std::string getBuiltInResourcesString() const { return builtInResourcesString; }
++ const std::string &getBuiltInResourcesString() const { return builtInResourcesString; }
+
+ // Get the resources set by InitBuiltInSymbolTable
+ const ShBuiltInResources& getResources() const;
+diff --git a/src/compiler/translator/ShaderLang.cpp b/src/compiler/translator/ShaderLang.cpp
+index 35dac5f..0d6a1d6 100644
+--- a/src/compiler/translator/ShaderLang.cpp
++++ b/src/compiler/translator/ShaderLang.cpp
+@@ -84,32 +84,48 @@ const std::vector<VarT> *GetShaderVariables(const ShHandle handle, ShaderVariabl
+ return GetVariableList<VarT>(compiler, variableType);
+ }
+
++TCompiler *GetCompilerFromHandle(ShHandle handle)
++{
++ if (!handle)
++ return NULL;
++ TShHandleBase *base = static_cast<TShHandleBase *>(handle);
++ return base->getAsCompiler();
+ }
+
++TranslatorHLSL *GetTranslatorHLSLFromHandle(ShHandle handle)
++{
++ if (!handle)
++ return NULL;
++ TShHandleBase *base = static_cast<TShHandleBase *>(handle);
++ return base->getAsTranslatorHLSL();
++}
++
++} // namespace anonymous
++
+ //
+ // Driver must call this first, once, before doing any other compiler operations.
+ // Subsequent calls to this function are no-op.
+ //
+-int ShInitialize()
++bool ShInitialize()
+ {
+ if (!isInitialized)
+ {
+ isInitialized = InitProcess();
+ }
+- return isInitialized ? 1 : 0;
++ return isInitialized;
+ }
+
+ //
+ // Cleanup symbol tables
+ //
+-int ShFinalize()
++bool ShFinalize()
+ {
+ if (isInitialized)
+ {
+ DetachProcess();
+ isInitialized = false;
+ }
+- return 1;
++ return true;
+ }
+
+ //
+@@ -190,23 +206,13 @@ void ShDestruct(ShHandle handle)
+ DeleteCompiler(base->getAsCompiler());
+ }
+
+-void ShGetBuiltInResourcesString(const ShHandle handle, size_t outStringLen, char *outString)
++const std::string &ShGetBuiltInResourcesString(const ShHandle handle)
+ {
+- if (!handle || !outString)
+- {
+- return;
+- }
+-
+- TShHandleBase *base = static_cast<TShHandleBase*>(handle);
+- TCompiler *compiler = base->getAsCompiler();
+- if (!compiler)
+- {
+- return;
+- }
+-
+- strncpy(outString, compiler->getBuiltInResourcesString().c_str(), outStringLen);
+- outString[outStringLen - 1] = '\0';
++ TCompiler *compiler = GetCompilerFromHandle(handle);
++ ASSERT(compiler);
++ return compiler->getBuiltInResourcesString();
+ }
++
+ //
+ // Do an actual compile on the given strings. The result is left
+ // in the given compile object.
+@@ -214,149 +220,62 @@ void ShGetBuiltInResourcesString(const ShHandle handle, size_t outStringLen, cha
+ // Return: The return value of ShCompile is really boolean, indicating
+ // success or failure.
+ //
+-int ShCompile(
++bool ShCompile(
+ const ShHandle handle,
+- const char* const shaderStrings[],
++ const char *const shaderStrings[],
+ size_t numStrings,
+ int compileOptions)
+ {
+- if (handle == 0)
+- return 0;
+-
+- TShHandleBase* base = reinterpret_cast<TShHandleBase*>(handle);
+- TCompiler* compiler = base->getAsCompiler();
+- if (compiler == 0)
+- return 0;
++ TCompiler *compiler = GetCompilerFromHandle(handle);
++ ASSERT(compiler);
+
+- bool success = compiler->compile(shaderStrings, numStrings, compileOptions);
+- return success ? 1 : 0;
++ return compiler->compile(shaderStrings, numStrings, compileOptions);
+ }
+
+-void ShGetInfo(const ShHandle handle, ShShaderInfo pname, size_t* params)
++int ShGetShaderVersion(const ShHandle handle)
+ {
+- if (!handle || !params)
+- return;
+-
+- TShHandleBase* base = static_cast<TShHandleBase*>(handle);
+- TCompiler* compiler = base->getAsCompiler();
+- if (!compiler) return;
++ TCompiler* compiler = GetCompilerFromHandle(handle);
++ ASSERT(compiler);
++ return compiler->getShaderVersion();
++}
+
+- switch(pname)
+- {
+- case SH_INFO_LOG_LENGTH:
+- *params = compiler->getInfoSink().info.size() + 1;
+- break;
+- case SH_OBJECT_CODE_LENGTH:
+- *params = compiler->getInfoSink().obj.size() + 1;
+- break;
+- case SH_MAPPED_NAME_MAX_LENGTH:
+- // Use longer length than MAX_SHORTENED_IDENTIFIER_SIZE to
+- // handle array and struct dereferences.
+- *params = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
+- break;
+- case SH_NAME_MAX_LENGTH:
+- *params = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
+- break;
+- case SH_HASHED_NAME_MAX_LENGTH:
+- if (compiler->getHashFunction() == NULL) {
+- *params = 0;
+- } else {
+- // 64 bits hashing output requires 16 bytes for hex
+- // representation.
+- const char HashedNamePrefix[] = HASHED_NAME_PREFIX;
+- (void)HashedNamePrefix;
+- *params = 16 + sizeof(HashedNamePrefix);
+- }
+- break;
+- case SH_HASHED_NAMES_COUNT:
+- *params = compiler->getNameMap().size();
+- break;
+- case SH_SHADER_VERSION:
+- *params = compiler->getShaderVersion();
+- break;
+- case SH_RESOURCES_STRING_LENGTH:
+- *params = compiler->getBuiltInResourcesString().length() + 1;
+- break;
+- case SH_OUTPUT_TYPE:
+- *params = compiler->getOutputType();
+- break;
+- default: UNREACHABLE();
+- }
++ShShaderOutput ShGetShaderOutputType(const ShHandle handle)
++{
++ TCompiler* compiler = GetCompilerFromHandle(handle);
++ ASSERT(compiler);
++ return compiler->getOutputType();
+ }
+
+ //
+ // Return any compiler log of messages for the application.
+ //
+-void ShGetInfoLog(const ShHandle handle, char* infoLog)
++const std::string &ShGetInfoLog(const ShHandle handle)
+ {
+- if (!handle || !infoLog)
+- return;
++ TCompiler *compiler = GetCompilerFromHandle(handle);
++ ASSERT(compiler);
+
+- TShHandleBase* base = static_cast<TShHandleBase*>(handle);
+- TCompiler* compiler = base->getAsCompiler();
+- if (!compiler) return;
+-
+- TInfoSink& infoSink = compiler->getInfoSink();
+- strcpy(infoLog, infoSink.info.c_str());
++ TInfoSink &infoSink = compiler->getInfoSink();
++ return infoSink.info.str();
+ }
+
+ //
+ // Return any object code.
+ //
+-void ShGetObjectCode(const ShHandle handle, char* objCode)
++const std::string &ShGetObjectCode(const ShHandle handle)
+ {
+- if (!handle || !objCode)
+- return;
++ TCompiler *compiler = GetCompilerFromHandle(handle);
++ ASSERT(compiler);
+
+- TShHandleBase* base = static_cast<TShHandleBase*>(handle);
+- TCompiler* compiler = base->getAsCompiler();
+- if (!compiler) return;
+-
+- TInfoSink& infoSink = compiler->getInfoSink();
+- strcpy(objCode, infoSink.obj.c_str());
++ TInfoSink &infoSink = compiler->getInfoSink();
++ return infoSink.obj.str();
+ }
+
+-void ShGetNameHashingEntry(const ShHandle handle,
+- int index,
+- char* name,
+- char* hashedName)
++const std::map<std::string, std::string> *ShGetNameHashingMap(
++ const ShHandle handle)
+ {
+- if (!handle || !name || !hashedName || index < 0)
+- return;
+-
+- TShHandleBase* base = static_cast<TShHandleBase*>(handle);
+- TCompiler* compiler = base->getAsCompiler();
+- if (!compiler) return;
+-
+- const NameMap& nameMap = compiler->getNameMap();
+- if (index >= static_cast<int>(nameMap.size()))
+- return;
+-
+- NameMap::const_iterator it = nameMap.begin();
+- for (int i = 0; i < index; ++i)
+- ++it;
+-
+- size_t len = it->first.length() + 1;
+- size_t max_len = 0;
+- ShGetInfo(handle, SH_NAME_MAX_LENGTH, &max_len);
+- if (len > max_len) {
+- ASSERT(false);
+- len = max_len;
+- }
+- strncpy(name, it->first.c_str(), len);
+- // To be on the safe side in case the source is longer than expected.
+- name[len - 1] = '\0';
+-
+- len = it->second.length() + 1;
+- max_len = 0;
+- ShGetInfo(handle, SH_HASHED_NAME_MAX_LENGTH, &max_len);
+- if (len > max_len) {
+- ASSERT(false);
+- len = max_len;
+- }
+- strncpy(hashedName, it->second.c_str(), len);
+- // To be on the safe side in case the source is longer than expected.
+- hashedName[len - 1] = '\0';
++ TCompiler *compiler = GetCompilerFromHandle(handle);
++ ASSERT(compiler);
++ return &(compiler->getNameMap());
+ }
+
+ const std::vector<sh::Uniform> *ShGetUniforms(const ShHandle handle)
+@@ -384,11 +303,11 @@ const std::vector<sh::InterfaceBlock> *ShGetInterfaceBlocks(const ShHandle handl
+ return GetShaderVariables<sh::InterfaceBlock>(handle, SHADERVAR_INTERFACEBLOCK);
+ }
+
+-int ShCheckVariablesWithinPackingLimits(
+- int maxVectors, ShVariableInfo* varInfoArray, size_t varInfoArraySize)
++bool ShCheckVariablesWithinPackingLimits(
++ int maxVectors, ShVariableInfo *varInfoArray, size_t varInfoArraySize)
+ {
+ if (varInfoArraySize == 0)
+- return 1;
++ return true;
+ ASSERT(varInfoArray);
+ std::vector<sh::ShaderVariable> variables;
+ for (size_t ii = 0; ii < varInfoArraySize; ++ii)
+@@ -397,24 +316,17 @@ int ShCheckVariablesWithinPackingLimits(
+ variables.push_back(var);
+ }
+ VariablePacker packer;
+- return packer.CheckVariablesWithinPackingLimits(maxVectors, variables) ? 1 : 0;
++ return packer.CheckVariablesWithinPackingLimits(maxVectors, variables);
+ }
+
+ bool ShGetInterfaceBlockRegister(const ShHandle handle,
+- const char *interfaceBlockName,
++ const std::string &interfaceBlockName,
+ unsigned int *indexOut)
+ {
+- if (!handle || !interfaceBlockName || !indexOut)
+- {
+- return false;
+- }
++ ASSERT(indexOut);
+
+- TShHandleBase* base = static_cast<TShHandleBase*>(handle);
+- TranslatorHLSL* translator = base->getAsTranslatorHLSL();
+- if (!translator)
+- {
+- return false;
+- }
++ TranslatorHLSL *translator = GetTranslatorHLSLFromHandle(handle);
++ ASSERT(translator);
+
+ if (!translator->hasInterfaceBlock(interfaceBlockName))
+ {
+@@ -426,20 +338,12 @@ bool ShGetInterfaceBlockRegister(const ShHandle handle,
+ }
+
+ bool ShGetUniformRegister(const ShHandle handle,
+- const char *uniformName,
++ const std::string &uniformName,
+ unsigned int *indexOut)
+ {
+- if (!handle || !uniformName || !indexOut)
+- {
+- return false;
+- }
+-
+- TShHandleBase* base = static_cast<TShHandleBase*>(handle);
+- TranslatorHLSL* translator = base->getAsTranslatorHLSL();
+- if (!translator)
+- {
+- return false;
+- }
++ ASSERT(indexOut);
++ TranslatorHLSL *translator = GetTranslatorHLSLFromHandle(handle);
++ ASSERT(translator);
+
+ if (!translator->hasUniform(uniformName))
+ {
+diff --git a/src/libGLESv2/renderer/d3d/ShaderD3D.cpp b/src/libGLESv2/renderer/d3d/ShaderD3D.cpp
+index d08a81d..44e73e5 100644
+--- a/src/libGLESv2/renderer/d3d/ShaderD3D.cpp
++++ b/src/libGLESv2/renderer/d3d/ShaderD3D.cpp
+@@ -102,7 +102,7 @@ void ShaderD3D::initializeCompiler()
+ {
+ if (!mFragmentCompiler)
+ {
+- int result = ShInitialize();
++ bool result = ShInitialize();
+
+ if (result)
+ {
+@@ -252,23 +252,16 @@
+ result = ShCompile(compiler, sourceStrings, ArraySize(sourceStrings), compileOptions | SH_SOURCE_PATH);
+ }
+
+- size_t shaderVersion = 100;
+- ShGetInfo(compiler, SH_SHADER_VERSION, &shaderVersion);
++ mShaderVersion = ShGetShaderVersion(compiler);
+
+- mShaderVersion = static_cast<int>(shaderVersion);
+-
+- if (shaderVersion == 300 && data.clientVersion < 3)
++ if (mShaderVersion == 300 && data.clientVersion < 3)
+ {
+ mInfoLog = "GLSL ES 3.00 is not supported by OpenGL ES 2.0 contexts";
+ TRACE("\n%s", mInfoLog.c_str());
+ }
+ else if (result)
+ {
+- size_t objCodeLen = 0;
+- ShGetInfo(compiler, SH_OBJECT_CODE_LENGTH, &objCodeLen);
+-
+- std::vector<char> outputHLSL(objCodeLen);
+- ShGetObjectCode(compiler, outputHLSL.data());
++ mHlsl = ShGetObjectCode(compiler);
+
+ #ifdef _DEBUG
+ // Prefix hlsl shader with commented out glsl shader
+@@ -288,10 +281,8 @@ void ShaderD3D::compileToHLSL(void *compiler, const std::string &source)
+ curPos = (nextLine == std::string::npos) ? std::string::npos : (nextLine + 1);
+ }
+ hlslStream << "\n\n";
+- hlslStream << outputHLSL.data();
++ hlslStream << mHlsl;
+ mHlsl = hlslStream.str();
+-#else
+- mHlsl = outputHLSL.data();
+ #endif
+
+ mUniforms = *GetShaderVariables(ShGetUniforms(compiler));
+@@ -303,7 +294,7 @@ void ShaderD3D::compileToHLSL(void *compiler, const std::string &source)
+ if (uniform.staticUse)
+ {
+ unsigned int index = -1;
+- bool result = ShGetUniformRegister(compiler, uniform.name.c_str(), &index);
++ bool result = ShGetUniformRegister(compiler, uniform.name, &index);
+ UNUSED_ASSERTION_VARIABLE(result);
+ ASSERT(result);
+
+@@ -320,7 +311,7 @@ void ShaderD3D::compileToHLSL(void *compiler, const std::string &source)
+ if (interfaceBlock.staticUse)
+ {
+ unsigned int index = -1;
+- bool result = ShGetInterfaceBlockRegister(compiler, interfaceBlock.name.c_str(), &index);
++ bool result = ShGetInterfaceBlockRegister(compiler, interfaceBlock.name, &index);
+ UNUSED_ASSERTION_VARIABLE(result);
+ ASSERT(result);
+
+@@ -330,14 +321,9 @@ void ShaderD3D::compileToHLSL(void *compiler, const std::string &source)
+ }
+ else
+ {
+- size_t infoLogLen = 0;
+- ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &infoLogLen);
++ mInfoLog = ShGetInfoLog(compiler);
+
+- std::vector<char> infoLog(infoLogLen);
+- ShGetInfoLog(compiler, infoLog.data());
+- mInfoLog = infoLog.data();
+-
+- TRACE("\n%s", infoLog.data());
++ TRACE("\n%s", mInfoLog.c_str());
+ }
+ }
+
+@@ -419,10 +405,7 @@
+ default: UNREACHABLE(); return SH_HLSL9_OUTPUT;
+ }
+
+- size_t outputType = 0;
+- ShGetInfo(compiler, SH_OUTPUT_TYPE, &outputType);
+-
+- return static_cast<ShShaderOutput>(outputType);
++ return ShGetShaderOutputType(compiler);
+ }
+
+ bool ShaderD3D::compile(const gl::Data &data, const std::string &source)
+diff --git a/tests/compiler_tests/ExpressionLimit_test.cpp b/tests/compiler_tests/ExpressionLimit_test.cpp
+index 0236064..1dc2be6 100644
+--- a/tests/compiler_tests/ExpressionLimit_test.cpp
++++ b/tests/compiler_tests/ExpressionLimit_test.cpp
+@@ -144,19 +144,18 @@ protected:
+ // substring in the error log. This way we know the error is specific
+ // to the issue we are testing.
+ bool CheckShaderCompilation(ShHandle compiler,
+- const char* source,
++ const char *source,
+ int compileOptions,
+- const char* expected_error) {
++ const char *expected_error)
++ {
+ bool success = ShCompile(compiler, &source, 1, compileOptions) != 0;
+- if (success) {
++ if (success)
++ {
+ success = !expected_error;
+- } else {
+- size_t bufferLen = 0;
+- ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &bufferLen);
+- char* buffer(new char [bufferLen]);
+- ShGetInfoLog(compiler, buffer);
+- std::string log(buffer, buffer + bufferLen);
+- delete [] buffer;
++ }
++ else
++ {
++ std::string log = ShGetInfoLog(compiler);
+ if (expected_error)
+ success = log.find(expected_error) != std::string::npos;
+
diff --git a/libEGL_mingw32.def b/libEGL_mingw32.def
new file mode 100644
index 000000000000..492ad4d0cf76
--- /dev/null
+++ b/libEGL_mingw32.def
@@ -0,0 +1,41 @@
+LIBRARY libEGL
+EXPORTS
+ eglBindAPI@4 @14
+ eglBindTexImage@12 @20
+ eglChooseConfig@20 @7
+ eglCopyBuffers@12 @33
+ eglCreateContext@16 @23
+ eglCreatePbufferFromClientBuffer@20 @18
+ eglCreatePbufferSurface@12 @10
+ eglCreatePixmapSurface@16 @11
+ eglCreateWindowSurface@16 @9
+ eglDestroyContext@8 @24
+ eglDestroySurface@8 @12
+ eglGetConfigAttrib@16 @8
+ eglGetConfigs@16 @6
+ eglGetCurrentContext@0 @26
+ eglGetCurrentDisplay@0 @28
+ eglGetCurrentSurface@4 @27
+ eglGetDisplay@4 @2
+ eglGetError@0 @1
+ eglGetProcAddress@4 @34
+ eglInitialize@12 @3
+ eglMakeCurrent@16 @25
+ eglQueryAPI@0 @15
+ eglQueryContext@16 @29
+ eglQueryString@8 @5
+ eglQuerySurface@16 @13
+ eglReleaseTexImage@12 @21
+ eglReleaseThread@0 @17
+ eglSurfaceAttrib@16 @19
+ eglSwapBuffers@8 @32
+ eglSwapInterval@8 @22
+ eglTerminate@4 @4
+ eglWaitClient@0 @16
+ eglWaitGL@0 @30
+ eglWaitNative@4 @31
+
+ ; Extensions
+ eglGetPlatformDisplayEXT@12 @35
+ eglQuerySurfacePointerANGLE@16 @36
+ eglPostSubBufferNV@24 @37
diff --git a/libGLESv2_mingw32.def b/libGLESv2_mingw32.def
new file mode 100644
index 000000000000..18ffcf6a0dff
--- /dev/null
+++ b/libGLESv2_mingw32.def
@@ -0,0 +1,296 @@
+LIBRARY libGLESv2
+EXPORTS
+ glActiveTexture@4 @1
+ glAttachShader@8 @2
+ glBindAttribLocation@12 @3
+ glBindBuffer@8 @4
+ glBindFramebuffer@8 @5
+ glBindRenderbuffer@8 @6
+ glBindTexture@8 @7
+ glBlendColor@16 @8
+ glBlendEquation@4 @9
+ glBlendEquationSeparate@8 @10
+ glBlendFunc@8 @11
+ glBlendFuncSeparate@16 @12
+ glBufferData@16 @13
+ glBufferSubData@16 @14
+ glCheckFramebufferStatus@4 @15
+ glClear@4 @16
+ glClearColor@16 @17
+ glClearDepthf@4 @18
+ glClearStencil@4 @19
+ glColorMask@16 @20
+ glCompileShader@4 @21
+ glCompressedTexImage2D@32 @22
+ glCompressedTexSubImage2D@36 @23
+ glCopyTexImage2D@32 @24
+ glCopyTexSubImage2D@32 @25
+ glCreateProgram@0 @26
+ glCreateShader@4 @27
+ glCullFace@4 @28
+ glDeleteBuffers@8 @29
+ glDeleteFramebuffers@8 @30
+ glDeleteProgram@4 @32
+ glDeleteRenderbuffers@8 @33
+ glDeleteShader@4 @34
+ glDeleteTextures@8 @31
+ glDepthFunc@4 @36
+ glDepthMask@4 @37
+ glDepthRangef@8 @38
+ glDetachShader@8 @35
+ glDisable@4 @39
+ glDisableVertexAttribArray@4 @40
+ glDrawArrays@12 @41
+ glDrawElements@16 @42
+ glEnable@4 @43
+ glEnableVertexAttribArray@4 @44
+ glFinish@0 @45
+ glFlush@0 @46
+ glFramebufferRenderbuffer@16 @47
+ glFramebufferTexture2D@20 @48
+ glFrontFace@4 @49
+ glGenBuffers@8 @50
+ glGenFramebuffers@8 @52
+ glGenRenderbuffers@8 @53
+ glGenTextures@8 @54
+ glGenerateMipmap@4 @51
+ glGetActiveAttrib@28 @55
+ glGetActiveUniform@28 @56
+ glGetAttachedShaders@16 @57
+ glGetAttribLocation@8 @58
+ glGetBooleanv@8 @59
+ glGetBufferParameteriv@12 @60
+ glGetError@0 @61
+ glGetFloatv@8 @62
+ glGetFramebufferAttachmentParameteriv@16 @63
+ glGetIntegerv@8 @64
+ glGetProgramInfoLog@16 @66
+ glGetProgramiv@12 @65
+ glGetRenderbufferParameteriv@12 @67
+ glGetShaderInfoLog@16 @69
+ glGetShaderPrecisionFormat@16 @70
+ glGetShaderSource@16 @71
+ glGetShaderiv@12 @68
+ glGetString@4 @72
+ glGetTexParameterfv@12 @73
+ glGetTexParameteriv@12 @74
+ glGetUniformLocation@8 @77
+ glGetUniformfv@12 @75
+ glGetUniformiv@12 @76
+ glGetVertexAttribPointerv@12 @80
+ glGetVertexAttribfv@12 @78
+ glGetVertexAttribiv@12 @79
+ glHint@8 @81
+ glIsBuffer@4 @82
+ glIsEnabled@4 @83
+ glIsFramebuffer@4 @84
+ glIsProgram@4 @85
+ glIsRenderbuffer@4 @86
+ glIsShader@4 @87
+ glIsTexture@4 @88
+ glLineWidth@4 @89
+ glLinkProgram@4 @90
+ glPixelStorei@8 @91
+ glPolygonOffset@8 @92
+ glReadPixels@28 @93
+ glReleaseShaderCompiler@0 @94
+ glRenderbufferStorage@16 @95
+ glSampleCoverage@8 @96
+ glScissor@16 @97
+ glShaderBinary@20 @98
+ glShaderSource@16 @99
+ glStencilFunc@12 @100
+ glStencilFuncSeparate@16 @101
+ glStencilMask@4 @102
+ glStencilMaskSeparate@8 @103
+ glStencilOp@12 @104
+ glStencilOpSeparate@16 @105
+ glTexImage2D@36 @106
+ glTexParameterf@12 @107
+ glTexParameterfv@12 @108
+ glTexParameteri@12 @109
+ glTexParameteriv@12 @110
+ glTexSubImage2D@36 @111
+ glUniform1f@8 @112
+ glUniform1fv@12 @113
+ glUniform1i@8 @114
+ glUniform1iv@12 @115
+ glUniform2f@12 @116
+ glUniform2fv@12 @117
+ glUniform2i@12 @118
+ glUniform2iv@12 @119
+ glUniform3f@16 @120
+ glUniform3fv@12 @121
+ glUniform3i@16 @122
+ glUniform3iv@12 @123
+ glUniform4f@20 @124
+ glUniform4fv@12 @125
+ glUniform4i@20 @126
+ glUniform4iv@12 @127
+ glUniformMatrix2fv@16 @128
+ glUniformMatrix3fv@16 @129
+ glUniformMatrix4fv@16 @130
+ glUseProgram@4 @131
+ glValidateProgram@4 @132
+ glVertexAttrib1f@8 @133
+ glVertexAttrib1fv@8 @134
+ glVertexAttrib2f@12 @135
+ glVertexAttrib2fv@8 @136
+ glVertexAttrib3f@16 @137
+ glVertexAttrib3fv@8 @138
+ glVertexAttrib4f@20 @139
+ glVertexAttrib4fv@8 @140
+ glVertexAttribPointer@24 @141
+ glViewport@16 @142
+
+ ; Extensions
+ glTexImage3DOES@40 @143
+ glBlitFramebufferANGLE@40 @149
+ glRenderbufferStorageMultisampleANGLE@20 @150
+ glDeleteFencesNV@8 @151
+ glFinishFenceNV@4 @152
+ glGenFencesNV@8 @153
+ glGetFenceivNV@12 @154
+ glIsFenceNV@4 @155
+ glSetFenceNV@8 @156
+ glTestFenceNV@4 @157
+ glGetTranslatedShaderSourceANGLE@16 @159
+ glTexStorage2DEXT@20 @160
+ glGetGraphicsResetStatusEXT@0 @161
+ glReadnPixelsEXT@32 @162
+ glGetnUniformfvEXT@16 @163
+ glGetnUniformivEXT@16 @164
+ glGenQueriesEXT@8 @165
+ glDeleteQueriesEXT@8 @166
+ glIsQueryEXT@4 @167
+ glBeginQueryEXT@8 @168
+ glEndQueryEXT@4 @169
+ glGetQueryivEXT@12 @170
+ glGetQueryObjectuivEXT@12 @171
+ glVertexAttribDivisorANGLE@8 @172
+ glDrawArraysInstancedANGLE@16 @173
+ glDrawElementsInstancedANGLE@20 @174
+ glProgramBinaryOES@16 @175
+ glGetProgramBinaryOES@20 @176
+ glDrawBuffersEXT@8 @179
+ glMapBufferOES@8 @285
+ glUnmapBufferOES@4 @286
+ glGetBufferPointervOES@12 @287
+ glMapBufferRangeEXT@16 @288
+ glFlushMappedBufferRangeEXT@12 @289
+
+ ; GLES 3.0 Functions
+ glReadBuffer@4 @180
+ glDrawRangeElements@24 @181
+ glTexImage3D@40 @182
+ glTexSubImage3D@44 @183
+ glCopyTexSubImage3D@36 @184
+ glCompressedTexImage3D@36 @185
+ glCompressedTexSubImage3D@44 @186
+ glGenQueries@8 @187
+ glDeleteQueries@8 @188
+ glIsQuery@4 @189
+ glBeginQuery@8 @190
+ glEndQuery@4 @191
+ glGetQueryiv@12 @192
+ glGetQueryObjectuiv@12 @193
+ glUnmapBuffer@4 @194
+ glGetBufferPointerv@12 @195
+ glDrawBuffers@8 @196
+ glUniformMatrix2x3fv@16 @197
+ glUniformMatrix3x2fv@16 @198
+ glUniformMatrix2x4fv@16 @199
+ glUniformMatrix4x2fv@16 @200
+ glUniformMatrix3x4fv@16 @201
+ glUniformMatrix4x3fv@16 @202
+ glBlitFramebuffer@40 @203
+ glRenderbufferStorageMultisample@20 @204
+ glFramebufferTextureLayer@20 @205
+ glMapBufferRange@16 @206
+ glFlushMappedBufferRange@12 @207
+ glBindVertexArray@4 @208
+ glDeleteVertexArrays@8 @209
+ glGenVertexArrays@8 @210
+ glIsVertexArray@4 @211
+ glGetIntegeri_v@12 @212
+ glBeginTransformFeedback@4 @213
+ glEndTransformFeedback@0 @214
+ glBindBufferRange@20 @215
+ glBindBufferBase@12 @216
+ glTransformFeedbackVaryings@16 @217
+ glGetTransformFeedbackVarying@28 @218
+ glVertexAttribIPointer@20 @219
+ glGetVertexAttribIiv@12 @220
+ glGetVertexAttribIuiv@12 @221
+ glVertexAttribI4i@20 @222
+ glVertexAttribI4ui@20 @223
+ glVertexAttribI4iv@8 @224
+ glVertexAttribI4uiv@8 @225
+ glGetUniformuiv@12 @226
+ glGetFragDataLocation@8 @227
+ glUniform1ui@8 @228
+ glUniform2ui@12 @229
+ glUniform3ui@16 @230
+ glUniform4ui@20 @231
+ glUniform1uiv@12 @232
+ glUniform2uiv@12 @233
+ glUniform3uiv@12 @234
+ glUniform4uiv@12 @235
+ glClearBufferiv@12 @236
+ glClearBufferuiv@12 @237
+ glClearBufferfv@12 @238
+ glClearBufferfi@16 @239
+ glGetStringi@8 @240
+ glCopyBufferSubData@20 @241
+ glGetUniformIndices@16 @242
+ glGetActiveUniformsiv@20 @243
+ glGetUniformBlockIndex@8 @244
+ glGetActiveUniformBlockiv@16 @245
+ glGetActiveUniformBlockName@20 @246
+ glUniformBlockBinding@12 @247
+ glDrawArraysInstanced@16 @248
+ glDrawElementsInstanced@20 @249
+ glFenceSync@8 @250
+ glIsSync@4 @251
+ glDeleteSync@4 @252
+ glClientWaitSync@16 @253
+ glWaitSync@16 @254
+ glGetInteger64v@8 @255
+ glGetSynciv@20 @256
+ glGetInteger64i_v@12 @257
+ glGetBufferParameteri64v@12 @258
+ glGenSamplers@8 @259
+ glDeleteSamplers@8 @260
+ glIsSampler@4 @261
+ glBindSampler@8 @262
+ glSamplerParameteri@12 @263
+ glSamplerParameteriv@12 @264
+ glSamplerParameterf@12 @265
+ glSamplerParameterfv@12 @266
+ glGetSamplerParameteriv@12 @267
+ glGetSamplerParameterfv@12 @268
+ glVertexAttribDivisor@8 @269
+ glBindTransformFeedback@8 @270
+ glDeleteTransformFeedbacks@8 @271
+ glGenTransformFeedbacks@8 @272
+ glIsTransformFeedback@4 @273
+ glPauseTransformFeedback@0 @274
+ glResumeTransformFeedback@0 @275
+ glGetProgramBinary@20 @276
+ glProgramBinary@16 @277
+ glProgramParameteri@12 @278
+ glInvalidateFramebuffer@12 @279
+ glInvalidateSubFramebuffer@28 @280
+ glTexStorage2D@20 @281
+ glTexStorage3D@24 @282
+ glGetInternalformativ@20 @283
+
+ ; EGL dependencies
+ glCreateContext @144 NONAME
+ glDestroyContext @145 NONAME
+ glMakeCurrent @146 NONAME
+ glGetCurrentContext @147 NONAME
+ glGetProcAddress@4 @148 NONAME
+ glBindTexImage@4 @158 NONAME
+ glCreateRenderer @177 NONAME
+ glDestroyRenderer @178 NONAME