Bug 720438 - Update ANGLE to r963 - no review
authorBenoit Jacob <jacob.benoit.1@gmail.com>
Thu, 26 Jan 2012 12:04:15 -0500
changeset 86716 f9be3f46122e1ea481f08a43d22eb53228e833d8
parent 86715 688b672929cab850269ec9a4e7111a034337f950
child 86717 9effde68bac51e8fd6cd8bfffb18886b510533da
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs720438
milestone12.0a1
Bug 720438 - Update ANGLE to r963 - no review No review because this is just syncing us with upstream: http://code.google.com/p/angleproject/ This is also doing some cleanup, removing stale/empty files and updating patches. The main benefit from this update is that long-identifier-shortening has been fixed.
content/canvas/test/webgl/failing_tests_linux.txt
content/canvas/test/webgl/failing_tests_mac.txt
content/canvas/test/webgl/failing_tests_windows.txt
gfx/angle/CONTRIBUTORS
gfx/angle/Makefile.in
gfx/angle/README.mozilla
gfx/angle/angle-intrinsic-msvc2005.patch
gfx/angle/angle-limit-identifiers-to-250-chars.patch
gfx/angle/angle-renaming-debug.patch
gfx/angle/angle-use-xmalloc.patch
gfx/angle/build/common.gypi
gfx/angle/extensions/EGL_ANGLE_query_surface_pointer.txt
gfx/angle/extensions/EGL_ANGLE_surface_d3d_texture_2d_share_handle.txt
gfx/angle/extensions/EGL_EXT_create_context_robustness.txt
gfx/angle/extensions/EXT_robustness.txt
gfx/angle/extensions/EXT_texture_storage.txt
gfx/angle/include/EGL/eglext.h
gfx/angle/include/GLES2/gl2ext.h
gfx/angle/include/GLSLANG/ResourceLimits.h
gfx/angle/include/GLSLANG/ShaderLang.h
gfx/angle/samples/gles2_book/Common/esUtil.c
gfx/angle/samples/gles2_book/Common/esUtil.h
gfx/angle/samples/translator/translator.cpp
gfx/angle/src/build_angle.gyp
gfx/angle/src/common/RefCountObject.cpp
gfx/angle/src/common/RefCountObject.h
gfx/angle/src/common/debug.cpp
gfx/angle/src/common/version.h
gfx/angle/src/compiler/Compiler.cpp
gfx/angle/src/compiler/DetectRecursion.cpp
gfx/angle/src/compiler/Link.cpp
gfx/angle/src/compiler/MapLongVariableNames.cpp
gfx/angle/src/compiler/MapLongVariableNames.h
gfx/angle/src/compiler/MozAngleLink.cpp
gfx/angle/src/compiler/OutputHLSL.cpp
gfx/angle/src/compiler/OutputHLSL.h
gfx/angle/src/compiler/ParseHelper.cpp
gfx/angle/src/compiler/ShHandle.h
gfx/angle/src/compiler/VariableInfo.cpp
gfx/angle/src/compiler/generate_glslang_lexer.sh
gfx/angle/src/compiler/generate_glslang_parser.sh
gfx/angle/src/compiler/glslang.l
gfx/angle/src/compiler/glslang.y
gfx/angle/src/compiler/glslang_lex.cpp
gfx/angle/src/compiler/glslang_tab.cpp
gfx/angle/src/compiler/glslang_tab.h
gfx/angle/src/compiler/osinclude.h
gfx/angle/src/compiler/unistd.h
gfx/angle/src/libEGL/Display.cpp
gfx/angle/src/libEGL/Display.h
gfx/angle/src/libEGL/Makefile.in
gfx/angle/src/libEGL/libEGL.vcproj
gfx/angle/src/libGLESv2/Buffer.h
gfx/angle/src/libGLESv2/Context.cpp
gfx/angle/src/libGLESv2/Context.h
gfx/angle/src/libGLESv2/Fence.cpp
gfx/angle/src/libGLESv2/Framebuffer.cpp
gfx/angle/src/libGLESv2/Framebuffer.h
gfx/angle/src/libGLESv2/Makefile.in
gfx/angle/src/libGLESv2/Program.cpp
gfx/angle/src/libGLESv2/Query.cpp
gfx/angle/src/libGLESv2/Query.h
gfx/angle/src/libGLESv2/RefCountObject.cpp
gfx/angle/src/libGLESv2/RefCountObject.h
gfx/angle/src/libGLESv2/Renderbuffer.cpp
gfx/angle/src/libGLESv2/Renderbuffer.h
gfx/angle/src/libGLESv2/Shader.cpp
gfx/angle/src/libGLESv2/Texture.cpp
gfx/angle/src/libGLESv2/Texture.h
gfx/angle/src/libGLESv2/libGLESv2.cpp
gfx/angle/src/libGLESv2/libGLESv2.def
gfx/angle/src/libGLESv2/utilities.cpp
gfx/angle/src/libGLESv2/utilities.h
--- a/content/canvas/test/webgl/failing_tests_linux.txt
+++ b/content/canvas/test/webgl/failing_tests_linux.txt
@@ -6,8 +6,9 @@ conformance/misc/uninitialized-test.html
 conformance/programs/gl-get-active-attribute.html
 conformance/textures/texture-mips.html
 conformance/uniforms/gl-uniform-bool.html
 conformance/more/conformance/quickCheckAPI-S_V.html
 conformance/more/functions/uniformfArrayLen1.html
 conformance/glsl/misc/attrib-location-length-limits.html
 conformance/glsl/misc/uniform-location-length-limits.html
 conformance/renderbuffers/framebuffer-object-attachment.html
+conformance/glsl/misc/struct-nesting-exceeds-maximum.html
--- a/content/canvas/test/webgl/failing_tests_mac.txt
+++ b/content/canvas/test/webgl/failing_tests_mac.txt
@@ -2,9 +2,10 @@ conformance/context/premultiplyalpha-tes
 conformance/glsl/misc/glsl-function-nodes.html
 conformance/glsl/misc/glsl-long-variable-names.html
 conformance/glsl/misc/shader-with-256-character-identifier.frag.html
 conformance/glsl/misc/shader-with-long-line.html
 conformance/more/conformance/quickCheckAPI-S_V.html
 conformance/more/functions/uniformfBadArgs.html
 conformance/more/functions/uniformiBadArgs.html
 conformance/glsl/misc/attrib-location-length-limits.html
-conformance/glsl/misc/uniform-location-length-limits.html
\ No newline at end of file
+conformance/glsl/misc/uniform-location-length-limits.html
+conformance/glsl/misc/struct-nesting-exceeds-maximum.html
--- a/content/canvas/test/webgl/failing_tests_windows.txt
+++ b/content/canvas/test/webgl/failing_tests_windows.txt
@@ -3,9 +3,10 @@ conformance/glsl/functions/glsl-function
 conformance/glsl/functions/glsl-function-atan-xy.html
 conformance/glsl/misc/glsl-long-variable-names.html
 conformance/glsl/misc/shader-with-256-character-identifier.frag.html
 conformance/glsl/misc/shader-with-long-line.html
 conformance/more/conformance/quickCheckAPI-S_V.html
 conformance/more/functions/uniformfArrayLen1.html
 conformance/glsl/misc/attrib-location-length-limits.html
 conformance/glsl/misc/struct-nesting-under-maximum.html
-conformance/glsl/misc/uniform-location-length-limits.html
\ No newline at end of file
+conformance/glsl/misc/uniform-location-length-limits.html
+conformance/glsl/misc/struct-nesting-exceeds-maximum.html
--- a/gfx/angle/CONTRIBUTORS
+++ b/gfx/angle/CONTRIBUTORS
@@ -26,16 +26,17 @@ Google Inc.
  Alok Priyadarshi
  Kenneth Russell
  Brian Salomon
  Ben Vanik
  Adrienne Walker
 
 Mozilla Corp.
  Ehsan Akhgari
+ Mike Hommey
  Benoit Jacob
  Makoto Kato
  Vladimir Vukicevic
 
 Apple Inc.
  David Kilzer
 
 Aitor Moreno <aitormoreno at gmail.com>
--- a/gfx/angle/Makefile.in
+++ b/gfx/angle/Makefile.in
@@ -48,17 +48,16 @@ LIBXUL_LIBRARY  = 1
 ifeq (WINNT,$(OS_TARGET))
 VISIBILITY_FLAGS =
 endif
 
 EXPORTS_NAMESPACES = angle
 
 EXPORTS_angle = \
 	include/GLSLANG/ShaderLang.h \
-	include/GLSLANG/ResourceLimits.h \
 	$(NULL)
 
 LOCAL_INCLUDES += -I$(srcdir)/include -I$(srcdir)/src
 
 VPATH += $(srcdir)/src
 VPATH += $(srcdir)/src/compiler
 VPATH += $(srcdir)/src/compiler/preprocessor
 
@@ -66,17 +65,16 @@ CPPSRCS = \
 	Compiler.cpp \
         DetectRecursion.cpp \
         InfoSink.cpp \
         Initialize.cpp \
         InitializeDll.cpp \
         Intermediate.cpp \
         intermOut.cpp \
         IntermTraverse.cpp \
-        MozAngleLink.cpp \
         parseConst.cpp \
         ParseHelper.cpp \
         PoolAlloc.cpp \
         QualifierAlive.cpp \
         RemoveTree.cpp \
         ShaderLang.cpp \
         SymbolTable.cpp \
         VariableInfo.cpp \
--- a/gfx/angle/README.mozilla
+++ b/gfx/angle/README.mozilla
@@ -1,11 +1,11 @@
 This is the ANGLE project, from http://code.google.com/p/angleproject/
 
-Current revision: r930
+Current revision: r963
 
 == Applied local patches ==
 
 In this order:
   angle-renaming-debug.patch - rename debug.h to compilerdebug.h to avoid conflict in our makefiles
   angle-intrinsic-msvc2005.patch - work around a MSVC 2005 compile error
   angle-limit-identifiers-to-250-chars.patch - see bug 675625
   angle-use-xmalloc.patch - see bug 680840. Can drop this patch whenever the new preprocessor lands.
--- a/gfx/angle/angle-intrinsic-msvc2005.patch
+++ b/gfx/angle/angle-intrinsic-msvc2005.patch
@@ -1,10 +1,10 @@
 # HG changeset patch
-# Parent 2cefa41bd95ba8875964dde3829559fd70b8101d
+# Parent 6ee54a11fd135a2b594db77f7eaf83f06ee7b1d8
 diff --git a/gfx/angle/src/libGLESv2/Texture.cpp b/gfx/angle/src/libGLESv2/Texture.cpp
 --- a/gfx/angle/src/libGLESv2/Texture.cpp
 +++ b/gfx/angle/src/libGLESv2/Texture.cpp
 @@ -8,16 +8,22 @@
  // Texture2D and TextureCubeMap. Implements GL texture objects and related
  // functionality. [OpenGL ES 2.0.24] section 3.7 page 63.
  
  #include "libGLESv2/Texture.h"
--- a/gfx/angle/angle-limit-identifiers-to-250-chars.patch
+++ b/gfx/angle/angle-limit-identifiers-to-250-chars.patch
@@ -1,10 +1,10 @@
 # HG changeset patch
-# Parent 60ae9443af647dc56c76bf9c7a5958f2ff176fb8
+# Parent 761ca19e4ce1afe03e58beaea20149ba1ef243c4
 diff --git a/gfx/angle/src/compiler/preprocessor/length_limits.h b/gfx/angle/src/compiler/preprocessor/length_limits.h
 --- a/gfx/angle/src/compiler/preprocessor/length_limits.h
 +++ b/gfx/angle/src/compiler/preprocessor/length_limits.h
 @@ -10,12 +10,14 @@
  
  #if !defined(__LENGTH_LIMITS_H)
  #define __LENGTH_LIMITS_H 1
  
--- a/gfx/angle/angle-renaming-debug.patch
+++ b/gfx/angle/angle-renaming-debug.patch
@@ -1,11 +1,10 @@
 # HG changeset patch
-# Parent 7e7cd80ef724c094b88ed8bb35f3af0ce9a9cfee
-
+# Parent 326590fb862cf7e277487f48c7a434bde3566ea0
 diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in
 --- a/gfx/angle/Makefile.in
 +++ b/gfx/angle/Makefile.in
 @@ -75,17 +75,17 @@ CPPSRCS = \
          parseConst.cpp \
          ParseHelper.cpp \
          PoolAlloc.cpp \
          QualifierAlive.cpp \
@@ -18,61 +17,16 @@ diff --git a/gfx/angle/Makefile.in b/gfx
          ossource_nspr.cpp \
          util.cpp \
          ValidateLimitations.cpp \
          ForLoopUnroll.cpp \
          MapLongVariableNames.cpp \
          BuiltInFunctionEmulator.cpp \
          $(NULL)
  
-diff --git a/gfx/angle/angle-renaming-debug.patch b/gfx/angle/angle-renaming-debug.patch
---- a/gfx/angle/angle-renaming-debug.patch
-+++ b/gfx/angle/angle-renaming-debug.patch
-@@ -1,14 +1,14 @@
- # HG changeset patch
--# Parent b6f65ca6027d397ca50783d7164a6a8fa59eef4c
-+# Parent 1879d857ef07dc5797704516caea99b231d7590a
- diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in
- --- a/gfx/angle/Makefile.in
- +++ b/gfx/angle/Makefile.in
--@@ -73,17 +73,17 @@ CPPSRCS = \
-+@@ -75,17 +75,17 @@ CPPSRCS = \
-          parseConst.cpp \
-          ParseHelper.cpp \
-          PoolAlloc.cpp \
-          QualifierAlive.cpp \
-          RemoveTree.cpp \
-          ShaderLang.cpp \
-          SymbolTable.cpp \
-          VariableInfo.cpp \
-@@ -163,22 +163,22 @@ diff --git a/gfx/angle/src/compiler/prep
-  #include <stdlib.h>
-  #include <stdio.h>
-  #include <string.h>
-  
- -#include "compiler/debug.h"
- +#include "compiler/compilerdebug.h"
-  #include "compiler/preprocessor/slglobals.h"
-  
-+ #include "../../../../../memory/mozalloc/mozalloc.h"
-+ 
-  #undef malloc
-  #undef realloc
-  #undef free
-  
-- ///////////////////////////////////////////////////////////////////////////////////////////////
-- ////////////////////////////////////////// String table: //////////////////////////////////////
- diff --git a/gfx/angle/src/compiler/preprocessor/tokens.c b/gfx/angle/src/compiler/preprocessor/tokens.c
- --- a/gfx/angle/src/compiler/preprocessor/tokens.c
- +++ b/gfx/angle/src/compiler/preprocessor/tokens.c
- @@ -45,17 +45,17 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILI
-  // tokens.c
-  //
-  
-  #include <stdlib.h>
 diff --git a/gfx/angle/src/compiler/OutputGLSLBase.cpp b/gfx/angle/src/compiler/OutputGLSLBase.cpp
 --- a/gfx/angle/src/compiler/OutputGLSLBase.cpp
 +++ b/gfx/angle/src/compiler/OutputGLSLBase.cpp
 @@ -1,16 +1,16 @@
  //
  // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
  // Use of this source code is governed by a BSD-style license that can be
  // found in the LICENSE file.
@@ -174,17 +128,17 @@ diff --git a/gfx/angle/src/compiler/comp
  
  #include <assert.h>
  
  #ifdef _DEBUG
  #define TRACE_ENABLED  // define to enable debug message tracing
 diff --git a/gfx/angle/src/compiler/osinclude.h b/gfx/angle/src/compiler/osinclude.h
 --- a/gfx/angle/src/compiler/osinclude.h
 +++ b/gfx/angle/src/compiler/osinclude.h
-@@ -30,17 +30,17 @@
+@@ -31,17 +31,17 @@
  #include <windows.h>
  #elif defined(ANGLE_OS_POSIX)
  #include <pthread.h>
  #include <semaphore.h>
  #include <errno.h>
  #endif  // ANGLE_USE_NSPR
  
  
--- a/gfx/angle/angle-use-xmalloc.patch
+++ b/gfx/angle/angle-use-xmalloc.patch
@@ -1,11 +1,10 @@
 # HG changeset patch
-# Parent bc7188c29ec5b942046c0589ce959d7985f7ad6e
-
+# Parent 93033f21b121382b50e5bc9787edf704d6906508
 diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in
 --- a/gfx/angle/Makefile.in
 +++ b/gfx/angle/Makefile.in
 @@ -129,16 +129,18 @@ CSRCS   = \
  	$(NULL)
  
  DEFINES += -DANGLE_USE_NSPR -DANGLE_BUILD -DCOMPILER_IMPLEMENTATION
  
@@ -18,85 +17,16 @@ diff --git a/gfx/angle/Makefile.in b/gfx
  ifdef MOZ_ANGLE
  
  # libEGL depends on (links against!) libGLESv2!
  DIRS = src/libGLESv2 src/libEGL
  
  libs::
  	expand "$(MOZ_D3DX9_CAB)" -F:$(MOZ_D3DX9_DLL) "$(DIST)/bin"
  	expand "$(MOZ_D3DCOMPILER_CAB)" -F:$(MOZ_D3DCOMPILER_DLL) "$(DIST)/bin"
-diff --git a/gfx/angle/angle-use-xmalloc.patch b/gfx/angle/angle-use-xmalloc.patch
---- a/gfx/angle/angle-use-xmalloc.patch
-+++ b/gfx/angle/angle-use-xmalloc.patch
-@@ -1,14 +1,14 @@
- # HG changeset patch
--# Parent 31d1c6ebb61eb118868ca924769a2fa3a50d54ef
-+# Parent 6a1ee30b3a60564c165795ecf79e9c2081ee80ab
- diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in
- --- a/gfx/angle/Makefile.in
- +++ b/gfx/angle/Makefile.in
--@@ -127,16 +127,18 @@ CSRCS   = \
-+@@ -129,16 +129,18 @@ CSRCS   = \
-  	$(NULL)
-  
-  DEFINES += -DANGLE_USE_NSPR -DANGLE_BUILD -DCOMPILER_IMPLEMENTATION
-  
-  #these defines are from ANGLE's build_angle.gyp
-  DEFINES += -DANGLE_DISABLE_TRACE
-  DEFINES += -DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0
-  
-@@ -17,47 +17,26 @@ diff --git a/gfx/angle/Makefile.in b/gfx
-  ifdef MOZ_ANGLE
-  
-  # libEGL depends on (links against!) libGLESv2!
-  DIRS = src/libGLESv2 src/libEGL
-  
-  libs::
-  	expand "$(MOZ_D3DX9_CAB)" -F:$(MOZ_D3DX9_DLL) "$(DIST)/bin"
-  	expand "$(MOZ_D3DCOMPILER_CAB)" -F:$(MOZ_D3DCOMPILER_DLL) "$(DIST)/bin"
--diff --git a/gfx/angle/README.mozilla b/gfx/angle/README.mozilla
----- a/gfx/angle/README.mozilla
--+++ b/gfx/angle/README.mozilla
--@@ -3,16 +3,17 @@ This is the ANGLE project, from http://c
-- Current revision: r885
-- 
-- == Applied local patches ==
-- 
-- In this order:
--   angle-renaming-debug.patch - rename debug.h to compilerdebug.h to avoid conflict in our makefiles
--   angle-intrinsic-msvc2005.patch - work around a MSVC 2005 compile error
--   angle-limit-identifiers-to-250-chars.patch - see bug 675625
--+  angle-use-xmalloc.patch - see bug 680840. Can drop this patch whenever the new preprocessor lands.
-- 
-- In addition to these patches, the Makefile.in files are ours, they're not present in upsteam ANGLE.
-- 
-- == How to update this ANGLE copy ==
-- 
-- 1. Unapply patches
-- 2. Apply diff with new ANGLE version
-- 3. Reapply patches.
- diff --git a/gfx/angle/src/compiler/preprocessor/atom.c b/gfx/angle/src/compiler/preprocessor/atom.c
- --- a/gfx/angle/src/compiler/preprocessor/atom.c
- +++ b/gfx/angle/src/compiler/preprocessor/atom.c
- @@ -48,16 +48,18 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILI
-  
-  #include <stdlib.h>
-  #include <stdio.h>
-  #include <string.h>
-  
-- #include "compiler/compilerdebug.h"
-+ #include "compiler/debug.h"
-  #include "compiler/preprocessor/slglobals.h"
-  
- +#include "../../../../../memory/mozalloc/mozalloc.h"
- +
-  #undef malloc
-  #undef realloc
-  #undef free
-  
 diff --git a/gfx/angle/src/compiler/preprocessor/atom.c b/gfx/angle/src/compiler/preprocessor/atom.c
 --- a/gfx/angle/src/compiler/preprocessor/atom.c
 +++ b/gfx/angle/src/compiler/preprocessor/atom.c
 @@ -48,16 +48,18 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILI
  
  #include <stdlib.h>
  #include <stdio.h>
  #include <string.h>
--- a/gfx/angle/build/common.gypi
+++ b/gfx/angle/build/common.gypi
@@ -3,16 +3,28 @@
 # found in the LICENSE file.
 
 {
   'variables': {
     'component%': 'static_library',
   },
   'target_defaults': {
     'default_configuration': 'Debug',
+    'variables': {
+      'warn_as_error%': 1,
+    },
+    'target_conditions': [
+      ['warn_as_error == 1', {
+        'msvs_settings': {
+          'VCCLCompilerTool': {
+            'WarnAsError': 'true',
+          },
+        },
+      }],
+    ],
     'configurations': {
       'Common': {
         'abstract': 1,
         'msvs_configuration_attributes': {
           'OutputDirectory': '$(SolutionDir)$(ConfigurationName)',
           'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
           'CharacterSet': '1',  # UNICODE
         },
--- a/gfx/angle/extensions/EGL_ANGLE_query_surface_pointer.txt
+++ b/gfx/angle/extensions/EGL_ANGLE_query_surface_pointer.txt
@@ -21,17 +21,17 @@ Status
     Implemented (ANGLE r558)
 
 Version
 
     Version 3, February 11, 2011
 
 Number
 
-    EGL Extension #??
+    EGL Extension #28
 
 Dependencies
 
     This extension is written against the wording of the EGL 1.4
     Specification. 
 
 Overview
 
--- a/gfx/angle/extensions/EGL_ANGLE_surface_d3d_texture_2d_share_handle.txt
+++ b/gfx/angle/extensions/EGL_ANGLE_surface_d3d_texture_2d_share_handle.txt
@@ -21,17 +21,17 @@ Status
     Implemented (ANGLE r558)
 
 Version
 
     Version 2, December 21, 2010
 
 Number
 
-    EGL Extension #??
+    EGL Extension #29
 
 Dependencies
 
     Requires the EGL_ANGLE_query_surface_pointer extension.
 
     This extension is written against the wording of the EGL 1.4
     Specification.
 
--- a/gfx/angle/extensions/EGL_EXT_create_context_robustness.txt
+++ b/gfx/angle/extensions/EGL_EXT_create_context_robustness.txt
@@ -20,17 +20,17 @@ Status
     Complete.
 
 Version
 
     Version 3, 2011/10/31
 
 Number
 
-    TBD
+    EGL Extension #37
 
 Dependencies
 
     Requires EGL 1.4
 
     Written against the EGL 1.4 specification.
 
     An OpenGL implementation supporting GL_ARB_robustness, an OpenGL ES
--- a/gfx/angle/extensions/EXT_robustness.txt
+++ b/gfx/angle/extensions/EXT_robustness.txt
@@ -21,17 +21,17 @@ Status
     Complete.
 
 Version
 
     Version 3, 2011/10/31
 
 Number
 
-    TBD
+    OpenGL ES Extension #107
 
 Dependencies
 
     This extension is written against the OpenGL ES 2.0 Specification
     but can apply to OpenGL ES 1.1 and up.
 
     EGL_EXT_create_context_robustness is used to determine if a context
     implementing this extension supports robust buffer access, and if it
--- a/gfx/angle/extensions/EXT_texture_storage.txt
+++ b/gfx/angle/extensions/EXT_texture_storage.txt
@@ -30,17 +30,17 @@ Status
 
 Version
 
     Last Modified Date: November 11, 2011
     Author Revision: 24
 
 Number
 
-    XXX - not assigned yet
+    OpenGL ES Extension #108
 
 Dependencies
 
     OpenGL ES 1.0, OpenGL ES 2.0 or OpenGL 1.2 is required.
 
     OES_texture_npot, OES_texture_cube_map, OES_texture_3D,
     OES_depth_texture, OES_packed_depth_stencil,
     OES_compressed_paletted_texture, OES_texture_float, OES_texture_half_float
--- a/gfx/angle/include/EGL/eglext.h
+++ b/gfx/angle/include/EGL/eglext.h
@@ -1,17 +1,17 @@
 #ifndef __eglext_h_
 #define __eglext_h_
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /*
-** Copyright (c) 2007-2010 The Khronos Group Inc.
+** Copyright (c) 2007-2012 The Khronos Group Inc.
 **
 ** Permission is hereby granted, free of charge, to any person obtaining a
 ** copy of this software and/or associated documentation files (the
 ** "Materials"), to deal in the Materials without restriction, including
 ** without limitation the rights to use, copy, modify, merge, publish,
 ** distribute, sublicense, and/or sell copies of the Materials, and to
 ** permit persons to whom the Materials are furnished to do so, subject to
 ** the following conditions:
@@ -29,18 +29,18 @@ extern "C" {
 */
 
 #include <EGL/eglplatform.h>
 
 /*************************************************************/
 
 /* Header file version number */
 /* Current version at http://www.khronos.org/registry/egl/ */
-/* $Revision: 15052 $ on $Date: 2011-07-06 17:43:46 -0700 (Wed, 06 Jul 2011) $ */
-#define EGL_EGLEXT_VERSION 10
+/* $Revision: 16473 $ on $Date: 2012-01-04 02:20:48 -0800 (Wed, 04 Jan 2012) $ */
+#define EGL_EGLEXT_VERSION 11
 
 #ifndef EGL_KHR_config_attribs
 #define EGL_KHR_config_attribs 1
 #define EGL_CONFORMANT_KHR			0x3042	/* EGLConfig attribute */
 #define EGL_VG_COLORSPACE_LINEAR_BIT_KHR	0x0020	/* EGL_SURFACE_TYPE bitfield */
 #define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR		0x0040	/* EGL_SURFACE_TYPE bitfield */
 #endif
 
@@ -173,25 +173,25 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLG
 
 #ifndef EGL_KHR_lock_surface2
 #define EGL_KHR_lock_surface2 1
 #define EGL_BITMAP_PIXEL_SIZE_KHR		0x3110
 #endif
 
 #ifndef EGL_NV_coverage_sample
 #define EGL_NV_coverage_sample 1
-#define EGL_COVERAGE_BUFFERS_NV 0x30E0
-#define EGL_COVERAGE_SAMPLES_NV 0x30E1
+#define EGL_COVERAGE_BUFFERS_NV			0x30E0
+#define EGL_COVERAGE_SAMPLES_NV			0x30E1
 #endif
 
 #ifndef EGL_NV_depth_nonlinear
 #define EGL_NV_depth_nonlinear 1
-#define EGL_DEPTH_ENCODING_NV 0x30E2
+#define EGL_DEPTH_ENCODING_NV			0x30E2
 #define EGL_DEPTH_ENCODING_NONE_NV 0
-#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
+#define EGL_DEPTH_ENCODING_NONLINEAR_NV		0x30E3
 #endif
 
 #if KHRONOS_SUPPORT_INT64   /* EGLTimeNV requires 64-bit uint support */
 #ifndef EGL_NV_sync
 #define EGL_NV_sync 1
 #define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV	0x30E6
 #define EGL_SYNC_STATUS_NV			0x30E7
 #define EGL_SIGNALED_NV				0x30E8
@@ -296,53 +296,53 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLP
 #ifndef EGL_ANGLE_query_surface_pointer
 #define EGL_ANGLE_query_surface_pointer 1
 #ifdef EGL_EGLEXT_PROTOTYPES
 EGLAPI EGLBoolean eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
 #endif
 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
 #endif
 
+#ifndef EGL_ANGLE_software_display
+#define EGL_ANGLE_software_display 1
+#define EGL_SOFTWARE_DISPLAY_ANGLE ((EGLNativeDisplayType)-1)
+#endif
+
 #ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
 #define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
 #define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE	0x3200
 #endif
 
-#ifndef EGL_ANGLE_software_display
-#define EGL_ANGLE_software_display 1
-#define EGL_SOFTWARE_DISPLAY_ANGLE ((EGLNativeDisplayType)-1)
-#endif
-
 #ifndef EGL_NV_coverage_sample_resolve
 #define EGL_NV_coverage_sample_resolve 1
 #define EGL_COVERAGE_SAMPLE_RESOLVE_NV		0x3131
 #define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV	0x3132
 #define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV	0x3133
 #endif
 
-#ifndef EGL_EXT_create_context_robustness
-#define EGL_EXT_create_context_robustness 1
-#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT                0x30BF
-#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT  0x3138
-#define EGL_NO_RESET_NOTIFICATION_EXT                       0x31BE
-#define EGL_LOSE_CONTEXT_ON_RESET_EXT                       0x31BF
-#endif
-
 #if KHRONOS_SUPPORT_INT64   /* EGLTimeKHR requires 64-bit uint support */
 #ifndef EGL_NV_system_time
 #define EGL_NV_system_time 1
 
 typedef khronos_utime_nanoseconds_t EGLuint64NV;
 
 #ifdef EGL_EGLEXT_PROTOTYPES
 EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV(void);
 EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV(void);
 #endif /* EGL_EGLEXT_PROTOTYPES */
 typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
 typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
 #endif
 #endif
 
+#ifndef EGL_EXT_create_context_robustness
+#define EGL_EXT_create_context_robustness 1
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT	0x30BF
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
+#define EGL_NO_RESET_NOTIFICATION_EXT		0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET_EXT		0x31BF
+#endif
+
 #ifdef __cplusplus
 }
 #endif
 
 #endif
--- a/gfx/angle/include/GLES2/gl2ext.h
+++ b/gfx/angle/include/GLES2/gl2ext.h
@@ -1,12 +1,12 @@
 #ifndef __gl2ext_h_
 #define __gl2ext_h_
 
-/* $Revision: 15049 $ on $Date:: 2011-07-06 17:28:16 -0700 #$ */
+/* $Revision: 16482 $ on $Date:: 2012-01-04 13:44:55 -0500 #$ */
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /*
  * This document is licensed under the SGI Free Software B License Version
  * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
@@ -282,101 +282,171 @@ typedef void* GLeglImageOES;
  *------------------------------------------------------------------------*/
 
 /* GL_EXT_blend_minmax */
 #ifndef GL_EXT_blend_minmax
 #define GL_MIN_EXT                                              0x8007
 #define GL_MAX_EXT                                              0x8008
 #endif
 
+/* GL_EXT_color_buffer_half_float */
+#ifndef GL_EXT_color_buffer_half_float
+#define GL_RGBA16F_EXT                                          0x881A
+#define GL_RGB16F_EXT                                           0x881B
+#define GL_RG16F_EXT                                            0x822F
+#define GL_R16F_EXT                                             0x822D
+#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT            0x8211
+#define GL_UNSIGNED_NORMALIZED_EXT                              0x8C17
+#endif
+
+/* GL_EXT_debug_label */
+#ifndef GL_EXT_debug_label
+#define GL_PROGRAM_PIPELINE_OBJECT_EXT                          0x8A4F
+#define GL_PROGRAM_OBJECT_EXT                                   0x8B40
+#define GL_SHADER_OBJECT_EXT                                    0x8B48
+#define GL_BUFFER_OBJECT_EXT                                    0x9151
+#define GL_QUERY_OBJECT_EXT                                     0x9153
+#define GL_VERTEX_ARRAY_OBJECT_EXT                              0x9154
+#endif
+
+/* GL_EXT_debug_marker */
+/* No new tokens introduced by this extension. */
+
 /* GL_EXT_discard_framebuffer */
 #ifndef GL_EXT_discard_framebuffer
 #define GL_COLOR_EXT                                            0x1800
 #define GL_DEPTH_EXT                                            0x1801
 #define GL_STENCIL_EXT                                          0x1802
 #endif
 
+/* GL_EXT_multisampled_render_to_texture */
+#ifndef GL_EXT_multisampled_render_to_texture
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT           0x8D6C
+#define GL_RENDERBUFFER_SAMPLES_EXT                             0x9133
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT               0x9134
+#define GL_MAX_SAMPLES_EXT                                      0x9135
+#endif
+
 /* GL_EXT_multi_draw_arrays */
 /* No new tokens introduced by this extension. */
 
+/* GL_EXT_occlusion_query_boolean */
+#ifndef GL_EXT_occlusion_query_boolean
+#define GL_ANY_SAMPLES_PASSED_EXT                               0x8C2F
+#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT                  0x8D6A
+#define GL_CURRENT_QUERY_EXT                                    0x8865
+#define GL_QUERY_RESULT_EXT                                     0x8866
+#define GL_QUERY_RESULT_AVAILABLE_EXT                           0x8867
+#endif
+
 /* GL_EXT_read_format_bgra */
 #ifndef GL_EXT_read_format_bgra
 #define GL_BGRA_EXT                                             0x80E1
 #define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT                       0x8365
 #define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT                       0x8366
 #endif
 
+/* GL_EXT_robustness */
+#ifndef GL_EXT_robustness
+/* reuse GL_NO_ERROR */
+#define GL_GUILTY_CONTEXT_RESET_EXT                             0x8253
+#define GL_INNOCENT_CONTEXT_RESET_EXT                           0x8254
+#define GL_UNKNOWN_CONTEXT_RESET_EXT                            0x8255
+#define GL_CONTEXT_ROBUST_ACCESS_EXT                            0x90F3
+#define GL_RESET_NOTIFICATION_STRATEGY_EXT                      0x8256
+#define GL_LOSE_CONTEXT_ON_RESET_EXT                            0x8252
+#define GL_NO_RESET_NOTIFICATION_EXT                            0x8261
+#endif
+
+/* GL_EXT_separate_shader_objects */
+#ifndef GL_EXT_separate_shader_objects
+#define GL_VERTEX_SHADER_BIT_EXT                                0x00000001
+#define GL_FRAGMENT_SHADER_BIT_EXT                              0x00000002
+#define GL_ALL_SHADER_BITS_EXT                                  0xFFFFFFFF
+#define GL_PROGRAM_SEPARABLE_EXT                                0x8258
+#define GL_ACTIVE_PROGRAM_EXT                                   0x8259
+#define GL_PROGRAM_PIPELINE_BINDING_EXT                         0x825A
+#endif
+
 /* GL_EXT_shader_texture_lod */
 /* No new tokens introduced by this extension. */
 
+/* GL_EXT_shadow_samplers */
+#ifndef GL_EXT_shadow_samplers
+#define GL_TEXTURE_COMPARE_MODE_EXT                             0x884C
+#define GL_TEXTURE_COMPARE_FUNC_EXT                             0x884D
+#define GL_COMPARE_REF_TO_TEXTURE_EXT                           0x884E
+#endif
+
+/* GL_EXT_sRGB */
+#ifndef GL_EXT_sRGB
+#define GL_SRGB_EXT                                             0x8C40
+#define GL_SRGB_ALPHA_EXT                                       0x8C42
+#define GL_SRGB8_ALPHA8_EXT                                     0x8C43
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT            0x8210
+#endif
+
+/* GL_EXT_texture_compression_dxt1 */
+#ifndef GL_EXT_texture_compression_dxt1
+#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT                         0x83F0
+#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT                        0x83F1
+#endif
+
 /* GL_EXT_texture_filter_anisotropic */
 #ifndef GL_EXT_texture_filter_anisotropic
 #define GL_TEXTURE_MAX_ANISOTROPY_EXT                           0x84FE
 #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT                       0x84FF
 #endif
 
 /* GL_EXT_texture_format_BGRA8888 */
 #ifndef GL_EXT_texture_format_BGRA8888
 #define GL_BGRA_EXT                                             0x80E1
 #endif
 
+/* GL_EXT_texture_rg */
+#ifndef GL_EXT_texture_rg
+#define GL_RED_EXT                                              0x1903
+#define GL_RG_EXT                                               0x8227
+#define GL_R8_EXT                                               0x8229
+#define GL_RG8_EXT                                              0x822B
+#endif
+
+/* GL_EXT_texture_storage */
+#ifndef GL_EXT_texture_storage
+#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT                         0x912F
+#define GL_ALPHA8_EXT                                           0x803C  
+#define GL_LUMINANCE8_EXT                                       0x8040
+#define GL_LUMINANCE8_ALPHA8_EXT                                0x8045
+#define GL_RGBA32F_EXT                                          0x8814  
+#define GL_RGB32F_EXT                                           0x8815
+#define GL_ALPHA32F_EXT                                         0x8816
+#define GL_LUMINANCE32F_EXT                                     0x8818
+#define GL_LUMINANCE_ALPHA32F_EXT                               0x8819
+/* reuse GL_RGBA16F_EXT */
+#define GL_RGB16F_EXT                                           0x881B
+#define GL_ALPHA16F_EXT                                         0x881C
+#define GL_LUMINANCE16F_EXT                                     0x881E
+#define GL_LUMINANCE_ALPHA16F_EXT                               0x881F
+#define GL_RGB10_A2_EXT                                         0x8059  
+#define GL_RGB10_EXT                                            0x8052
+#define GL_BGRA8_EXT                                            0x93A1
+#endif
+
 /* GL_EXT_texture_type_2_10_10_10_REV */
 #ifndef GL_EXT_texture_type_2_10_10_10_REV
 #define GL_UNSIGNED_INT_2_10_10_10_REV_EXT                      0x8368
 #endif
 
-/* GL_EXT_texture_compression_dxt1 */
-#ifndef GL_EXT_texture_compression_dxt1
-#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT                         0x83F0
-#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT                        0x83F1
-#endif
-
 /* GL_EXT_unpack_subimage */
 #ifndef GL_EXT_unpack_subimage
 #define GL_UNPACK_ROW_LENGTH                                    0x0CF2
 #define GL_UNPACK_SKIP_ROWS                                     0x0CF3
 #define GL_UNPACK_SKIP_PIXELS                                   0x0CF4
 #endif
 
-/* GL_EXT_robustness */
-#ifndef GL_EXT_robustness
-#define GL_GUILTY_CONTEXT_RESET_EXT                             0x8253
-#define GL_INNOCENT_CONTEXT_RESET_EXT                           0x8254
-#define GL_UNKNOWN_CONTEXT_RESET_EXT                            0x8255
-#define GL_CONTEXT_ROBUST_ACCESS_EXT                            0x90F3
-#define GL_RESET_NOTIFICATION_STRATEGY_EXT                      0x8256
-#define GL_LOSE_CONTEXT_ON_RESET_EXT                            0x8252
-#define GL_NO_RESET_NOTIFICATION_EXT                            0x8261
-#endif
-
-/* GL_EXT_texture_storage */
-#ifndef GL_EXT_texture_storage
-#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT                         0x912F
-#define GL_ALPHA8_EXT                                           0x803C
-#define GL_LUMINANCE8_EXT                                       0x8040
-#define GL_LUMINANCE8_ALPHA8_EXT                                0x8045
-/* OES_texture_float dependent internal formats */
-#define GL_RGBA32F_EXT                                          0x8814  /* reuse tokens from ARB_texture_float */
-#define GL_RGB32F_EXT                                           0x8815
-#define GL_ALPHA32F_EXT                                         0x8816
-#define GL_LUMINANCE32F_EXT                                     0x8818
-#define GL_LUMINANCE_ALPHA32F_EXT                               0x8819
-/* OES_texture_half_float dependent internal formats */
-#define GL_RGBA16F_EXT                                          0x881A /* reuse tokens from ARB_texture_float */
-#define GL_RGB16F_EXT                                           0x881B
-#define GL_ALPHA16F_EXT                                         0x881C
-#define GL_LUMINANCE16F_EXT                                     0x881E
-#define GL_LUMINANCE_ALPHA16F_EXT                               0x881F
-/* EXT_texture_type_2_10_10_10_REV dependent internal formats */
-#define GL_RGB10_A2_EXT                                         0x8059  /* reuse tokens from EXT_texture */
-#define GL_RGB10_EXT                                            0x8052
-/* EXT_texture_format_BGRA8888 dependent internal formats */
-#define GL_BGRA8_EXT                                            0x93A1
-#endif
-
 /*------------------------------------------------------------------------*
  * DMP extension tokens
  *------------------------------------------------------------------------*/
 
 /* GL_DMP_shader_binary */
 #ifndef GL_DMP_shader_binary
 #define GL_SHADER_BINARY_DMP                                    0x9250
 #endif
@@ -929,92 +999,245 @@ typedef void (GL_APIENTRYP PFNGLRESOLVEM
  * EXT extension functions
  *------------------------------------------------------------------------*/
 
 /* GL_EXT_blend_minmax */
 #ifndef GL_EXT_blend_minmax
 #define GL_EXT_blend_minmax 1
 #endif
 
+/* GL_EXT_color_buffer_half_float */
+#ifndef GL_EXT_color_buffer_half_float
+#define GL_EXT_color_buffer_half_float 1
+#endif
+
+/* GL_EXT_debug_label */
+#ifndef GL_EXT_debug_label
+#define GL_EXT_debug_label 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
+#endif
+typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
+#endif
+
+/* GL_EXT_debug_marker */
+#ifndef GL_EXT_debug_marker
+#define GL_EXT_debug_marker 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker);
+GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker);
+GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void);
+#endif
+typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
+typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
+typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
+#endif
+
 /* GL_EXT_discard_framebuffer */
 #ifndef GL_EXT_discard_framebuffer
 #define GL_EXT_discard_framebuffer 1
 #ifdef GL_GLEXT_PROTOTYPES
 GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
 #endif
 typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
 #endif
 
+/* GL_EXT_multisampled_render_to_texture */
+#ifndef GL_EXT_multisampled_render_to_texture
+#define GL_EXT_multisampled_render_to_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
+#endif
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#endif
+
 #ifndef GL_EXT_multi_draw_arrays
 #define GL_EXT_multi_draw_arrays 1
 #ifdef GL_GLEXT_PROTOTYPES
 GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei);
 GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei);
 #endif /* GL_GLEXT_PROTOTYPES */
 typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
 typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
 #endif
 
+/* GL_EXT_occlusion_query_boolean */
+#ifndef GL_EXT_occlusion_query_boolean
+#define GL_EXT_occlusion_query_boolean 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids);
+GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids);
+GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id);
+GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target);
+GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params);
+#endif
+typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids);
+typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids);
+typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id);
+typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id);
+typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params);
+#endif
+
 /* GL_EXT_read_format_bgra */
 #ifndef GL_EXT_read_format_bgra
 #define GL_EXT_read_format_bgra 1
 #endif
 
+/* GL_EXT_robustness */
+#ifndef GL_EXT_robustness
+#define GL_EXT_robustness 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
+GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, float *params);
+GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+#endif
+typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
+typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, float *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+#endif
+
+/* GL_EXT_separate_shader_objects */
+#ifndef GL_EXT_separate_shader_objects
+#define GL_EXT_separate_shader_objects 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program);
+GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program);
+GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings);
+GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines);
+GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines);
+GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint x);
+GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint x, GLint y);
+GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z);
+GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w);
+GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat x);
+GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+#endif
+typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
+typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program);
+typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings);
+typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines);
+typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines);
+typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint x);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint x, GLint y);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat x);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+#endif
+
 /* GL_EXT_shader_texture_lod */
 #ifndef GL_EXT_shader_texture_lod
 #define GL_EXT_shader_texture_lod 1
 #endif
 
+/* GL_EXT_shadow_samplers */
+#ifndef GL_EXT_shadow_samplers
+#define GL_EXT_shadow_samplers 1
+#endif
+
+/* GL_EXT_sRGB */
+#ifndef GL_EXT_sRGB
+#define GL_EXT_sRGB 1
+#endif
+
+/* GL_EXT_texture_compression_dxt1 */
+#ifndef GL_EXT_texture_compression_dxt1
+#define GL_EXT_texture_compression_dxt1 1
+#endif
+
 /* GL_EXT_texture_filter_anisotropic */
 #ifndef GL_EXT_texture_filter_anisotropic
 #define GL_EXT_texture_filter_anisotropic 1
 #endif
 
 /* GL_EXT_texture_format_BGRA8888 */
 #ifndef GL_EXT_texture_format_BGRA8888
 #define GL_EXT_texture_format_BGRA8888 1
 #endif
 
-/* GL_EXT_texture_type_2_10_10_10_REV */
-#ifndef GL_EXT_texture_type_2_10_10_10_REV
-#define GL_EXT_texture_type_2_10_10_10_REV 1
-#endif
-
-/* GL_EXT_texture_compression_dxt1 */
-#ifndef GL_EXT_texture_compression_dxt1
-#define GL_EXT_texture_compression_dxt1 1
-#endif
-
-/* GL_EXT_unpack_subimage */
-#ifndef GL_EXT_unpack_subimage
-#define GL_EXT_unpack_subimage 1
-#endif
-
-/* GL_EXT_robustness */
-#ifndef GL_EXT_robustness
-#define GL_EXT_robustness 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
-GL_APICALL void   GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data);
-GL_APICALL void   GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
-GL_APICALL void   GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
-typedef void   (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data);
-typedef void   (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
-typedef void   (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+/* GL_EXT_texture_rg */
+#ifndef GL_EXT_texture_rg
+#define GL_EXT_texture_rg 1
 #endif
 
 /* GL_EXT_texture_storage */
 #ifndef GL_EXT_texture_storage
 #define GL_EXT_texture_storage 1
 #ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY TexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXT) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#endif
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#endif
+
+/* GL_EXT_texture_type_2_10_10_10_REV */
+#ifndef GL_EXT_texture_type_2_10_10_10_REV
+#define GL_EXT_texture_type_2_10_10_10_REV 1
+#endif
+
+/* GL_EXT_unpack_subimage */
+#ifndef GL_EXT_unpack_subimage
+#define GL_EXT_unpack_subimage 1
 #endif
 
 /*------------------------------------------------------------------------*
  * DMP extension functions
  *------------------------------------------------------------------------*/
 
 /* GL_DMP_shader_binary */
 #ifndef GL_DMP_shader_binary
deleted file mode 100644
--- a/gfx/angle/include/GLSLANG/ShaderLang.h
+++ b/gfx/angle/include/GLSLANG/ShaderLang.h
@@ -72,17 +72,18 @@ typedef enum {
   SH_BOOL_VEC2      = 0x8B57,
   SH_BOOL_VEC3      = 0x8B58,
   SH_BOOL_VEC4      = 0x8B59,
   SH_FLOAT_MAT2     = 0x8B5A,
   SH_FLOAT_MAT3     = 0x8B5B,
   SH_FLOAT_MAT4     = 0x8B5C,
   SH_SAMPLER_2D     = 0x8B5E,
   SH_SAMPLER_CUBE   = 0x8B60,
-  SH_SAMPLER_2D_RECT_ARB = 0x8B63
+  SH_SAMPLER_2D_RECT_ARB = 0x8B63,
+  SH_SAMPLER_EXTERNAL_OES = 0x8D66
 } ShDataType;
 
 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,
--- a/gfx/angle/samples/gles2_book/Common/esUtil.c
+++ b/gfx/angle/samples/gles2_book/Common/esUtil.c
@@ -26,18 +26,30 @@
 #include "esUtil.h"
 #include "esUtil_win.h"
 
 
 ///
 //  Extensions
 //
 
+PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
+PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
+
 PFNEGLPOSTSUBBUFFERNVPROC eglPostSubBufferNV;
 
+PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
+
+PFNGLDELETEFENCESNVPROC glDeleteFencesNV;
+PFNGLGENFENCESNVPROC glGenFencesNV;
+PFNGLGETFENCEIVNVPROC glGetFenceivNV;
+PFNGLISFENCENVPROC glIsFenceNV;
+PFNGLFINISHFENCENVPROC glFinishFenceNV;
+PFNGLSETFENCENVPROC glSetFenceNV;
+PFNGLTESTFENCENVPROC glTestFenceNV;
 
 ///
 // CreateEGLContext()
 //
 //    Creates an EGL rendering context and all associated elements
 //
 EGLBoolean CreateEGLContext ( EGLNativeWindowType hWnd, EGLDisplay* eglDisplay,
                               EGLContext* eglContext, EGLSurface* eglSurface,
@@ -61,18 +73,31 @@ EGLBoolean CreateEGLContext ( EGLNativeW
 
    // Initialize EGL
    if ( !eglInitialize(display, &majorVersion, &minorVersion) )
    {
       return EGL_FALSE;
    }
 
    // Bind to extensions
+   eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC) eglGetProcAddress("eglCreateImageKHR");
+   eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC) eglGetProcAddress("eglDestroyImageKHR");
+   
    eglPostSubBufferNV = (PFNEGLPOSTSUBBUFFERNVPROC) eglGetProcAddress("eglPostSubBufferNV");
 
+   glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) eglGetProcAddress("glEGLImageTargetTexture2DOES");
+   
+   glDeleteFencesNV = (PFNGLDELETEFENCESNVPROC) eglGetProcAddress("glDeleteFencesNV");
+   glGenFencesNV = (PFNGLGENFENCESNVPROC) eglGetProcAddress("glGenFencesNV");
+   glGetFenceivNV = (PFNGLGETFENCEIVNVPROC) eglGetProcAddress("glGetFenceivNV");
+   glIsFenceNV = (PFNGLISFENCENVPROC) eglGetProcAddress("glIsFenceNV");
+   glFinishFenceNV = (PFNGLFINISHFENCENVPROC) eglGetProcAddress("glFinishFenceNV");
+   glSetFenceNV = (PFNGLSETFENCENVPROC) eglGetProcAddress("glSetFenceNV");
+   glTestFenceNV = (PFNGLTESTFENCENVPROC) eglGetProcAddress("glTestFenceNV");
+
    // Get configs
    if ( !eglGetConfigs(display, NULL, 0, &numConfigs) )
    {
       return EGL_FALSE;
    }
 
    // Choose config
    if ( !eglChooseConfig(display, configAttribList, &config, 1, &numConfigs) )
--- a/gfx/angle/samples/gles2_book/Common/esUtil.h
+++ b/gfx/angle/samples/gles2_book/Common/esUtil.h
@@ -16,16 +16,17 @@
 //
 #ifndef ESUTIL_H
 #define ESUTIL_H
 
 ///
 //  Includes
 //
 #include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
 #include <EGL/egl.h>
 #include <EGL/eglext.h>
 
 #ifdef __cplusplus
 
 extern "C" {
 #endif
 
@@ -88,18 +89,30 @@ typedef struct
    void (ESCALLBACK *updateFunc) ( void*, float deltaTime );
 } ESContext;
 
 
 ///
 //  Extensions
 //
 
+extern PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
+extern PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
+
 extern PFNEGLPOSTSUBBUFFERNVPROC eglPostSubBufferNV;
 
+extern PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
+
+extern PFNGLDELETEFENCESNVPROC glDeleteFencesNV;
+extern PFNGLGENFENCESNVPROC glGenFencesNV;
+extern PFNGLGETFENCEIVNVPROC glGetFenceivNV;
+extern PFNGLISFENCENVPROC glIsFenceNV;
+extern PFNGLFINISHFENCENVPROC glFinishFenceNV;
+extern PFNGLSETFENCENVPROC glSetFenceNV;
+extern PFNGLTESTFENCENVPROC glTestFenceNV;
 
 ///
 //  Public Functions
 //
 
 //
 ///
 /// \brief Initialize ES framework context.  This must be called before calling any other functions.
--- a/gfx/angle/samples/translator/translator.cpp
+++ b/gfx/angle/samples/translator/translator.cpp
@@ -296,16 +296,17 @@ void PrintActiveVariables(ShHandle compi
             case SH_BOOL_VEC2: typeName = "GL_BOOL_VEC2"; break;
             case SH_BOOL_VEC3: typeName = "GL_BOOL_VEC3"; break;
             case SH_BOOL_VEC4: typeName = "GL_BOOL_VEC4"; break;
             case SH_FLOAT_MAT2: typeName = "GL_FLOAT_MAT2"; break;
             case SH_FLOAT_MAT3: typeName = "GL_FLOAT_MAT3"; break;
             case SH_FLOAT_MAT4: typeName = "GL_FLOAT_MAT4"; break;
             case SH_SAMPLER_2D: typeName = "GL_SAMPLER_2D"; break;
             case SH_SAMPLER_CUBE: typeName = "GL_SAMPLER_CUBE"; break;
+            case SH_SAMPLER_EXTERNAL_OES: typeName = "GL_SAMPLER_EXTERNAL_OES"; break;
             default: assert(0);
         }
         printf("%d: name:%s type:%s size:%d", i, name, typeName, size);
         if (mapLongVariableNames)
             printf(" mapped name:%s", mappedName);
         printf("\n");
     }
     delete [] name;
--- a/gfx/angle/src/build_angle.gyp
+++ b/gfx/angle/src/build_angle.gyp
@@ -1,13 +1,16 @@
 # Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 {
+  'variables': {
+    'chromium_code': 1,
+  },
   'target_defaults': {
     'defines': [
       'ANGLE_DISABLE_TRACE',
       'ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0',
     ],
   },
   'targets': [
     {
@@ -164,16 +167,18 @@
             '.',
             '../include',
             '$(DXSDK_DIR)/include',
           ],
           'sources': [
             'common/angleutils.h',
             'common/debug.cpp',
             'common/debug.h',
+            'common/RefCountObject.cpp',
+            'common/RefCountObject.h',
             'common/version.h',
             'libGLESv2/IndexDataManager.cpp',
             'libGLESv2/IndexDataManager.h',
             'libGLESv2/vertexconversion.h',
             'libGLESv2/VertexDataManager.cpp',
             'libGLESv2/VertexDataManager.h',
             'libGLESv2/Blit.cpp',
             'libGLESv2/Blit.h',
@@ -190,18 +195,18 @@
             'libGLESv2/libGLESv2.cpp',
             'libGLESv2/libGLESv2.def',
             'libGLESv2/libGLESv2.rc',
             'libGLESv2/main.cpp',
             'libGLESv2/main.h',
             'libGLESv2/mathutil.h',
             'libGLESv2/Program.cpp',
             'libGLESv2/Program.h',
-            'libGLESv2/RefCountObject.cpp',
-            'libGLESv2/RefCountObject.h',
+            'libGLESv2/Query.h',
+            'libGLESv2/Query.cpp',
             'libGLESv2/Renderbuffer.cpp',
             'libGLESv2/Renderbuffer.h',
             'libGLESv2/ResourceManager.cpp',
             'libGLESv2/ResourceManager.h',
             'libGLESv2/Shader.cpp',
             'libGLESv2/Shader.h',
             'libGLESv2/Texture.cpp',
             'libGLESv2/Texture.h',
@@ -226,16 +231,18 @@
           'include_dirs': [
             '.',
             '../include',
           ],
           'sources': [
             'common/angleutils.h',
             'common/debug.cpp',
             'common/debug.h',
+            'common/RefCountObject.cpp',
+            'common/RefCountObject.h',
             'common/version.h',
             'libEGL/Config.cpp',
             'libEGL/Config.h',
             'libEGL/Display.cpp',
             'libEGL/Display.h',
             'libEGL/libEGL.cpp',
             'libEGL/libEGL.def',
             'libEGL/libEGL.rc',
new file mode 100644
--- /dev/null
+++ b/gfx/angle/src/common/RefCountObject.cpp
@@ -0,0 +1,47 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RefCountObject.cpp: Defines the gl::RefCountObject base class that provides
+// lifecycle support for GL objects using the traditional BindObject scheme, but
+// that need to be reference counted for correct cross-context deletion.
+// (Concretely, textures, buffers and renderbuffers.)
+
+#include "RefCountObject.h"
+
+RefCountObject::RefCountObject(GLuint id)
+{
+    mId = id;
+    mRefCount = 0;
+}
+
+RefCountObject::~RefCountObject()
+{
+    ASSERT(mRefCount == 0);
+}
+
+void RefCountObject::addRef() const
+{
+    mRefCount++;
+}
+
+void RefCountObject::release() const
+{
+    ASSERT(mRefCount > 0);
+
+    if (--mRefCount == 0)
+    {
+        delete this;
+    }
+}
+
+void RefCountObjectBindingPointer::set(RefCountObject *newObject)
+{
+    // addRef first in case newObject == mObject and this is the last reference to it.
+    if (newObject != NULL) newObject->addRef();
+    if (mObject != NULL) mObject->release();
+
+    mObject = newObject;
+}
new file mode 100644
--- /dev/null
+++ b/gfx/angle/src/common/RefCountObject.h
@@ -0,0 +1,65 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RefCountObject.h: Defines the gl::RefCountObject base class that provides
+// lifecycle support for GL objects using the traditional BindObject scheme, but
+// that need to be reference counted for correct cross-context deletion.
+// (Concretely, textures, buffers and renderbuffers.)
+
+#ifndef COMMON_REFCOUNTOBJECT_H_
+#define COMMON_REFCOUNTOBJECT_H_
+
+#include <cstddef>
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
+
+#include "common/debug.h"
+
+class RefCountObject
+{
+  public:
+    explicit RefCountObject(GLuint id);
+    virtual ~RefCountObject();
+
+    virtual void addRef() const;
+    virtual void release() const;
+
+    GLuint id() const { return mId; }
+    
+  private:
+    GLuint mId;
+
+    mutable std::size_t mRefCount;
+};
+
+class RefCountObjectBindingPointer
+{
+  protected:
+    RefCountObjectBindingPointer() : mObject(NULL) { }
+    ~RefCountObjectBindingPointer() { ASSERT(mObject == NULL); } // Objects have to be released before the resource manager is destroyed, so they must be explicitly cleaned up.
+
+    void set(RefCountObject *newObject);
+    RefCountObject *get() const { return mObject; }
+
+  public:
+    GLuint id() const { return (mObject != NULL) ? mObject->id() : 0; }
+    bool operator ! () const { return (get() == NULL); }
+
+  private:
+    RefCountObject *mObject;
+};
+
+template <class ObjectType>
+class BindingPointer : public RefCountObjectBindingPointer
+{
+  public:
+    void set(ObjectType *newObject) { RefCountObjectBindingPointer::set(newObject); }
+    ObjectType *get() const { return static_cast<ObjectType*>(RefCountObjectBindingPointer::get()); }
+    ObjectType *operator -> () const { return get(); }
+};
+
+#endif   // COMMON_REFCOUNTOBJECT_H_
--- a/gfx/angle/src/common/debug.cpp
+++ b/gfx/angle/src/common/debug.cpp
@@ -18,25 +18,25 @@ namespace gl
 
 typedef void (WINAPI *PerfOutputFunction)(D3DCOLOR, LPCWSTR);
 
 static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const char *format, va_list vararg)
 {
 #if !defined(ANGLE_DISABLE_PERF)
     if (perfActive())
     {
-        char message[4096];
+        char message[32768];
         int len = vsprintf_s(message, format, vararg);
         if (len < 0)
         {
             return;
         }
 
         // There are no ASCII variants of these D3DPERF functions.
-        wchar_t wideMessage[4096];
+        wchar_t wideMessage[32768];
         for (int i = 0; i < len; ++i)
         {
             wideMessage[i] = message[i];
         }
         wideMessage[len] = 0;
 
         perfFunc(0, wideMessage);
     }
--- a/gfx/angle/src/common/version.h
+++ b/gfx/angle/src/common/version.h
@@ -1,10 +1,10 @@
 #define MAJOR_VERSION 1
 #define MINOR_VERSION 0
 #define BUILD_VERSION 0
-#define BUILD_REVISION 930
+#define BUILD_REVISION 963
 
 #define STRINGIFY(x) #x
 #define MACRO_STRINGIFY(x) STRINGIFY(x)
 
 #define REVISION_STRING MACRO_STRINGIFY(BUILD_REVISION)
 #define VERSION_STRING MACRO_STRINGIFY(MAJOR_VERSION) "." MACRO_STRINGIFY(MINOR_VERSION) "." MACRO_STRINGIFY(BUILD_VERSION) "." MACRO_STRINGIFY(BUILD_REVISION)
--- a/gfx/angle/src/compiler/Compiler.cpp
+++ b/gfx/angle/src/compiler/Compiler.cpp
@@ -1,22 +1,22 @@
 //
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
 
 #include "compiler/BuiltInFunctionEmulator.h"
 #include "compiler/DetectRecursion.h"
 #include "compiler/ForLoopUnroll.h"
 #include "compiler/Initialize.h"
+#include "compiler/MapLongVariableNames.h"
 #include "compiler/ParseHelper.h"
 #include "compiler/ShHandle.h"
 #include "compiler/ValidateLimitations.h"
-#include "compiler/MapLongVariableNames.h"
 
 namespace {
 bool InitializeSymbolTable(
     const TBuiltInStrings& builtInStrings,
     ShShaderType type, ShShaderSpec spec, const ShBuiltInResources& resources,
     TInfoSink& infoSink, TSymbolTable& symbolTable)
 {
     TIntermediate intermediate(infoSink);
@@ -86,20 +86,23 @@ TShHandleBase::~TShHandleBase() {
     allocator.popAll();
 }
 
 TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec)
     : shaderType(type),
       shaderSpec(spec),
       builtInFunctionEmulator(type)
 {
+    longNameMap = LongNameMap::GetInstance();
 }
 
 TCompiler::~TCompiler()
 {
+    ASSERT(longNameMap);
+    longNameMap->Release();
 }
 
 bool TCompiler::Init(const ShBuiltInResources& resources)
 {
     TScopedPoolAllocator scopedAlloc(&allocator, false);
 
     // Generate built-in symbol table.
     if (!InitBuiltInSymbolTable(resources))
@@ -241,17 +244,18 @@ bool TCompiler::validateLimitations(TInt
 void TCompiler::collectAttribsUniforms(TIntermNode* root)
 {
     CollectAttribsUniforms collect(attribs, uniforms);
     root->traverse(&collect);
 }
 
 void TCompiler::mapLongVariableNames(TIntermNode* root)
 {
-    MapLongVariableNames map(varyingLongNameMap);
+    ASSERT(longNameMap);
+    MapLongVariableNames map(longNameMap);
     root->traverse(&map);
 }
 
 int TCompiler::getMappedNameMaxLength() const
 {
     return MAX_SHORTENED_IDENTIFIER_SIZE + 1;
 }
 
--- a/gfx/angle/src/compiler/DetectRecursion.cpp
+++ b/gfx/angle/src/compiler/DetectRecursion.cpp
@@ -55,17 +55,17 @@ bool DetectRecursion::FunctionNode::dete
 
 DetectRecursion::DetectRecursion()
     : currentFunction(NULL)
 {
 }
 
 DetectRecursion::~DetectRecursion()
 {
-    for (int i = 0; i < functions.size(); ++i)
+    for (size_t i = 0; i < functions.size(); ++i)
         delete functions[i];
 }
 
 bool DetectRecursion::visitAggregate(Visit visit, TIntermAggregate* node)
 {
     switch (node->getOp())
     {
         case EOpPrototype:
deleted file mode 100644
--- a/gfx/angle/src/compiler/MapLongVariableNames.cpp
+++ b/gfx/angle/src/compiler/MapLongVariableNames.cpp
@@ -1,69 +1,120 @@
 //
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
 
 #include "compiler/MapLongVariableNames.h"
 
 namespace {
 
-TString mapLongName(int id, const TString& name, bool isVarying)
+TString mapLongName(int id, const TString& name, bool isGlobal)
 {
     ASSERT(name.size() > MAX_SHORTENED_IDENTIFIER_SIZE);
     TStringStream stream;
     stream << "webgl_";
-    if (isVarying)
-        stream << "v";
+    if (isGlobal)
+        stream << "g";
     stream << id << "_";
     stream << name.substr(0, MAX_SHORTENED_IDENTIFIER_SIZE - stream.str().size());
     return stream.str();
 }
 
+LongNameMap* gLongNameMapInstance = NULL;
+
 }  // anonymous namespace
 
-MapLongVariableNames::MapLongVariableNames(
-    std::map<std::string, std::string>& varyingLongNameMap)
-    : mVaryingLongNameMap(varyingLongNameMap)
+LongNameMap::LongNameMap()
+    : refCount(0)
+{
+}
+
+LongNameMap::~LongNameMap()
+{
+}
+
+// static
+LongNameMap* LongNameMap::GetInstance()
+{
+    if (gLongNameMapInstance == NULL)
+        gLongNameMapInstance = new LongNameMap;
+    gLongNameMapInstance->refCount++;
+    return gLongNameMapInstance;
+}
+
+void LongNameMap::Release()
 {
+    ASSERT(gLongNameMapInstance == this);
+    ASSERT(refCount > 0);
+    refCount--;
+    if (refCount == 0) {
+        delete gLongNameMapInstance;
+        gLongNameMapInstance = NULL;
+    }
+}
+
+const char* LongNameMap::Find(const char* originalName) const
+{
+    std::map<std::string, std::string>::const_iterator it = mLongNameMap.find(
+        originalName);
+    if (it != mLongNameMap.end())
+        return (*it).second.c_str();
+    return NULL;
+}
+
+void LongNameMap::Insert(const char* originalName, const char* mappedName)
+{
+    mLongNameMap.insert(std::map<std::string, std::string>::value_type(
+        originalName, mappedName));
+}
+
+int LongNameMap::Size() const
+{
+    return mLongNameMap.size();
+}
+
+MapLongVariableNames::MapLongVariableNames(LongNameMap* globalMap)
+{
+    ASSERT(globalMap);
+    mGlobalMap = globalMap;
 }
 
 void MapLongVariableNames::visitSymbol(TIntermSymbol* symbol)
 {
     ASSERT(symbol != NULL);
     if (symbol->getSymbol().size() > MAX_SHORTENED_IDENTIFIER_SIZE) {
         switch (symbol->getQualifier()) {
           case EvqVaryingIn:
           case EvqVaryingOut:
           case EvqInvariantVaryingIn:
           case EvqInvariantVaryingOut:
+          case EvqUniform:
             symbol->setSymbol(
-                mapVaryingLongName(symbol->getSymbol()));
+                mapGlobalLongName(symbol->getSymbol()));
             break;
           default:
             symbol->setSymbol(
                 mapLongName(symbol->getId(), symbol->getSymbol(), false));
             break;
         };
     }
 }
 
 bool MapLongVariableNames::visitLoop(Visit, TIntermLoop* node)
 {
     if (node->getInit())
         node->getInit()->traverse(this);
     return true;
 }
 
-TString MapLongVariableNames::mapVaryingLongName(const TString& name)
+TString MapLongVariableNames::mapGlobalLongName(const TString& name)
 {
-    std::map<std::string, std::string>::const_iterator it = mVaryingLongNameMap.find(name.c_str());
-    if (it != mVaryingLongNameMap.end())
-        return (*it).second.c_str();
-
-    int id = mVaryingLongNameMap.size();
-    TString mappedName = mapLongName(id, name, true);
-    mVaryingLongNameMap.insert(
-        std::map<std::string, std::string>::value_type(name.c_str(), mappedName.c_str()));
-    return mappedName;
+    ASSERT(mGlobalMap);
+    const char* mappedName = mGlobalMap->Find(name.c_str());
+    if (mappedName != NULL)
+        return mappedName;
+    int id = mGlobalMap->Size();
+    TString rt = mapLongName(id, name, true);
+    mGlobalMap->Insert(name.c_str(), rt.c_str());
+    return rt;
 }
--- a/gfx/angle/src/compiler/MapLongVariableNames.h
+++ b/gfx/angle/src/compiler/MapLongVariableNames.h
@@ -1,33 +1,59 @@
 //
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
 
 #ifndef COMPILER_MAP_LONG_VARIABLE_NAMES_H_
 #define COMPILER_MAP_LONG_VARIABLE_NAMES_H_
 
 #include "GLSLANG/ShaderLang.h"
 
 #include "compiler/intermediate.h"
 #include "compiler/VariableInfo.h"
 
 // This size does not include '\0' in the end.
 #define MAX_SHORTENED_IDENTIFIER_SIZE 32
 
+// This is a ref-counted singleton. GetInstance() returns a pointer to the
+// singleton, and after use, call Release(). GetInstance() and Release() should
+// be paired.
+class LongNameMap {
+public:
+    static LongNameMap* GetInstance();
+    void Release();
+
+    // Return the mapped name if <originalName, mappedName> is in the map;
+    // otherwise, return NULL.
+    const char* Find(const char* originalName) const;
+
+    // Insert a pair into the map.
+    void Insert(const char* originalName, const char* mappedName);
+
+    // Return the number of entries in the map.
+    int Size() const;
+
+private:
+    LongNameMap();
+    ~LongNameMap();
+
+    size_t refCount;
+    std::map<std::string, std::string> mLongNameMap;
+};
+
 // Traverses intermediate tree to map attributes and uniforms names that are
 // longer than MAX_SHORTENED_IDENTIFIER_SIZE to MAX_SHORTENED_IDENTIFIER_SIZE.
 class MapLongVariableNames : public TIntermTraverser {
 public:
-    MapLongVariableNames(std::map<std::string, std::string>& varyingLongNameMap);
+    MapLongVariableNames(LongNameMap* globalMap);
 
     virtual void visitSymbol(TIntermSymbol*);
     virtual bool visitLoop(Visit, TIntermLoop*);
 
 private:
-    TString mapVaryingLongName(const TString& name);
+    TString mapGlobalLongName(const TString& name);
 
-    std::map<std::string, std::string>& mVaryingLongNameMap;
+    LongNameMap* mGlobalMap;
 };
 
 #endif  // COMPILER_MAP_LONG_VARIABLE_NAMES_H_
deleted file mode 100644
--- a/gfx/angle/src/compiler/MozAngleLink.cpp
+++ /dev/null
@@ -1,4 +0,0 @@
-/* We already have a Link.cpp in content, and our link unpack step
- * ends up munging the two Link.o's as a result */
-
-#include "Link.cpp"
--- a/gfx/angle/src/compiler/OutputHLSL.cpp
+++ b/gfx/angle/src/compiler/OutputHLSL.cpp
@@ -134,17 +134,17 @@ void OutputHLSL::header()
                 const TVariable *variable = static_cast<const TVariable*>(symbol);
                 const TType &type = variable->getType();
                 TQualifier qualifier = type.getQualifier();
 
                 if (qualifier == EvqUniform)
                 {
                     if (mReferencedUniforms.find(name.c_str()) != mReferencedUniforms.end())
                     {
-                        uniforms += "uniform " + typeString(type) + " " + decorateUniform(name, type.isArray()) + arrayString(type) + ";\n";
+                        uniforms += "uniform " + typeString(type) + " " + decorateUniform(name, type) + arrayString(type) + ";\n";
                     }
                 }
                 else if (qualifier == EvqVaryingIn || qualifier == EvqInvariantVaryingIn)
                 {
                     if (mReferencedVaryings.find(name.c_str()) != mReferencedVaryings.end())
                     {
                         // Program linking depends on this exact format
                         varyings += "static " + typeString(type) + " " + decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
@@ -298,17 +298,17 @@ void OutputHLSL::header()
                 const TVariable *variable = static_cast<const TVariable*>(symbol);
                 const TType &type = variable->getType();
                 TQualifier qualifier = type.getQualifier();
 
                 if (qualifier == EvqUniform)
                 {
                     if (mReferencedUniforms.find(name.c_str()) != mReferencedUniforms.end())
                     {
-                        uniforms += "uniform " + typeString(type) + " " + decorateUniform(name, type.isArray()) + arrayString(type) + ";\n";
+                        uniforms += "uniform " + typeString(type) + " " + decorateUniform(name, type) + arrayString(type) + ";\n";
                     }
                 }
                 else if (qualifier == EvqAttribute)
                 {
                     if (mReferencedAttributes.find(name.c_str()) != mReferencedAttributes.end())
                     {
                         attributes += "static " + typeString(type) + " " + decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
                     }
@@ -754,17 +754,17 @@ void OutputHLSL::visitSymbol(TIntermSymb
     }
     else
     {
         TQualifier qualifier = node->getQualifier();
 
         if (qualifier == EvqUniform)
         {
             mReferencedUniforms.insert(name.c_str());
-            out << decorateUniform(name, node->isArray());
+            out << decorateUniform(name, node->getType());
         }
         else if (qualifier == EvqAttribute)
         {
             mReferencedAttributes.insert(name.c_str());
             out << decorate(name);
         }
         else if (qualifier == EvqVaryingOut || qualifier == EvqInvariantVaryingOut || qualifier == EvqVaryingIn || qualifier == EvqInvariantVaryingIn)
         {
@@ -2014,16 +2014,18 @@ TString OutputHLSL::typeString(const TTy
               case 4: return "bool4";
             }
           case EbtVoid:
             return "void";
           case EbtSampler2D:
             return "sampler2D";
           case EbtSamplerCube:
             return "samplerCUBE";
+          case EbtSamplerExternalOES:
+            return "sampler2D";
         }
     }
 
     UNIMPLEMENTED();   // FIXME
     return "<unknown type>";
 }
 
 TString OutputHLSL::arrayString(const TType &type)
@@ -2365,18 +2367,22 @@ TString OutputHLSL::decorate(const TStri
     if (string.compare(0, 3, "gl_") != 0 && string.compare(0, 3, "dx_") != 0)
     {
         return "_" + string;
     }
     
     return string;
 }
 
-TString OutputHLSL::decorateUniform(const TString &string, bool array)
+TString OutputHLSL::decorateUniform(const TString &string, const TType &type)
 {
-    if (array)
+    if (type.isArray())
     {
         return "ar_" + string;   // Allows identifying arrays of size 1
     }
+    else if (type.getBasicType() == EbtSamplerExternalOES)
+    {
+        return "ex_" + string;
+    }
     
     return decorate(string);
 }
 }
--- a/gfx/angle/src/compiler/OutputHLSL.h
+++ b/gfx/angle/src/compiler/OutputHLSL.h
@@ -27,17 +27,17 @@ class OutputHLSL : public TIntermTravers
 
     TInfoSinkBase &getBodyStream();
 
     TString typeString(const TType &type);
     static TString qualifierString(TQualifier qualifier);
     static TString arrayString(const TType &type);
     static TString initializer(const TType &type);
     static TString decorate(const TString &string);                      // Prepends an underscore to avoid naming clashes
-    static TString decorateUniform(const TString &string, bool array);
+    static TString decorateUniform(const TString &string, const TType &type);
 
   protected:
     void header();
 
     // Visit AST nodes and output their code to the body stream
     void visitSymbol(TIntermSymbol*);
     void visitConstantUnion(TIntermConstantUnion*);
     bool visitBinary(Visit visit, TIntermBinary*);
--- a/gfx/angle/src/compiler/ParseHelper.cpp
+++ b/gfx/angle/src/compiler/ParseHelper.cpp
@@ -1458,17 +1458,17 @@ bool TParseContext::structNestingErrorCh
     }
 
     if (fieldType.getBasicType() != EbtStruct) {
         return false;
     }
 
     // We're already inside a structure definition at this point, so add
     // one to the field's struct nesting.
-    if (1 + fieldType.getDeepestStructNesting() >= kWebGLMaxStructNesting) {
+    if (1 + fieldType.getDeepestStructNesting() > kWebGLMaxStructNesting) {
         error(line, "", "", "Reference of struct type %s exceeds maximum struct nesting of %d",
               fieldType.getTypeName().c_str(), kWebGLMaxStructNesting);
         return true;
     }
 
     return false;
 }
 
--- a/gfx/angle/src/compiler/ShHandle.h
+++ b/gfx/angle/src/compiler/ShHandle.h
@@ -1,10 +1,10 @@
 //
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
 
 #ifndef _SHHANDLE_INCLUDED_
 #define _SHHANDLE_INCLUDED_
 
 //
@@ -17,16 +17,17 @@
 #include "GLSLANG/ShaderLang.h"
 
 #include "compiler/BuiltInFunctionEmulator.h"
 #include "compiler/ExtensionBehavior.h"
 #include "compiler/InfoSink.h"
 #include "compiler/SymbolTable.h"
 #include "compiler/VariableInfo.h"
 
+class LongNameMap;
 class TCompiler;
 
 //
 // The base class used to back handles returned to the driver.
 //
 class TShHandleBase {
 public:
     TShHandleBase();
@@ -95,18 +96,18 @@ private:
 
     BuiltInFunctionEmulator builtInFunctionEmulator;
 
     // Results of compilation.
     TInfoSink infoSink;  // Output sink.
     TVariableInfoList attribs;  // Active attributes in the compiled shader.
     TVariableInfoList uniforms;  // Active uniforms in the compiled shader.
 
-    // Pair of long varying varibale name <originalName, mappedName>.
-    std::map<std::string, std::string> varyingLongNameMap;
+    // Cached copy of the ref-counted singleton.
+    LongNameMap* longNameMap;
 };
 
 //
 // This is the interface between the machine independent code
 // and the machine dependent code.
 //
 // The machine dependent code should derive from the classes
 // above. Then Construct*() and Delete*() will create and 
--- a/gfx/angle/src/compiler/VariableInfo.cpp
+++ b/gfx/angle/src/compiler/VariableInfo.cpp
@@ -58,16 +58,17 @@ static ShDataType getVariableDataType(co
                 case 4: return SH_BOOL_VEC4;
                 default: UNREACHABLE();
               }
           } else {
               return SH_BOOL;
           }
       case EbtSampler2D: return SH_SAMPLER_2D;
       case EbtSamplerCube: return SH_SAMPLER_CUBE;
+      case EbtSamplerExternalOES: return SH_SAMPLER_EXTERNAL_OES;
       case EbtSampler2DRect: return SH_SAMPLER_2D_RECT_ARB;
       default: UNREACHABLE();
     }
     return SH_NONE;
 }
 
 static void getBuiltInVariableInfo(const TType& type,
                                    const TString& name,
deleted file mode 100644
deleted file mode 100644
--- a/gfx/angle/src/compiler/glslang.l
+++ b/gfx/angle/src/compiler/glslang.l
@@ -16,16 +16,23 @@ WHICH GENERATES THE GLSL ES LEXER (glsla
 %top{
 //
 // Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
 
 // This file is auto-generated by generate_parser.sh. DO NOT EDIT!
+
+// Ignore errors in auto-generated code.
+#if defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wunused-variable"
+#elif defined(_MSC_VER)
+#pragma warning(disable: 4065)
+#endif
 }
 
 %{
 #include "compiler/glslang.h"
 #include "compiler/ParseHelper.h"
 #include "compiler/util.h"
 #include "glslang_tab.h"
 
@@ -477,16 +484,18 @@ void updateExtensionBehavior(const char*
                 CPPShInfoLogMsg((TString("extension '") + extName + "' is not supported").c_str());  
                 break;
             case EBhEnable:
             case EBhWarn:
             case EBhDisable:
                 msg = TString("extension '") + extName + "' is not supported";
                 context->infoSink.info.message(EPrefixWarning, msg.c_str(), yylineno); 
                 break;
+            default:
+                break;
             }
             return;
         } else
             iter->second = behaviorVal;
     }
 }
 }  // extern "C"
 
--- a/gfx/angle/src/compiler/glslang.y
+++ b/gfx/angle/src/compiler/glslang.y
@@ -17,16 +17,23 @@ WHICH GENERATES THE GLSL ES PARSER (glsl
 //
 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
 
 // This file is auto-generated by generate_parser.sh. DO NOT EDIT!
 
+// Ignore errors in auto-generated code.
+#if defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wunused-variable"
+#elif defined(_MSC_VER)
+#pragma warning(disable: 4065)
+#endif
+
 #include "compiler/SymbolTable.h"
 #include "compiler/ParseHelper.h"
 #include "GLSLANG/ShaderLang.h"
 
 #define YYLEX_PARAM context->scanner
 %}
 
 %expect 1 /* One shift reduce conflict because of if | else */
--- a/gfx/angle/src/compiler/glslang_lex.cpp
+++ b/gfx/angle/src/compiler/glslang_lex.cpp
@@ -1,20 +1,27 @@
-#line 17 "compiler/glslang.l"
+#line 17 "./glslang.l"
 //
 // Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
 
 // This file is auto-generated by generate_parser.sh. DO NOT EDIT!
 
-
-
-#line 13 "compiler/glslang_lex.cpp"
+// Ignore errors in auto-generated code.
+#if defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wunused-variable"
+#elif defined(_MSC_VER)
+#pragma warning(disable: 4065)
+#endif
+
+
+
+#line 20 "./glslang_lex.cpp"
 
 #define  YY_INT_ALIGNED short int
 
 /* A lexical scanner generated by flex */
 
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
@@ -58,16 +65,17 @@ typedef int32_t flex_int32_t;
 typedef uint32_t flex_uint32_t;
 #else
 typedef signed char flex_int8_t;
 typedef short int flex_int16_t;
 typedef int flex_int32_t;
 typedef unsigned char flex_uint8_t; 
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
 
 /* Limits of integral types. */
 #ifndef INT8_MIN
 #define INT8_MIN               (-128)
 #endif
 #ifndef INT16_MIN
 #define INT16_MIN              (-32767-1)
 #endif
@@ -88,18 +96,16 @@ typedef unsigned int flex_uint32_t;
 #endif
 #ifndef UINT16_MAX
 #define UINT16_MAX             (65535U)
 #endif
 #ifndef UINT32_MAX
 #define UINT32_MAX             (4294967295U)
 #endif
 
-#endif /* ! C99 */
-
 #endif /* ! FLEXINT_H */
 
 #ifdef __cplusplus
 
 /* The "const" storage-class-modifier is valid. */
 #define YY_USE_CONST
 
 #else	/* ! __cplusplus */
@@ -163,25 +169,17 @@ typedef void* yyscan_t;
 
 /* Special action meaning "start processing a new file". */
 #define YY_NEW_FILE yyrestart(yyin ,yyscanner )
 
 #define YY_END_OF_BUFFER_CHAR 0
 
 /* Size of default input buffer. */
 #ifndef YY_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
 #define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
 #endif
 
 /* The state buf must be large enough to hold one state per character in the main buffer.
  */
 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
 
 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
 #define YY_TYPEDEF_YY_BUFFER_STATE
@@ -917,41 +915,36 @@ static int input (yyscan_t yyscanner );
     static void yy_push_state (int new_state ,yyscan_t yyscanner);
     
     static void yy_pop_state (yyscan_t yyscanner );
     
     static int yy_top_state (yyscan_t yyscanner );
     
 /* Amount of stuff to slurp up with each read. */
 #ifndef YY_READ_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
 #define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
 #endif
 
 /* Copy whatever the last rule matched to the standard output. */
 #ifndef ECHO
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
+#define ECHO fwrite( yytext, yyleng, 1, yyout )
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  * is returned in "result".
  */
 #ifndef YY_INPUT
 #define YY_INPUT(buf,result,max_size) \
 	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
 		{ \
 		int c = '*'; \
-		size_t n; \
+		int n; \
 		for ( n = 0; n < max_size && \
 			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
 			buf[n] = (char) c; \
 		if ( c == '\n' ) \
 			buf[n++] = (char) c; \
 		if ( c == EOF && ferror( yyin ) ) \
 			YY_FATAL_ERROR( "input in flex scanner failed" ); \
 		result = n; \
@@ -2456,18 +2449,18 @@ YY_BUFFER_STATE yy_scan_buffer  (char * 
 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
 {
     
 	return yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
 }
 
 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
  * scan from a @e copy of @a bytes.
- * @param yybytes the byte buffer to scan
- * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
+ * @param bytes the byte buffer to scan
+ * @param len the number of bytes in the buffer pointed to by @a bytes.
  * @param yyscanner The scanner object.
  * @return the newly allocated buffer state object.
  */
 YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
 {
 	YY_BUFFER_STATE b;
 	char *buf;
 	yy_size_t n;
@@ -3125,16 +3118,18 @@ void updateExtensionBehavior(const char*
                 CPPShInfoLogMsg((TString("extension '") + extName + "' is not supported").c_str());  
                 break;
             case EBhEnable:
             case EBhWarn:
             case EBhDisable:
                 msg = TString("extension '") + extName + "' is not supported";
                 context->infoSink.info.message(EPrefixWarning, msg.c_str(), yylineno); 
                 break;
+            default:
+                break;
             }
             return;
         } else
             iter->second = behaviorVal;
     }
 }
 }  // extern "C"
 
--- a/gfx/angle/src/compiler/glslang_tab.cpp
+++ b/gfx/angle/src/compiler/glslang_tab.cpp
@@ -1,39 +1,40 @@
-
-/* A Bison parser, made by GNU Bison 2.4.1.  */
+/* A Bison parser, made by GNU Bison 2.3.  */
 
 /* Skeleton implementation for Bison's Yacc-like parsers in C
-   
-      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
-   
-   This program is free software: you can redistribute it and/or modify
+
+   This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-   
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
 
 /* As a special exception, you may create a larger work that contains
    part or all of the Bison parser skeleton and distribute that work
    under terms of your choice, so long as that work isn't itself a
    parser generator using the skeleton or a modified version thereof
    as a parser skeleton.  Alternatively, if you modify or redistribute
    the parser skeleton itself, you may (at your option) remove this
    special exception, which will cause the skeleton and the resulting
    Bison output files to be licensed under the GNU General Public
    License without this special exception.
-   
+
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
 /* C LALR(1) parser skeleton written by Richard Stallman, by
    simplifying the original so-called "semantic" parser.  */
 
 /* All symbols defined below should begin with yy or YY, to avoid
    infringing on user name space.  This should be done even for local
@@ -41,73 +42,29 @@
    There are some unavoidable exceptions within include files to
    define necessary library symbols; they are noted "INFRINGES ON
    USER NAME SPACE" below.  */
 
 /* Identify Bison output.  */
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.4.1"
+#define YYBISON_VERSION "2.3"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
 
 /* Pure parsers.  */
 #define YYPURE 1
 
-/* Push parsers.  */
-#define YYPUSH 0
-
-/* Pull parsers.  */
-#define YYPULL 1
-
 /* Using locations.  */
 #define YYLSP_NEEDED 0
 
 
 
-/* Copy the first part of user declarations.  */
-
-
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
-
-#include "compiler/SymbolTable.h"
-#include "compiler/ParseHelper.h"
-#include "GLSLANG/ShaderLang.h"
-
-#define YYLEX_PARAM context->scanner
-
-
-
-/* Enabling traces.  */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-
-/* Enabling verbose error messages.  */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-/* Enabling the token table.  */
-#ifndef YYTOKEN_TABLE
-# define YYTOKEN_TABLE 0
-#endif
-
-
 /* Tokens.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
    /* Put the tokens into the symbol table, so that GDB and other debuggers
       know about them.  */
    enum yytokentype {
      INVARIANT = 258,
      HIGH_PRECISION = 259,
@@ -199,24 +156,161 @@
      LEFT_ANGLE = 345,
      RIGHT_ANGLE = 346,
      VERTICAL_BAR = 347,
      CARET = 348,
      AMPERSAND = 349,
      QUESTION = 350
    };
 #endif
-
-
+/* Tokens.  */
+#define INVARIANT 258
+#define HIGH_PRECISION 259
+#define MEDIUM_PRECISION 260
+#define LOW_PRECISION 261
+#define PRECISION 262
+#define ATTRIBUTE 263
+#define CONST_QUAL 264
+#define BOOL_TYPE 265
+#define FLOAT_TYPE 266
+#define INT_TYPE 267
+#define BREAK 268
+#define CONTINUE 269
+#define DO 270
+#define ELSE 271
+#define FOR 272
+#define IF 273
+#define DISCARD 274
+#define RETURN 275
+#define BVEC2 276
+#define BVEC3 277
+#define BVEC4 278
+#define IVEC2 279
+#define IVEC3 280
+#define IVEC4 281
+#define VEC2 282
+#define VEC3 283
+#define VEC4 284
+#define MATRIX2 285
+#define MATRIX3 286
+#define MATRIX4 287
+#define IN_QUAL 288
+#define OUT_QUAL 289
+#define INOUT_QUAL 290
+#define UNIFORM 291
+#define VARYING 292
+#define STRUCT 293
+#define VOID_TYPE 294
+#define WHILE 295
+#define SAMPLER2D 296
+#define SAMPLERCUBE 297
+#define SAMPLER_EXTERNAL_OES 298
+#define SAMPLER2DRECT 299
+#define IDENTIFIER 300
+#define TYPE_NAME 301
+#define FLOATCONSTANT 302
+#define INTCONSTANT 303
+#define BOOLCONSTANT 304
+#define FIELD_SELECTION 305
+#define LEFT_OP 306
+#define RIGHT_OP 307
+#define INC_OP 308
+#define DEC_OP 309
+#define LE_OP 310
+#define GE_OP 311
+#define EQ_OP 312
+#define NE_OP 313
+#define AND_OP 314
+#define OR_OP 315
+#define XOR_OP 316
+#define MUL_ASSIGN 317
+#define DIV_ASSIGN 318
+#define ADD_ASSIGN 319
+#define MOD_ASSIGN 320
+#define LEFT_ASSIGN 321
+#define RIGHT_ASSIGN 322
+#define AND_ASSIGN 323
+#define XOR_ASSIGN 324
+#define OR_ASSIGN 325
+#define SUB_ASSIGN 326
+#define LEFT_PAREN 327
+#define RIGHT_PAREN 328
+#define LEFT_BRACKET 329
+#define RIGHT_BRACKET 330
+#define LEFT_BRACE 331
+#define RIGHT_BRACE 332
+#define DOT 333
+#define COMMA 334
+#define COLON 335
+#define EQUAL 336
+#define SEMICOLON 337
+#define BANG 338
+#define DASH 339
+#define TILDE 340
+#define PLUS 341
+#define STAR 342
+#define SLASH 343
+#define PERCENT 344
+#define LEFT_ANGLE 345
+#define RIGHT_ANGLE 346
+#define VERTICAL_BAR 347
+#define CARET 348
+#define AMPERSAND 349
+#define QUESTION 350
+
+
+
+
+/* Copy the first part of user declarations.  */
+
+
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
+
+// Ignore errors in auto-generated code.
+#if defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wunused-variable"
+#elif defined(_MSC_VER)
+#pragma warning(disable: 4065)
+#endif
+
+#include "compiler/SymbolTable.h"
+#include "compiler/ParseHelper.h"
+#include "GLSLANG/ShaderLang.h"
+
+#define YYLEX_PARAM context->scanner
+
+
+/* Enabling traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+
+/* Enabling verbose error messages.  */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+/* Enabling the token table.  */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE 0
+#endif
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
+
 {
-
-
     struct {
         TSourceLoc line;
         union {
             TString *string;
             float f;
             int i;
             bool b;
         };
@@ -236,26 +330,27 @@ typedef union YYSTYPE
             TPrecision precision;
             TQualifier qualifier;
             TFunction* function;
             TParameter param;
             TTypeLine typeLine;
             TTypeList* typeList;
         };
     } interm;
-
-
-
-} YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
+}
+/* Line 187 of yacc.c.  */
+
+	YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
 #endif
 
 
+
 /* Copy the second part of user declarations.  */
 
 
 extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
 extern void yyerror(TParseContext* context, const char* reason);
 
 #define FRAG_VERT_ONLY(S, L) {  \
     if (context->shaderType != SH_FRAGMENT_SHADER &&  \
@@ -275,16 +370,18 @@ extern void yyerror(TParseContext* conte
 #define FRAG_ONLY(S, L) {  \
     if (context->shaderType != SH_FRAGMENT_SHADER) {  \
         context->error(L, " supported in fragment shaders only ", S, "", "");  \
         context->recover();  \
     }  \
 }
 
 
+/* Line 216 of yacc.c.  */
+
 
 #ifdef short
 # undef short
 #endif
 
 #ifdef YYTYPE_UINT8
 typedef YYTYPE_UINT8 yytype_uint8;
 #else
@@ -349,24 +446,24 @@ typedef short int yytype_int16;
 
 /* Identity function, used to suppress warnings about constant conditions.  */
 #ifndef lint
 # define YYID(n) (n)
 #else
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 static int
-YYID (int yyi)
+YYID (int i)
 #else
 static int
-YYID (yyi)
-    int yyi;
+YYID (i)
+    int i;
 #endif
 {
-  return yyi;
+  return i;
 }
 #endif
 
 #if ! defined yyoverflow || YYERROR_VERBOSE
 
 /* The parser invokes alloca or malloc; define the necessary symbols.  */
 
 # ifdef YYSTACK_USE_ALLOCA
@@ -437,19 +534,19 @@ void free (void *); /* INFRINGES ON USER
 
 #if (! defined yyoverflow \
      && (! defined __cplusplus \
 	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
 
 /* A type that is properly aligned for any stack member.  */
 union yyalloc
 {
-  yytype_int16 yyss_alloc;
-  YYSTYPE yyvs_alloc;
-};
+  yytype_int16 yyss;
+  YYSTYPE yyvs;
+  };
 
 /* The size of the maximum gap between one aligned stack and the next.  */
 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
 
 /* The size of an array large to enough to hold all stacks, each with
    N elements.  */
 # define YYSTACK_BYTES(N) \
      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
@@ -473,22 +570,22 @@ union yyalloc
 #  endif
 # endif
 
 /* Relocate STACK from its old location to the new one.  The
    local variables YYSIZE and YYSTACKSIZE give the old and new number of
    elements in the stack, and YYPTR gives the new location of the
    stack.  Advance YYPTR to a properly aligned location for the next
    stack.  */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack)				\
+# define YYSTACK_RELOCATE(Stack)					\
     do									\
       {									\
 	YYSIZE_T yynewbytes;						\
-	YYCOPY (&yyptr->Stack_alloc, Stack, yysize);			\
-	Stack = &yyptr->Stack_alloc;					\
+	YYCOPY (&yyptr->Stack, Stack, yysize);				\
+	Stack = &yyptr->Stack;						\
 	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
 	yyptr += yynewbytes / sizeof (*yyptr);				\
       }									\
     while (YYID (0))
 
 #endif
 
 /* YYFINAL -- State number of the termination state.  */
@@ -640,36 +737,36 @@ static const yytype_int16 yyrhs[] =
       20,   124,    82,    -1,    19,    82,    -1,   173,    -1,   172,
      173,    -1,   174,    -1,   126,    -1,    -1,   127,   175,   158,
       -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   153,   153,   188,   191,   204,   209,   214,   220,   223,
-     296,   299,   408,   418,   431,   439,   538,   541,   549,   553,
-     560,   564,   571,   577,   586,   594,   649,   656,   666,   669,
-     679,   689,   710,   711,   712,   717,   718,   727,   739,   740,
-     748,   759,   763,   764,   774,   784,   794,   807,   808,   818,
-     831,   835,   839,   843,   844,   857,   858,   871,   872,   885,
-     886,   903,   904,   917,   918,   919,   920,   921,   925,   928,
-     939,   947,   972,   977,   984,  1020,  1023,  1030,  1038,  1059,
-    1078,  1089,  1118,  1123,  1133,  1138,  1148,  1151,  1154,  1157,
-    1163,  1170,  1173,  1189,  1207,  1231,  1254,  1258,  1276,  1284,
-    1316,  1336,  1412,  1421,  1444,  1447,  1453,  1461,  1469,  1477,
-    1487,  1494,  1497,  1500,  1506,  1509,  1524,  1528,  1532,  1536,
-    1545,  1550,  1555,  1560,  1565,  1570,  1575,  1580,  1585,  1590,
-    1596,  1602,  1608,  1613,  1618,  1627,  1636,  1641,  1654,  1654,
-    1668,  1668,  1677,  1680,  1695,  1731,  1735,  1741,  1749,  1765,
-    1769,  1773,  1774,  1780,  1781,  1782,  1783,  1784,  1788,  1789,
-    1789,  1789,  1799,  1800,  1805,  1808,  1818,  1821,  1827,  1828,
-    1832,  1840,  1844,  1854,  1859,  1876,  1876,  1881,  1881,  1888,
-    1888,  1896,  1899,  1905,  1908,  1914,  1918,  1925,  1932,  1939,
-    1946,  1957,  1966,  1970,  1977,  1980,  1986,  1986
+       0,   160,   160,   195,   198,   211,   216,   221,   227,   230,
+     303,   306,   415,   425,   438,   446,   545,   548,   556,   560,
+     567,   571,   578,   584,   593,   601,   656,   663,   673,   676,
+     686,   696,   717,   718,   719,   724,   725,   734,   746,   747,
+     755,   766,   770,   771,   781,   791,   801,   814,   815,   825,
+     838,   842,   846,   850,   851,   864,   865,   878,   879,   892,
+     893,   910,   911,   924,   925,   926,   927,   928,   932,   935,
+     946,   954,   979,   984,   991,  1027,  1030,  1037,  1045,  1066,
+    1085,  1096,  1125,  1130,  1140,  1145,  1155,  1158,  1161,  1164,
+    1170,  1177,  1180,  1196,  1214,  1238,  1261,  1265,  1283,  1291,
+    1323,  1343,  1419,  1428,  1451,  1454,  1460,  1468,  1476,  1484,
+    1494,  1501,  1504,  1507,  1513,  1516,  1531,  1535,  1539,  1543,
+    1552,  1557,  1562,  1567,  1572,  1577,  1582,  1587,  1592,  1597,
+    1603,  1609,  1615,  1620,  1625,  1634,  1643,  1648,  1661,  1661,
+    1675,  1675,  1684,  1687,  1702,  1738,  1742,  1748,  1756,  1772,
+    1776,  1780,  1781,  1787,  1788,  1789,  1790,  1791,  1795,  1796,
+    1796,  1796,  1806,  1807,  1812,  1815,  1825,  1828,  1834,  1835,
+    1839,  1847,  1851,  1861,  1866,  1883,  1883,  1888,  1888,  1895,
+    1895,  1903,  1906,  1912,  1915,  1921,  1925,  1932,  1939,  1946,
+    1953,  1964,  1973,  1977,  1984,  1987,  1993,  1993
 };
 #endif
 
 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
 static const char *const yytname[] =
 {
@@ -703,26 +800,26 @@ static const char *const yytname[] =
   "assignment_expression", "assignment_operator", "expression",
   "constant_expression", "declaration", "function_prototype",
   "function_declarator", "function_header_with_parameters",
   "function_header", "parameter_declarator", "parameter_declaration",
   "parameter_qualifier", "parameter_type_specifier",
   "init_declarator_list", "single_declaration", "fully_specified_type",
   "type_qualifier", "type_specifier", "precision_qualifier",
   "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
-  "$@1", "$@2", "struct_declaration_list", "struct_declaration",
+  "@1", "@2", "struct_declaration_list", "struct_declaration",
   "struct_declarator_list", "struct_declarator", "initializer",
   "declaration_statement", "statement", "simple_statement",
-  "compound_statement", "$@3", "$@4", "statement_no_new_scope",
+  "compound_statement", "@3", "@4", "statement_no_new_scope",
   "compound_statement_no_new_scope", "statement_list",
   "expression_statement", "selection_statement",
-  "selection_rest_statement", "condition", "iteration_statement", "$@5",
-  "$@6", "$@7", "for_init_statement", "conditionopt", "for_rest_statement",
+  "selection_rest_statement", "condition", "iteration_statement", "@5",
+  "@6", "@7", "for_init_statement", "conditionopt", "for_rest_statement",
   "jump_statement", "translation_unit", "external_declaration",
-  "function_definition", "$@8", 0
+  "function_definition", "@8", 0
 };
 #endif
 
 # ifdef YYPRINT
 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
    token YYLEX-NUM.  */
 static const yytype_uint16 yytoknum[] =
 {
@@ -1394,30 +1491,27 @@ yy_symbol_print (yyoutput, yytype, yyval
 /*------------------------------------------------------------------.
 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
 | TOP (included).                                                   |
 `------------------------------------------------------------------*/
 
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 static void
-yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
+yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
 #else
 static void
-yy_stack_print (yybottom, yytop)
-    yytype_int16 *yybottom;
-    yytype_int16 *yytop;
+yy_stack_print (bottom, top)
+    yytype_int16 *bottom;
+    yytype_int16 *top;
 #endif
 {
   YYFPRINTF (stderr, "Stack now");
-  for (; yybottom <= yytop; yybottom++)
-    {
-      int yybot = *yybottom;
-      YYFPRINTF (stderr, " %d", yybot);
-    }
+  for (; bottom <= top; ++bottom)
+    YYFPRINTF (stderr, " %d", *bottom);
   YYFPRINTF (stderr, "\n");
 }
 
 # define YY_STACK_PRINT(Bottom, Top)				\
 do {								\
   if (yydebug)							\
     yy_stack_print ((Bottom), (Top));				\
 } while (YYID (0))
@@ -1442,21 +1536,21 @@ yy_reduce_print (yyvsp, yyrule, context)
   int yynrhs = yyr2[yyrule];
   int yyi;
   unsigned long int yylno = yyrline[yyrule];
   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
 	     yyrule - 1, yylno);
   /* The symbols being reduced.  */
   for (yyi = 0; yyi < yynrhs; yyi++)
     {
-      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
+      fprintf (stderr, "   $%d = ", yyi + 1);
       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
 		       &(yyvsp[(yyi + 1) - (yynrhs)])
 		       		       , context);
-      YYFPRINTF (stderr, "\n");
+      fprintf (stderr, "\n");
     }
 }
 
 # define YY_REDUCE_PRINT(Rule)		\
 do {					\
   if (yydebug)				\
     yy_reduce_print (yyvsp, Rule, context); \
 } while (YYID (0))
@@ -1728,18 +1822,20 @@ yydestruct (yymsg, yytype, yyvaluep, con
 
   switch (yytype)
     {
 
       default:
 	break;
     }
 }
+
 
 /* Prevent warnings from -Wmissing-prototypes.  */
+
 #ifdef YYPARSE_PARAM
 #if defined __STDC__ || defined __cplusplus
 int yyparse (void *YYPARSE_PARAM);
 #else
 int yyparse ();
 #endif
 #else /* ! YYPARSE_PARAM */
 #if defined __STDC__ || defined __cplusplus
@@ -1748,19 +1844,20 @@ int yyparse (TParseContext* context);
 int yyparse ();
 #endif
 #endif /* ! YYPARSE_PARAM */
 
 
 
 
 
-/*-------------------------.
-| yyparse or yypush_parse.  |
-`-------------------------*/
+
+/*----------.
+| yyparse.  |
+`----------*/
 
 #ifdef YYPARSE_PARAM
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 int
 yyparse (void *YYPARSE_PARAM)
 #else
 int
@@ -1774,85 +1871,84 @@ int
 yyparse (TParseContext* context)
 #else
 int
 yyparse (context)
     TParseContext* context;
 #endif
 #endif
 {
-/* The lookahead symbol.  */
+  /* The look-ahead symbol.  */
 int yychar;
 
-/* The semantic value of the lookahead symbol.  */
+/* The semantic value of the look-ahead symbol.  */
 YYSTYPE yylval;
 
-    /* Number of syntax errors so far.  */
-    int yynerrs;
-
-    int yystate;
-    /* Number of tokens to shift before error messages enabled.  */
-    int yyerrstatus;
-
-    /* The stacks and their tools:
-       `yyss': related to states.
-       `yyvs': related to semantic values.
-
-       Refer to the stacks thru separate pointers, to allow yyoverflow
-       to reallocate them elsewhere.  */
-
-    /* The state stack.  */
-    yytype_int16 yyssa[YYINITDEPTH];
-    yytype_int16 *yyss;
-    yytype_int16 *yyssp;
-
-    /* The semantic value stack.  */
-    YYSTYPE yyvsa[YYINITDEPTH];
-    YYSTYPE *yyvs;
-    YYSTYPE *yyvsp;
-
-    YYSIZE_T yystacksize;
-
+/* Number of syntax errors so far.  */
+int yynerrs;
+
+  int yystate;
   int yyn;
   int yyresult;
-  /* Lookahead token as an internal (translated) token number.  */
-  int yytoken;
-  /* The variables used to return semantic value and location from the
-     action routines.  */
-  YYSTYPE yyval;
-
+  /* Number of tokens to shift before error messages enabled.  */
+  int yyerrstatus;
+  /* Look-ahead token as an internal (translated) token number.  */
+  int yytoken = 0;
 #if YYERROR_VERBOSE
   /* Buffer for error messages, and its allocated size.  */
   char yymsgbuf[128];
   char *yymsg = yymsgbuf;
   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
 #endif
 
+  /* Three stacks and their tools:
+     `yyss': related to states,
+     `yyvs': related to semantic values,
+     `yyls': related to locations.
+
+     Refer to the stacks thru separate pointers, to allow yyoverflow
+     to reallocate them elsewhere.  */
+
+  /* The state stack.  */
+  yytype_int16 yyssa[YYINITDEPTH];
+  yytype_int16 *yyss = yyssa;
+  yytype_int16 *yyssp;
+
+  /* The semantic value stack.  */
+  YYSTYPE yyvsa[YYINITDEPTH];
+  YYSTYPE *yyvs = yyvsa;
+  YYSTYPE *yyvsp;
+
+
+
 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
 
+  YYSIZE_T yystacksize = YYINITDEPTH;
+
+  /* The variables used to return semantic value and location from the
+     action routines.  */
+  YYSTYPE yyval;
+
+
   /* The number of symbols on the RHS of the reduced rule.
      Keep to zero when no symbol should be popped.  */
   int yylen = 0;
 
-  yytoken = 0;
-  yyss = yyssa;
-  yyvs = yyvsa;
-  yystacksize = YYINITDEPTH;
-
   YYDPRINTF ((stderr, "Starting parse\n"));
 
   yystate = 0;
   yyerrstatus = 0;
   yynerrs = 0;
-  yychar = YYEMPTY; /* Cause a token to be read.  */
+  yychar = YYEMPTY;		/* Cause a token to be read.  */
 
   /* Initialize stack pointers.
      Waste one element of value and location stack
      so that they stay on the same level as the state stack.
      The wasted elements are never initialized.  */
+
   yyssp = yyss;
   yyvsp = yyvs;
 
   goto yysetstate;
 
 /*------------------------------------------------------------.
 | yynewstate -- Push a new state, which is found in yystate.  |
 `------------------------------------------------------------*/
@@ -1872,23 +1968,25 @@ YYSTYPE yylval;
 #ifdef yyoverflow
       {
 	/* Give user a chance to reallocate the stack.  Use copies of
 	   these so that the &'s don't force the real ones into
 	   memory.  */
 	YYSTYPE *yyvs1 = yyvs;
 	yytype_int16 *yyss1 = yyss;
 
+
 	/* Each stack pointer address is followed by the size of the
 	   data in use in that stack, in bytes.  This used to be a
 	   conditional around just the two extra args, but that might
 	   be undefined if yyoverflow is a macro.  */
 	yyoverflow (YY_("memory exhausted"),
 		    &yyss1, yysize * sizeof (*yyssp),
 		    &yyvs1, yysize * sizeof (*yyvsp),
+
 		    &yystacksize);
 
 	yyss = yyss1;
 	yyvs = yyvs1;
       }
 #else /* no yyoverflow */
 # ifndef YYSTACK_RELOCATE
       goto yyexhaustedlab;
@@ -1901,58 +1999,57 @@ YYSTYPE yylval;
 	yystacksize = YYMAXDEPTH;
 
       {
 	yytype_int16 *yyss1 = yyss;
 	union yyalloc *yyptr =
 	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
 	if (! yyptr)
 	  goto yyexhaustedlab;
-	YYSTACK_RELOCATE (yyss_alloc, yyss);
-	YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+	YYSTACK_RELOCATE (yyss);
+	YYSTACK_RELOCATE (yyvs);
+
 #  undef YYSTACK_RELOCATE
 	if (yyss1 != yyssa)
 	  YYSTACK_FREE (yyss1);
       }
 # endif
 #endif /* no yyoverflow */
 
       yyssp = yyss + yysize - 1;
       yyvsp = yyvs + yysize - 1;
 
+
       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
 		  (unsigned long int) yystacksize));
 
       if (yyss + yystacksize - 1 <= yyssp)
 	YYABORT;
     }
 
   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
 
-  if (yystate == YYFINAL)
-    YYACCEPT;
-
   goto yybackup;
 
 /*-----------.
 | yybackup.  |
 `-----------*/
 yybackup:
 
   /* Do appropriate processing given the current state.  Read a
-     lookahead token if we need one and don't already have one.  */
-
-  /* First try to decide what to do without reference to lookahead token.  */
+     look-ahead token if we need one and don't already have one.  */
+
+  /* First try to decide what to do without reference to look-ahead token.  */
   yyn = yypact[yystate];
   if (yyn == YYPACT_NINF)
     goto yydefault;
 
-  /* Not known => get a lookahead token if don't already have one.  */
-
-  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
+  /* Not known => get a look-ahead token if don't already have one.  */
+
+  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
   if (yychar == YYEMPTY)
     {
       YYDPRINTF ((stderr, "Reading a token: "));
       yychar = YYLEX;
     }
 
   if (yychar <= YYEOF)
     {
@@ -1974,26 +2071,30 @@ yybackup:
   if (yyn <= 0)
     {
       if (yyn == 0 || yyn == YYTABLE_NINF)
 	goto yyerrlab;
       yyn = -yyn;
       goto yyreduce;
     }
 
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
   /* Count tokens shifted since error; after three, turn off error
      status.  */
   if (yyerrstatus)
     yyerrstatus--;
 
-  /* Shift the lookahead token.  */
+  /* Shift the look-ahead token.  */
   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
 
-  /* Discard the shifted token.  */
-  yychar = YYEMPTY;
+  /* Discard the shifted token unless it is eof.  */
+  if (yychar != YYEOF)
+    yychar = YYEMPTY;
 
   yystate = yyn;
   *++yyvsp = yylval;
 
   goto yynewstate;
 
 
 /*-----------------------------------------------------------.
@@ -2055,73 +2156,73 @@ yyreduce:
         if (variable->getType().getQualifier() == EvqConst ) {
             ConstantUnion* constArray = variable->getConstPointer();
             TType t(variable->getType());
             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
         } else
             (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
                                                      variable->getName(),
                                                      variable->getType(), (yyvsp[(1) - (1)].lex).line);
-    }
+    ;}
     break;
 
   case 3:
 
     {
         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
-    }
+    ;}
     break;
 
   case 4:
 
     {
         //
         // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
         // check for overflow for constants
         //
         if (abs((yyvsp[(1) - (1)].lex).i) >= (1 << 16)) {
             context->error((yyvsp[(1) - (1)].lex).line, " integer constant overflow", "", "");
             context->recover();
         }
         ConstantUnion *unionArray = new ConstantUnion[1];
         unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
         (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
-    }
+    ;}
     break;
 
   case 5:
 
     {
         ConstantUnion *unionArray = new ConstantUnion[1];
         unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
         (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
-    }
+    ;}
     break;
 
   case 6:
 
     {
         ConstantUnion *unionArray = new ConstantUnion[1];
         unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
         (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
-    }
+    ;}
     break;
 
   case 7:
 
     {
         (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
-    }
+    ;}
     break;
 
   case 8:
 
     {
         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
-    }
+    ;}
     break;
 
   case 9:
 
     {
         if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
             if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
                 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", (yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode()->getSymbol().c_str(), "");
@@ -2188,24 +2289,24 @@ yyreduce:
         else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
             (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
         else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
             (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst));
         else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
             (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
         else
             (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
-    }
+    ;}
     break;
 
   case 10:
 
     {
         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
-    }
+    ;}
     break;
 
   case 11:
 
     {
         if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
             context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".", "");
             context->recover();
@@ -2308,54 +2409,54 @@ yyreduce:
                 }
             }
         } else {
             context->error((yyvsp[(2) - (3)].lex).line, " field selection requires structure, vector, or matrix on left hand side", (yyvsp[(3) - (3)].lex).string->c_str(), "");
             context->recover();
             (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
         }
         // don't delete $3.string, it's from the pool
-    }
+    ;}
     break;
 
   case 12:
 
     {
         if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
             context->recover();
         (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
         if ((yyval.interm.intermTypedNode) == 0) {
             context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
         }
-    }
+    ;}
     break;
 
   case 13:
 
     {
         if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
             context->recover();
         (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
         if ((yyval.interm.intermTypedNode) == 0) {
             context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
         }
-    }
+    ;}
     break;
 
   case 14:
 
     {
         if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
             context->recover();
         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
-    }
+    ;}
     break;
 
   case 15:
 
     {
         TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
         TOperator op = fnCall->getBuiltInOp();
 
@@ -2445,92 +2546,92 @@ yyreduce:
                 // Put on a dummy node for error recovery
                 ConstantUnion *unionArray = new ConstantUnion[1];
                 unionArray->setFConst(0.0f);
                 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
                 context->recover();
             }
         }
         delete fnCall;
-    }
+    ;}
     break;
 
   case 16:
 
     {
         (yyval.interm) = (yyvsp[(1) - (1)].interm);
-    }
+    ;}
     break;
 
   case 17:
 
     {
         context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "", "");
         context->recover();
         (yyval.interm) = (yyvsp[(3) - (3)].interm);
-    }
+    ;}
     break;
 
   case 18:
 
     {
         (yyval.interm) = (yyvsp[(1) - (2)].interm);
         (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
-    }
+    ;}
     break;
 
   case 19:
 
     {
         (yyval.interm) = (yyvsp[(1) - (2)].interm);
         (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
-    }
+    ;}
     break;
 
   case 20:
 
     {
         (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
         (yyval.interm).intermNode = 0;
-    }
+    ;}
     break;
 
   case 21:
 
     {
         (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
         (yyval.interm).intermNode = 0;
-    }
+    ;}
     break;
 
   case 22:
 
     {
         TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
         (yyvsp[(1) - (2)].interm.function)->addParameter(param);
         (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
         (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
-    }
+    ;}
     break;
 
   case 23:
 
     {
         TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
         (yyvsp[(1) - (3)].interm).function->addParameter(param);
         (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
         (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
-    }
+    ;}
     break;
 
   case 24:
 
     {
         (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
-    }
+    ;}
     break;
 
   case 25:
 
     {
         //
         // Constructor
         //
@@ -2579,74 +2680,74 @@ yyreduce:
                 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
                 op = EOpConstructFloat;
             }
         }
         TString tempString;
         TType type((yyvsp[(1) - (1)].interm.type));
         TFunction *function = new TFunction(&tempString, type, op);
         (yyval.interm.function) = function;
-    }
+    ;}
     break;
 
   case 26:
 
     {
         if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
             context->recover();
         TType type(EbtVoid, EbpUndefined);
         TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
         (yyval.interm.function) = function;
-    }
+    ;}
     break;
 
   case 27:
 
     {
         if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
             context->recover();
         TType type(EbtVoid, EbpUndefined);
         TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
         (yyval.interm.function) = function;
-    }
+    ;}
     break;
 
   case 28:
 
     {
         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
-    }
+    ;}
     break;
 
   case 29:
 
     {
         if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
             context->recover();
         (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
         if ((yyval.interm.intermTypedNode) == 0) {
             context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
         }
-    }
+    ;}
     break;
 
   case 30:
 
     {
         if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
             context->recover();
         (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
         if ((yyval.interm.intermTypedNode) == 0) {
             context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
         }
-    }
+    ;}
     break;
 
   case 31:
 
     {
         if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
             (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line, context->symbolTable);
             if ((yyval.interm.intermTypedNode) == 0) {
@@ -2657,268 +2758,268 @@ yyreduce:
                 default: break;
                 }
                 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
                 context->recover();
                 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
             }
         } else
             (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
-    }
+    ;}
     break;
 
   case 32:
 
-    { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; }
+    { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; ;}
     break;
 
   case 33:
 
-    { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; }
+    { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; ;}
     break;
 
   case 34:
 
-    { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; }
+    { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; ;}
     break;
 
   case 35:
 
-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
+    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
     break;
 
   case 36:
 
     {
         FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
         if ((yyval.interm.intermTypedNode) == 0) {
             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
         }
-    }
+    ;}
     break;
 
   case 37:
 
     {
         FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
         if ((yyval.interm.intermTypedNode) == 0) {
             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
         }
-    }
+    ;}
     break;
 
   case 38:
 
-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
+    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
     break;
 
   case 39:
 
     {
         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
         if ((yyval.interm.intermTypedNode) == 0) {
             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
         }
-    }
+    ;}
     break;
 
   case 40:
 
     {
         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
         if ((yyval.interm.intermTypedNode) == 0) {
             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
         }
-    }
+    ;}
     break;
 
   case 41:
 
-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
+    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
     break;
 
   case 42:
 
-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
+    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
     break;
 
   case 43:
 
     {
         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
         if ((yyval.interm.intermTypedNode) == 0) {
             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             ConstantUnion *unionArray = new ConstantUnion[1];
             unionArray->setBConst(false);
             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
         }
-    }
+    ;}
     break;
 
   case 44:
 
     {
         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
         if ((yyval.interm.intermTypedNode) == 0) {
             context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             ConstantUnion *unionArray = new ConstantUnion[1];
             unionArray->setBConst(false);
             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
         }
-    }
+    ;}
     break;
 
   case 45:
 
     {
         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
         if ((yyval.interm.intermTypedNode) == 0) {
             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             ConstantUnion *unionArray = new ConstantUnion[1];
             unionArray->setBConst(false);
             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
         }
-    }
+    ;}
     break;
 
   case 46:
 
     {
         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
         if ((yyval.interm.intermTypedNode) == 0) {
             context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             ConstantUnion *unionArray = new ConstantUnion[1];
             unionArray->setBConst(false);
             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
         }
-    }
+    ;}
     break;
 
   case 47:
 
-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
+    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
     break;
 
   case 48:
 
     {
         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
         if ((yyval.interm.intermTypedNode) == 0) {
             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             ConstantUnion *unionArray = new ConstantUnion[1];
             unionArray->setBConst(false);
             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
         }
-    }
+    ;}
     break;
 
   case 49:
 
     {
         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
         if ((yyval.interm.intermTypedNode) == 0) {
             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             ConstantUnion *unionArray = new ConstantUnion[1];
             unionArray->setBConst(false);
             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
         }
-    }
+    ;}
     break;
 
   case 50:
 
-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
+    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
     break;
 
   case 51:
 
-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
+    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
     break;
 
   case 52:
 
-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
+    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
     break;
 
   case 53:
 
-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
+    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
     break;
 
   case 54:
 
     {
         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
         if ((yyval.interm.intermTypedNode) == 0) {
             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             ConstantUnion *unionArray = new ConstantUnion[1];
             unionArray->setBConst(false);
             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
         }
-    }
+    ;}
     break;
 
   case 55:
 
-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
+    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
     break;
 
   case 56:
 
     {
         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
         if ((yyval.interm.intermTypedNode) == 0) {
             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             ConstantUnion *unionArray = new ConstantUnion[1];
             unionArray->setBConst(false);
             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
         }
-    }
+    ;}
     break;
 
   case 57:
 
-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
+    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
     break;
 
   case 58:
 
     {
         (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
         if ((yyval.interm.intermTypedNode) == 0) {
             context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             ConstantUnion *unionArray = new ConstantUnion[1];
             unionArray->setBConst(false);
             (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
         }
-    }
+    ;}
     break;
 
   case 59:
 
-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
+    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
     break;
 
   case 60:
 
     {
        if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
             context->recover();
 
@@ -2926,89 +3027,89 @@ yyreduce:
         if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
             (yyval.interm.intermTypedNode) = 0;
 
         if ((yyval.interm.intermTypedNode) == 0) {
             context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
         }
-    }
+    ;}
     break;
 
   case 61:
 
-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
+    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
     break;
 
   case 62:
 
     {
         if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
             context->recover();
         (yyval.interm.intermTypedNode) = context->intermediate.addAssign((yyvsp[(2) - (3)].interm).op, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].interm).line);
         if ((yyval.interm.intermTypedNode) == 0) {
             context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
         }
-    }
+    ;}
     break;
 
   case 63:
 
-    {                                    (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; }
+    {                                    (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; ;}
     break;
 
   case 64:
 
-    { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line);     (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; }
+    { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line);     (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; ;}
     break;
 
   case 65:
 
-    { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line);     (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; }
+    { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line);     (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; ;}
     break;
 
   case 66:
 
-    {                                    (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; }
+    {                                    (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; ;}
     break;
 
   case 67:
 
-    {                                    (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; }
+    {                                    (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; ;}
     break;
 
   case 68:
 
     {
         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
-    }
+    ;}
     break;
 
   case 69:
 
     {
         (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
         if ((yyval.interm.intermTypedNode) == 0) {
             context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
             context->recover();
             (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
         }
-    }
+    ;}
     break;
 
   case 70:
 
     {
         if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
             context->recover();
         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
-    }
+    ;}
     break;
 
   case 71:
 
     {
         TFunction &function = *((yyvsp[(1) - (2)].interm).function);
         
         TIntermAggregate *prototype = new TIntermAggregate;
@@ -3027,34 +3128,34 @@ yyreduce:
             else
             {
                 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
             }
         }
         
         prototype->setOp(EOpPrototype);
         (yyval.interm.intermNode) = prototype;
-    }
+    ;}
     break;
 
   case 72:
 
     {
         if ((yyvsp[(1) - (2)].interm).intermAggregate)
             (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
         (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
-    }
+    ;}
     break;
 
   case 73:
 
     {
         context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) );
         (yyval.interm.intermNode) = 0;
-    }
+    ;}
     break;
 
   case 74:
 
     {
         //
         // Multiple declarations of the same function are allowed.
         //
@@ -3081,43 +3182,43 @@ yyreduce:
         // If this is a redeclaration, it could also be a definition,
         // in which case, we want to use the variable names from this one, and not the one that's
         // being redeclared.  So, pass back up this declaration, not the one in the symbol table.
         //
         (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
         (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
 
         context->symbolTable.insert(*(yyval.interm).function);
-    }
+    ;}
     break;
 
   case 75:
 
     {
         (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
-    }
+    ;}
     break;
 
   case 76:
 
     {
         (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
-    }
+    ;}
     break;
 
   case 77:
 
     {
         // Add the parameter
         (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
         if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
             (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
         else
             delete (yyvsp[(2) - (2)].interm).param.type;
-    }
+    ;}
     break;
 
   case 78:
 
     {
         //
         // Only first parameter of one-parameter functions can be void
         // The check for named parameters not being void is done in parameter_declarator
@@ -3129,17 +3230,17 @@ yyreduce:
             context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void", "");
             context->recover();
             delete (yyvsp[(3) - (3)].interm).param.type;
         } else {
             // Add the parameter
             (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
             (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
         }
-    }
+    ;}
     break;
 
   case 79:
 
     {
         if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
             context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier), "");
             context->recover();
@@ -3148,32 +3249,32 @@ yyreduce:
         if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
             context->recover();
 
         // Add the function as a prototype after parsing it (we do not support recursion)
         TFunction *function;
         TType type((yyvsp[(1) - (3)].interm.type));
         function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
         (yyval.interm.function) = function;
-    }
+    ;}
     break;
 
   case 80:
 
     {
         if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
             context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str(), "");
             context->recover();
         }
         if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
             context->recover();
         TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
         (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
         (yyval.interm).param = param;
-    }
+    ;}
     break;
 
   case 81:
 
     {
         // Check that we can make an array out of this type
         if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
             context->recover();
@@ -3185,100 +3286,100 @@ yyreduce:
         if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
             context->recover();
         (yyvsp[(1) - (5)].interm.type).setArray(true, size);
 
         TType* type = new TType((yyvsp[(1) - (5)].interm.type));
         TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
         (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
         (yyval.interm).param = param;
-    }
+    ;}
     break;
 
   case 82:
 
     {
         (yyval.interm) = (yyvsp[(3) - (3)].interm);
         if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
             context->recover();
-    }
+    ;}
     break;
 
   case 83:
 
     {
         (yyval.interm) = (yyvsp[(2) - (2)].interm);
         if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
             context->recover();
         if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
             context->recover();
-    }
+    ;}
     break;
 
   case 84:
 
     {
         (yyval.interm) = (yyvsp[(3) - (3)].interm);
         if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
             context->recover();
-    }
+    ;}
     break;
 
   case 85:
 
     {
         (yyval.interm) = (yyvsp[(2) - (2)].interm);
         if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
             context->recover();
         if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
             context->recover();
-    }
+    ;}
     break;
 
   case 86:
 
     {
         (yyval.interm.qualifier) = EvqIn;
-    }
+    ;}
     break;
 
   case 87:
 
     {
         (yyval.interm.qualifier) = EvqIn;
-    }
+    ;}
     break;
 
   case 88:
 
     {
         (yyval.interm.qualifier) = EvqOut;
-    }
+    ;}
     break;
 
   case 89:
 
     {
         (yyval.interm.qualifier) = EvqInOut;
-    }
+    ;}
     break;
 
   case 90:
 
     {
         TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
         (yyval.interm).param = param;
-    }
+    ;}
     break;
 
   case 91:
 
     {
         (yyval.interm) = (yyvsp[(1) - (1)].interm);
-    }
+    ;}
     break;
 
   case 92:
 
     {
         TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
         (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, symbol, (yyvsp[(3) - (3)].lex).line);
         
@@ -3288,17 +3389,17 @@ yyreduce:
         if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type))
             context->recover();
 
         TVariable* variable = 0;
         if (context->nonInitErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, variable))
             context->recover();
         if (symbol && variable)
             symbol->setId(variable->getUniqueId());
-    }
+    ;}
     break;
 
   case 93:
 
     {
         if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
             context->recover();
 
@@ -3310,17 +3411,17 @@ yyreduce:
         if (context->arrayTypeErrorCheck((yyvsp[(4) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type) || context->arrayQualifierErrorCheck((yyvsp[(4) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
             context->recover();
         else {
             (yyvsp[(1) - (5)].interm).type.setArray(true);
             TVariable* variable;
             if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
                 context->recover();
         }
-    }
+    ;}
     break;
 
   case 94:
 
     {
         if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
             context->recover();
 
@@ -3338,17 +3439,17 @@ yyreduce:
             (yyvsp[(1) - (6)].interm).type.setArray(true, size);
             TVariable* variable = 0;
             if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
                 context->recover();
             TType type = TType((yyvsp[(1) - (6)].interm).type);
             type.setArraySize(size);
             (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (6)].interm).intermNode, context->intermediate.addSymbol(variable ? variable->getUniqueId() : 0, *(yyvsp[(3) - (6)].lex).string, type, (yyvsp[(3) - (6)].lex).line), (yyvsp[(3) - (6)].lex).line);
         }
-    }
+    ;}
     break;
 
   case 95:
 
     {
         if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
             context->recover();
 
@@ -3362,25 +3463,25 @@ yyreduce:
             if (intermNode)
         (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
             else
                 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
         } else {
             context->recover();
             (yyval.interm).intermAggregate = 0;
         }
-    }
+    ;}
     break;
 
   case 96:
 
     {
         (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
         (yyval.interm).intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, "", TType((yyvsp[(1) - (1)].interm.type)), (yyvsp[(1) - (1)].interm.type).line), (yyvsp[(1) - (1)].interm.type).line);
-    }
+    ;}
     break;
 
   case 97:
 
     {
         TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
         (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
         
@@ -3392,29 +3493,29 @@ yyreduce:
             
             (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
 
         TVariable* variable = 0;
         if (context->nonInitErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, variable))
             context->recover();
         if (variable && symbol)
             symbol->setId(variable->getUniqueId());
-    }
+    ;}
     break;
 
   case 98:
 
     {
         context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str(), "");
         context->recover();
 
         TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
         (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
         (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
-    }
+    ;}
     break;
 
   case 99:
 
     {
         TType type = TType((yyvsp[(1) - (5)].interm.type));
         int size;
         if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
@@ -3440,17 +3541,17 @@ yyreduce:
 
             (yyvsp[(1) - (5)].interm.type).setArray(true, size);
             TVariable* variable = 0;
             if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
                 context->recover();
             if (variable && symbol)
                 symbol->setId(variable->getUniqueId());
         }
-    }
+    ;}
     break;
 
   case 100:
 
     {
         if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
             context->recover();
 
@@ -3464,39 +3565,39 @@ yyreduce:
             if(intermNode)
                 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
             else
                 (yyval.interm).intermAggregate = 0;
         } else {
             context->recover();
             (yyval.interm).intermAggregate = 0;
         }
-    }
+    ;}
     break;
 
   case 101:
 
     {
         VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
         (yyval.interm).qualifier = EvqInvariantVaryingOut;
         (yyval.interm).intermAggregate = 0;
-    }
+    ;}
     break;
 
   case 102:
 
     {
         (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
 
         if ((yyvsp[(1) - (1)].interm.type).array) {
             context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array", "");
             context->recover();
             (yyvsp[(1) - (1)].interm.type).setArray(false);
         }
-    }
+    ;}
     break;
 
   case 103:
 
     {
         if ((yyvsp[(2) - (2)].interm.type).array) {
             context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array", "");
             context->recover();
@@ -3510,348 +3611,348 @@ yyreduce:
         }
         if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
             ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
             context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
             context->recover();
         }
         (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
         (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
-    }
+    ;}
     break;
 
   case 104:
 
     {
         (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
-    }
+    ;}
     break;
 
   case 105:
 
     {
         VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
         if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
             context->recover();
         (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
-    }
+    ;}
     break;
 
   case 106:
 
     {
         if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
             context->recover();
         if (context->shaderType == SH_VERTEX_SHADER)
             (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
         else
             (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
-    }
+    ;}
     break;
 
   case 107:
 
     {
         if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
             context->recover();
         if (context->shaderType == SH_VERTEX_SHADER)
             (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
         else
             (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
-    }
+    ;}
     break;
 
   case 108:
 
     {
         if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
             context->recover();
         (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
-    }
+    ;}
     break;
 
   case 109:
 
     {
         (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
 
         if ((yyval.interm.type).precision == EbpUndefined) {
             (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
             if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
                 context->recover();
             }
         }
-    }
+    ;}
     break;
 
   case 110:
 
     {
         (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
         (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
-    }
+    ;}
     break;
 
   case 111:
 
     {
         (yyval.interm.precision) = EbpHigh;
-    }
+    ;}
     break;
 
   case 112:
 
     {
         (yyval.interm.precision) = EbpMedium;
-    }
+    ;}
     break;
 
   case 113:
 
     {
         (yyval.interm.precision) = EbpLow;
-    }
+    ;}
     break;
 
   case 114:
 
     {
         (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
-    }
+    ;}
     break;
 
   case 115:
 
     {
         (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
 
         if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
             context->recover();
         else {
             int size;
             if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
                 context->recover();
             (yyval.interm.type).setArray(true, size);
         }
-    }
+    ;}
     break;
 
   case 116:
 
     {
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
-    }
+    ;}
     break;
 
   case 117:
 
     {
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
-    }
+    ;}
     break;
 
   case 118:
 
     {
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
-    }
+    ;}
     break;
 
   case 119:
 
     {
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
-    }
+    ;}
     break;
 
   case 120:
 
     {
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
         (yyval.interm.type).setAggregate(2);
-    }
+    ;}
     break;
 
   case 121:
 
     {
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
         (yyval.interm.type).setAggregate(3);
-    }
+    ;}
     break;
 
   case 122:
 
     {
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
         (yyval.interm.type).setAggregate(4);
-    }
+    ;}
     break;
 
   case 123:
 
     {
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
         (yyval.interm.type).setAggregate(2);
-    }
+    ;}
     break;
 
   case 124:
 
     {
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
         (yyval.interm.type).setAggregate(3);
-    }
+    ;}
     break;
 
   case 125:
 
     {
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
         (yyval.interm.type).setAggregate(4);
-    }
+    ;}
     break;
 
   case 126:
 
     {
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
         (yyval.interm.type).setAggregate(2);
-    }
+    ;}
     break;
 
   case 127:
 
     {
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
         (yyval.interm.type).setAggregate(3);
-    }
+    ;}
     break;
 
   case 128:
 
     {
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
         (yyval.interm.type).setAggregate(4);
-    }
+    ;}
     break;
 
   case 129:
 
     {
         FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
         (yyval.interm.type).setAggregate(2, true);
-    }
+    ;}
     break;
 
   case 130:
 
     {
         FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
         (yyval.interm.type).setAggregate(3, true);
-    }
+    ;}
     break;
 
   case 131:
 
     {
         FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
         (yyval.interm.type).setAggregate(4, true);
-    }
+    ;}
     break;
 
   case 132:
 
     {
         FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
-    }
+    ;}
     break;
 
   case 133:
 
     {
         FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
-    }
+    ;}
     break;
 
   case 134:
 
     {
         if (!context->supportsExtension("GL_OES_EGL_image_external")) {
             context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", "");
             context->recover();
         }
         FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
-    }
+    ;}
     break;
 
   case 135:
 
     {
         if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
             context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "sampler2DRect", "");
             context->recover();
         }
         FRAG_VERT_ONLY("sampler2DRect", (yyvsp[(1) - (1)].lex).line);
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yyvsp[(1) - (1)].lex).line);
-    }
+    ;}
     break;
 
   case 136:
 
     {
         FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
         (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
         (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
-    }
+    ;}
     break;
 
   case 137:
 
     {
         //
         // This is for user defined type names.  The lexical phase looked up the
         // type.
         //
         TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
         TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
         (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
         (yyval.interm.type).userDef = &structure;
-    }
+    ;}
     break;
 
   case 138:
 
-    { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
+    { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); ;}
     break;
 
   case 139:
 
     {
         if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
             context->recover();
 
@@ -3859,55 +3960,55 @@ yyreduce:
         TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
         if (! context->symbolTable.insert(*userTypeDef)) {
             context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
             context->recover();
         }
         (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
         (yyval.interm.type).userDef = structure;
         context->exitStructDeclaration();
-    }
+    ;}
     break;
 
   case 140:
 
-    { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
+    { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); ;}
     break;
 
   case 141:
 
     {
         TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
         (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
         (yyval.interm.type).userDef = structure;
         context->exitStructDeclaration();
-    }
+    ;}
     break;
 
   case 142:
 
     {
         (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
-    }
+    ;}
     break;
 
   case 143:
 
     {
         (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
         for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
             for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
                 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
                     context->error((*(yyvsp[(2) - (2)].interm.typeList))[i].line, "duplicate field name in structure:", "struct", (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName().c_str());
                     context->recover();
                 }
             }
             (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
         }
-    }
+    ;}
     break;
 
   case 144:
 
     {
         (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
 
         if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
@@ -3934,218 +4035,218 @@ yyreduce:
                 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
                 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
             }
 
             if (context->structNestingErrorCheck((yyvsp[(1) - (3)].interm.type).line, *type)) {
                 context->recover();
             }
         }
-    }
+    ;}
     break;
 
   case 145:
 
     {
         (yyval.interm.typeList) = NewPoolTTypeList();
         (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
-    }
+    ;}
     break;
 
   case 146:
 
     {
         (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
-    }
+    ;}
     break;
 
   case 147:
 
     {
         if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
             context->recover();
 
         (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
         (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
         (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
-    }
+    ;}
     break;
 
   case 148:
 
     {
         if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
             context->recover();
 
         (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
         (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
         (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
 
         int size;
         if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
             context->recover();
         (yyval.interm.typeLine).type->setArraySize(size);
-    }
+    ;}
     break;
 
   case 149:
 
-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
+    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
     break;
 
   case 150:
 
-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
+    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
     break;
 
   case 151:
 
-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
+    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); ;}
     break;
 
   case 152:
 
-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
+    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
     break;
 
   case 153:
 
-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
+    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
     break;
 
   case 154:
 
-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
+    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
     break;
 
   case 155:
 
-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
+    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
     break;
 
   case 156:
 
-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
+    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
     break;
 
   case 157:
 
-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
+    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
     break;
 
   case 158:
 
-    { (yyval.interm.intermAggregate) = 0; }
+    { (yyval.interm.intermAggregate) = 0; ;}
     break;
 
   case 159:
 
-    { context->symbolTable.push(); }
+    { context->symbolTable.push(); ;}
     break;
 
   case 160:
 
-    { context->symbolTable.pop(); }
+    { context->symbolTable.pop(); ;}
     break;
 
   case 161:
 
     {
         if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
             (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
             (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
         }
         (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
-    }
+    ;}
     break;
 
   case 162:
 
-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
+    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
     break;
 
   case 163:
 
-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
+    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
     break;
 
   case 164:
 
     {
         (yyval.interm.intermNode) = 0;
-    }
+    ;}
     break;
 
   case 165:
 
     {
         if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
             (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
             (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
         }
         (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
-    }
+    ;}
     break;
 
   case 166:
 
     {
         (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
-    }
+    ;}
     break;
 
   case 167:
 
     {
         (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0);
-    }
+    ;}
     break;
 
   case 168:
 
-    { (yyval.interm.intermNode) = 0; }
+    { (yyval.interm.intermNode) = 0; ;}
     break;
 
   case 169:
 
-    { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
+    { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); ;}
     break;
 
   case 170:
 
     {
         if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
             context->recover();
         (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line);
-    }
+    ;}
     break;
 
   case 171:
 
     {
         (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
         (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
-    }
+    ;}
     break;
 
   case 172:
 
     {
         (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
         (yyval.interm.nodePair).node2 = 0;
-    }
+    ;}
     break;
 
   case 173:
 
     {
         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
         if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
             context->recover();
-    }
+    ;}
     break;
 
   case 174:
 
     {
         TIntermNode* intermNode;
         if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
             context->recover();
@@ -4153,191 +4254,191 @@ yyreduce:
             context->recover();
 
         if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
             (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
         else {
             context->recover();
             (yyval.interm.intermTypedNode) = 0;
         }
-    }
+    ;}
     break;
 
   case 175:
 
-    { context->symbolTable.push(); ++context->loopNestingLevel; }
+    { context->symbolTable.push(); ++context->loopNestingLevel; ;}
     break;
 
   case 176:
 
     {
         context->symbolTable.pop();
         (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[(4) - (6)].interm.intermTypedNode), 0, (yyvsp[(6) - (6)].interm.intermNode), (yyvsp[(1) - (6)].lex).line);
         --context->loopNestingLevel;
-    }
+    ;}
     break;
 
   case 177:
 
-    { ++context->loopNestingLevel; }
+    { ++context->loopNestingLevel; ;}
     break;
 
   case 178:
 
     {
         if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
             context->recover();
 
         (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[(6) - (8)].interm.intermTypedNode), 0, (yyvsp[(3) - (8)].interm.intermNode), (yyvsp[(4) - (8)].lex).line);
         --context->loopNestingLevel;
-    }
+    ;}
     break;
 
   case 179:
 
-    { context->symbolTable.push(); ++context->loopNestingLevel; }
+    { context->symbolTable.push(); ++context->loopNestingLevel; ;}
     break;
 
   case 180:
 
     {
         context->symbolTable.pop();
         (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopFor, (yyvsp[(4) - (7)].interm.intermNode), reinterpret_cast<TIntermTyped*>((yyvsp[(5) - (7)].interm.nodePair).node1), reinterpret_cast<TIntermTyped*>((yyvsp[(5) - (7)].interm.nodePair).node2), (yyvsp[(7) - (7)].interm.intermNode), (yyvsp[(1) - (7)].lex).line);
         --context->loopNestingLevel;
-    }
+    ;}
     break;
 
   case 181:
 
     {
         (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
-    }
+    ;}
     break;
 
   case 182:
 
     {
         (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
-    }
+    ;}
     break;
 
   case 183:
 
     {
         (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
-    }
+    ;}
     break;
 
   case 184:
 
     {
         (yyval.interm.intermTypedNode) = 0;
-    }
+    ;}
     break;
 
   case 185:
 
     {
         (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
         (yyval.interm.nodePair).node2 = 0;
-    }
+    ;}
     break;
 
   case 186:
 
     {
         (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
         (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
-    }
+    ;}
     break;
 
   case 187:
 
     {
         if (context->loopNestingLevel <= 0) {
             context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "", "");
             context->recover();
         }
         (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
-    }
+    ;}
     break;
 
   case 188:
 
     {
         if (context->loopNestingLevel <= 0) {
             context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "", "");
             context->recover();
         }
         (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
-    }
+    ;}
     break;
 
   case 189:
 
     {
         (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
         if (context->currentFunctionType->getBasicType() != EbtVoid) {
             context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return", "");
             context->recover();
         }
-    }
+    ;}
     break;
 
   case 190:
 
     {
         (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
         context->functionReturnsValue = true;
         if (context->currentFunctionType->getBasicType() == EbtVoid) {
             context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return", "");
             context->recover();
         } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
             context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return", "");
             context->recover();
         }
-    }
+    ;}
     break;
 
   case 191:
 
     {
         FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
         (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
-    }
+    ;}
     break;
 
   case 192:
 
     {
         (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
         context->treeRoot = (yyval.interm.intermNode);
-    }
+    ;}
     break;
 
   case 193:
 
     {
         (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
         context->treeRoot = (yyval.interm.intermNode);
-    }
+    ;}
     break;
 
   case 194:
 
     {
         (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
-    }
+    ;}
     break;
 
   case 195:
 
     {
         (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
-    }
+    ;}
     break;
 
   case 196:
 
     {
         TFunction* function = (yyvsp[(1) - (1)].interm).function;
         TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
         //
@@ -4412,17 +4513,17 @@ yyreduce:
                                                (yyvsp[(1) - (1)].interm).line);
             } else {
                 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
             }
         }
         context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
         (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
         context->loopNestingLevel = 0;
-    }
+    ;}
     break;
 
   case 197:
 
     {
         //?? Check that all paths return a value if return type != void ?
         //   May be best done as post process phase on intermediate code
         if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
@@ -4438,31 +4539,33 @@ yyreduce:
         // store the pragma information for debug and optimize and other vendor specific
         // information. This information can be queried from the parse tree
         (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->contextPragma.optimize);
         (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->contextPragma.debug);
         (yyval.interm.intermNode)->getAsAggregate()->addToPragmaTable(context->contextPragma.pragmaTable);
 
         if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
             (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
-    }
+    ;}
     break;
 
 
+/* Line 1267 of yacc.c.  */
 
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
 
   YYPOPSTACK (yylen);
   yylen = 0;
   YY_STACK_PRINT (yyss, yyssp);
 
   *++yyvsp = yyval;
 
+
   /* Now `shift' the result of the reduction.  Determine what state
      that goes to, based on the state we popped back to and the rule
      number reduced by.  */
 
   yyn = yyr1[yyn];
 
   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
@@ -4517,34 +4620,34 @@ yyerrlab:
       }
 #endif
     }
 
 
 
   if (yyerrstatus == 3)
     {
-      /* If just tried and failed to reuse lookahead token after an
+      /* If just tried and failed to reuse look-ahead token after an
 	 error, discard it.  */
 
       if (yychar <= YYEOF)
 	{
 	  /* Return failure if at end of input.  */
 	  if (yychar == YYEOF)
 	    YYABORT;
 	}
       else
 	{
 	  yydestruct ("Error: discarding",
 		      yytoken, &yylval, context);
 	  yychar = YYEMPTY;
 	}
     }
 
-  /* Else will try to reuse lookahead token after shifting the error
+  /* Else will try to reuse look-ahead token after shifting the error
      token.  */
   goto yyerrlab1;
 
 
 /*---------------------------------------------------.
 | yyerrorlab -- error raised explicitly by YYERROR.  |
 `---------------------------------------------------*/
 yyerrorlab:
@@ -4591,16 +4694,19 @@ yyerrlab1:
 
       yydestruct ("Error: popping",
 		  yystos[yystate], yyvsp, context);
       YYPOPSTACK (1);
       yystate = *yyssp;
       YY_STACK_PRINT (yyss, yyssp);
     }
 
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
   *++yyvsp = yylval;
 
 
   /* Shift the error token.  */
   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
 
   yystate = yyn;
   goto yynewstate;
@@ -4615,28 +4721,28 @@ yyacceptlab:
 
 /*-----------------------------------.
 | yyabortlab -- YYABORT comes here.  |
 `-----------------------------------*/
 yyabortlab:
   yyresult = 1;
   goto yyreturn;
 
-#if !defined(yyoverflow) || YYERROR_VERBOSE
+#ifndef yyoverflow
 /*-------------------------------------------------.
 | yyexhaustedlab -- memory exhaustion comes here.  |
 `-------------------------------------------------*/
 yyexhaustedlab:
   yyerror (context, YY_("memory exhausted"));
   yyresult = 2;
   /* Fall through.  */
 #endif
 
 yyreturn:
-  if (yychar != YYEMPTY)
+  if (yychar != YYEOF && yychar != YYEMPTY)
      yydestruct ("Cleanup: discarding lookahead",
 		 yytoken, &yylval, context);
   /* Do not reclaim the symbols of the rule which action triggered
      this YYABORT or YYACCEPT.  */
   YYPOPSTACK (yylen);
   YY_STACK_PRINT (yyss, yyssp);
   while (yyssp != yyss)
     {
--- a/gfx/angle/src/compiler/glslang_tab.h
+++ b/gfx/angle/src/compiler/glslang_tab.h
@@ -1,43 +1,43 @@
-
-/* A Bison parser, made by GNU Bison 2.4.1.  */
+/* A Bison parser, made by GNU Bison 2.3.  */
 
 /* Skeleton interface for Bison's Yacc-like parsers in C
-   
-      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
-   
-   This program is free software: you can redistribute it and/or modify
+
+   This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-   
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
 
 /* As a special exception, you may create a larger work that contains
    part or all of the Bison parser skeleton and distribute that work
    under terms of your choice, so long as that work isn't itself a
    parser generator using the skeleton or a modified version thereof
    as a parser skeleton.  Alternatively, if you modify or redistribute
    the parser skeleton itself, you may (at your option) remove this
    special exception, which will cause the skeleton and the resulting
    Bison output files to be licensed under the GNU General Public
    License without this special exception.
-   
+
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
-
 /* Tokens.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
    /* Put the tokens into the symbol table, so that GDB and other debuggers
       know about them.  */
    enum yytokentype {
      INVARIANT = 258,
      HIGH_PRECISION = 259,
@@ -129,24 +129,118 @@
      LEFT_ANGLE = 345,
      RIGHT_ANGLE = 346,
      VERTICAL_BAR = 347,
      CARET = 348,
      AMPERSAND = 349,
      QUESTION = 350
    };
 #endif
+/* Tokens.  */
+#define INVARIANT 258
+#define HIGH_PRECISION 259
+#define MEDIUM_PRECISION 260
+#define LOW_PRECISION 261
+#define PRECISION 262
+#define ATTRIBUTE 263
+#define CONST_QUAL 264
+#define BOOL_TYPE 265
+#define FLOAT_TYPE 266
+#define INT_TYPE 267
+#define BREAK 268
+#define CONTINUE 269
+#define DO 270
+#define ELSE 271
+#define FOR 272
+#define IF 273
+#define DISCARD 274
+#define RETURN 275
+#define BVEC2 276
+#define BVEC3 277
+#define BVEC4 278
+#define IVEC2 279
+#define IVEC3 280
+#define IVEC4 281
+#define VEC2 282
+#define VEC3 283
+#define VEC4 284
+#define MATRIX2 285
+#define MATRIX3 286
+#define MATRIX4 287
+#define IN_QUAL 288
+#define OUT_QUAL 289
+#define INOUT_QUAL 290
+#define UNIFORM 291
+#define VARYING 292
+#define STRUCT 293
+#define VOID_TYPE 294
+#define WHILE 295
+#define SAMPLER2D 296
+#define SAMPLERCUBE 297
+#define SAMPLER_EXTERNAL_OES 298
+#define SAMPLER2DRECT 299
+#define IDENTIFIER 300
+#define TYPE_NAME 301
+#define FLOATCONSTANT 302
+#define INTCONSTANT 303
+#define BOOLCONSTANT 304
+#define FIELD_SELECTION 305
+#define LEFT_OP 306
+#define RIGHT_OP 307
+#define INC_OP 308
+#define DEC_OP 309
+#define LE_OP 310
+#define GE_OP 311
+#define EQ_OP 312
+#define NE_OP 313
+#define AND_OP 314
+#define OR_OP 315
+#define XOR_OP 316
+#define MUL_ASSIGN 317
+#define DIV_ASSIGN 318
+#define ADD_ASSIGN 319
+#define MOD_ASSIGN 320
+#define LEFT_ASSIGN 321
+#define RIGHT_ASSIGN 322
+#define AND_ASSIGN 323
+#define XOR_ASSIGN 324
+#define OR_ASSIGN 325
+#define SUB_ASSIGN 326
+#define LEFT_PAREN 327
+#define RIGHT_PAREN 328
+#define LEFT_BRACKET 329
+#define RIGHT_BRACKET 330
+#define LEFT_BRACE 331
+#define RIGHT_BRACE 332
+#define DOT 333
+#define COMMA 334
+#define COLON 335
+#define EQUAL 336
+#define SEMICOLON 337
+#define BANG 338
+#define DASH 339
+#define TILDE 340
+#define PLUS 341
+#define STAR 342
+#define SLASH 343
+#define PERCENT 344
+#define LEFT_ANGLE 345
+#define RIGHT_ANGLE 346
+#define VERTICAL_BAR 347
+#define CARET 348
+#define AMPERSAND 349
+#define QUESTION 350
+
 
 
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
+
 {
-
-
     struct {
         TSourceLoc line;
         union {
             TString *string;
             float f;
             int i;
             bool b;
         };
@@ -166,20 +260,19 @@ typedef union YYSTYPE
             TPrecision precision;
             TQualifier qualifier;
             TFunction* function;
             TParameter param;
             TTypeLine typeLine;
             TTypeList* typeList;
         };
     } interm;
-
-
+}
+/* Line 1489 of yacc.c.  */
 
-} YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
+	YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
 #endif
 
 
 
-
--- a/gfx/angle/src/compiler/osinclude.h
+++ b/gfx/angle/src/compiler/osinclude.h
@@ -11,17 +11,18 @@
 // This file contains contains os-specific datatypes and
 // declares any os-specific functions.
 //
 
 #if defined(_WIN32) || defined(_WIN64)
 #define ANGLE_OS_WIN
 #elif defined(__APPLE__) || defined(__linux__) || \
       defined(__FreeBSD__) || defined(__OpenBSD__) || \
-      defined(__sun) || defined(ANDROID)
+      defined(__sun) || defined(ANDROID) || \
+      defined(__GLIBC__) || defined(__GNU__)
 #define ANGLE_OS_POSIX
 #else
 #error Unsupported platform.
 #endif
 
 #if defined(ANGLE_USE_NSPR)
 #include "prthread.h"
 #elif defined(ANGLE_OS_WIN)
deleted file mode 100644
--- a/gfx/angle/src/libEGL/Display.cpp
+++ b/gfx/angle/src/libEGL/Display.cpp
@@ -11,16 +11,17 @@
 #include "libEGL/Display.h"
 
 #include <algorithm>
 #include <map>
 #include <vector>
 
 #include "common/debug.h"
 #include "libGLESv2/mathutil.h"
+#include "libGLESv2/utilities.h"
 
 #include "libEGL/main.h"
 
 // Can also be enabled by defining FORCE_REF_RAST in the project's predefined macros
 #define REF_RAST 0
 
 // The "Debug This Pixel..." feature in PIX often fails when using the
 // D3D9Ex interfaces.  In order to get debug pixel to work on a Vista/Win 7
@@ -297,16 +298,22 @@ void Display::terminate()
         destroySurface(*mSurfaceSet.begin());
     }
 
     while (!mContextSet.empty())
     {
         destroyContext(*mContextSet.begin());
     }
 
+    while (!mEventQueryPool.empty())
+    {
+        mEventQueryPool.back()->Release();
+        mEventQueryPool.pop_back();
+    }
+
     if (mDevice)
     {
         // If the device is lost, reset it first to prevent leaving the driver in an unstable state
         if (testDeviceLost())
         {
             resetDevice();
         }
 
@@ -718,16 +725,22 @@ bool Display::restoreLostDevice()
     }
  
     // Release surface resources to make the Reset() succeed
     for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++)
     {
         (*surface)->release();
     }
 
+    while (!mEventQueryPool.empty())
+    {
+        mEventQueryPool.back()->Release();
+        mEventQueryPool.pop_back();
+    }
+
     if (!resetDevice())
     {
         return false;
     }
 
     // Restore any surfaces that may have been lost
     for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++)
     {
@@ -863,16 +876,86 @@ bool Display::testDeviceResettable()
       case D3DERR_DEVICENOTRESET:
       case D3DERR_DEVICEHUNG:
         return true;
       default:
         return false;
     }
 }
 
+void Display::sync(bool block)
+{
+    HRESULT result;
+
+    IDirect3DQuery9* query = allocateEventQuery();
+    if (!query)
+    {
+        return;
+    }
+
+    result = query->Issue(D3DISSUE_END);
+    ASSERT(SUCCEEDED(result));
+
+    do
+    {
+        result = query->GetData(NULL, 0, D3DGETDATA_FLUSH);
+
+        if(block && result == S_FALSE)
+        {
+            // Keep polling, but allow other threads to do something useful first
+            Sleep(0);
+            // explicitly check for device loss
+            // some drivers seem to return S_FALSE even if the device is lost
+            // instead of D3DERR_DEVICELOST like they should
+            if (testDeviceLost())
+            {
+                result = D3DERR_DEVICELOST;
+            }
+        }
+    }
+    while(block && result == S_FALSE);
+
+    freeEventQuery(query);
+
+    if (isDeviceLostError(result))
+    {
+        notifyDeviceLost();
+    }
+}
+
+IDirect3DQuery9* Display::allocateEventQuery()
+{
+    IDirect3DQuery9 *query = NULL;
+
+    if (mEventQueryPool.empty())
+    {
+        HRESULT result = mDevice->CreateQuery(D3DQUERYTYPE_EVENT, &query);
+        ASSERT(SUCCEEDED(result));
+    }
+    else
+    {
+        query = mEventQueryPool.back();
+        mEventQueryPool.pop_back();
+    }
+
+    return query;
+}
+
+void Display::freeEventQuery(IDirect3DQuery9* query)
+{
+    if (mEventQueryPool.size() > 1000)
+    {
+        query->Release();
+    }
+    else
+    {
+        mEventQueryPool.push_back(query);
+    }
+}
+
 void Display::getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray)
 {
     for (int multiSampleIndex = 0; multiSampleIndex <= D3DMULTISAMPLE_16_SAMPLES; multiSampleIndex++)
     {
         HRESULT result = mD3d9->CheckDeviceMultiSampleType(mAdapter, mDeviceType, format,
                                                            TRUE, (D3DMULTISAMPLE_TYPE)multiSampleIndex, NULL);
 
         multiSampleArray[multiSampleIndex] = SUCCEEDED(result);
@@ -913,17 +996,17 @@ bool Display::getFloat32TextureSupport(b
                  SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER,
                                                     D3DRTYPE_CUBETEXTURE, D3DFMT_A32B32G32R32F));
     
     *renderable = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET,
                                                      D3DRTYPE_TEXTURE, D3DFMT_A32B32G32R32F))&&
                   SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET,
                                                      D3DRTYPE_CUBETEXTURE, D3DFMT_A32B32G32R32F));
 
-    if (!filtering && !renderable)
+    if (!*filtering && !*renderable)
     {
         return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, 
                                                   D3DRTYPE_TEXTURE, D3DFMT_A32B32G32R32F)) &&
                SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0,
                                                   D3DRTYPE_CUBETEXTURE, D3DFMT_A32B32G32R32F));
     }
     else
     {
@@ -941,17 +1024,17 @@ bool Display::getFloat16TextureSupport(b
                  SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER,
                                                     D3DRTYPE_CUBETEXTURE, D3DFMT_A16B16G16R16F));
     
     *renderable = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET, 
                                                     D3DRTYPE_TEXTURE, D3DFMT_A16B16G16R16F)) &&
                  SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET,
                                                     D3DRTYPE_CUBETEXTURE, D3DFMT_A16B16G16R16F));
 
-    if (!filtering && !renderable)
+    if (!*filtering && !*renderable)
     {
         return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, 
                                                   D3DRTYPE_TEXTURE, D3DFMT_A16B16G16R16F)) &&
                SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0,
                                                   D3DRTYPE_CUBETEXTURE, D3DFMT_A16B16G16R16F));
     }
     else
     {
@@ -1006,24 +1089,26 @@ D3DPOOL Display::getTexturePool(bool ren
         }
     }
 
     return D3DPOOL_DEFAULT;
 }
 
 bool Display::getEventQuerySupport()
 {
-    IDirect3DQuery9 *query;
-    HRESULT result = mDevice->CreateQuery(D3DQUERYTYPE_EVENT, &query);
-    if (SUCCEEDED(result))
+    IDirect3DQuery9 *query = allocateEventQuery();
+    if (query)
     {
-        query->Release();
+        freeEventQuery(query);
+        return true;
     }
-
-    return result != D3DERR_NOTAVAILABLE;
+    else
+    {
+        return false;
+    }
 }
 
 D3DPRESENT_PARAMETERS Display::getDefaultPresentParameters()
 {
     D3DPRESENT_PARAMETERS presentParameters = {0};
 
     // The default swap chain is never actually used. Surface will create a new swap chain with the proper parameters.
     presentParameters.AutoDepthStencilFormat = D3DFMT_UNKNOWN;
@@ -1104,9 +1189,30 @@ bool Display::getVertexTextureSupport() 
 
 bool Display::getNonPower2TextureSupport() const
 {
     return !(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_POW2) &&
            !(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP_POW2) &&
            !(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL);
 }
 
+bool Display::getOcclusionQuerySupport() const
+{
+    if (!isInitialized())
+    {
+        return false;
+    }
+
+    IDirect3DQuery9 *query = NULL;
+    HRESULT result = mDevice->CreateQuery(D3DQUERYTYPE_OCCLUSION, &query);
+    
+    if (SUCCEEDED(result) && query)
+    {
+        query->Release();
+        return true;
+    }
+    else
+    {
+        return false;
+    }
 }
+
+}
--- a/gfx/angle/src/libEGL/Display.h
+++ b/gfx/angle/src/libEGL/Display.h
@@ -13,16 +13,17 @@
 
 #ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN
 #endif
 #include <windows.h>
 #include <d3d9.h>
 
 #include <set>
+#include <vector>
 
 #include "libGLESv2/Context.h"
 
 #include "libEGL/Config.h"
 #include "libEGL/Surface.h"
 
 namespace egl
 {
@@ -58,27 +59,31 @@ class Display
     EGLint getMinSwapInterval();
     EGLint getMaxSwapInterval();
 
     virtual IDirect3DDevice9 *getDevice();
     virtual D3DCAPS9 getDeviceCaps();
     virtual D3DADAPTER_IDENTIFIER9 *getAdapterIdentifier();
     virtual bool testDeviceLost();
     virtual bool testDeviceResettable();
+    virtual void sync(bool block);
+    virtual IDirect3DQuery9* allocateEventQuery();
+    virtual void freeEventQuery(IDirect3DQuery9* query);
     virtual void getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray);
     virtual bool getDXT1TextureSupport();
     virtual bool getDXT3TextureSupport();
     virtual bool getDXT5TextureSupport();
     virtual bool getEventQuerySupport();
     virtual bool getFloat32TextureSupport(bool *filtering, bool *renderable);
     virtual bool getFloat16TextureSupport(bool *filtering, bool *renderable);
     virtual bool getLuminanceTextureSupport();
     virtual bool getLuminanceAlphaTextureSupport();
     virtual bool getVertexTextureSupport() const;
     virtual bool getNonPower2TextureSupport() const;
+    virtual bool getOcclusionQuerySupport() const;
     virtual D3DPOOL getBufferPool(DWORD usage) const;
     virtual D3DPOOL getTexturePool(bool renderable) const;
 
     virtual void notifyDeviceLost();
     bool isDeviceLost();
 
     bool isD3d9ExDevice() { return mD3d9Ex != NULL; }
     const char *getExtensionString() const;
@@ -98,16 +103,20 @@ class Display
     HMODULE mD3d9Module;
     
     UINT mAdapter;
     D3DDEVTYPE mDeviceType;
     IDirect3D9 *mD3d9;  // Always valid after successful initialization.
     IDirect3D9Ex *mD3d9Ex;  // Might be null if D3D9Ex is not supported.
     IDirect3DDevice9 *mDevice;
     IDirect3DDevice9Ex *mDeviceEx;  // Might be null if D3D9Ex is not supported.
+
+    // A pool of event queries that are currently unused.
+    std::vector<IDirect3DQuery9*> mEventQueryPool;
+
     D3DCAPS9 mDeviceCaps;
     D3DADAPTER_IDENTIFIER9 mAdapterIdentifier;
     HWND mDeviceWindow;
 
     bool mSceneStarted;
     EGLint mMaxSwapInterval;
     EGLint mMinSwapInterval;
     bool mSoftwareDevice;
--- a/gfx/angle/src/libEGL/Makefile.in
+++ b/gfx/angle/src/libEGL/Makefile.in
@@ -77,17 +77,16 @@ CPPSRCS = \
   Compiler.cpp \
   DetectRecursion.cpp \
   InfoSink.cpp \
   Initialize.cpp \
   InitializeDll.cpp \
   Intermediate.cpp \
   intermOut.cpp \
   IntermTraverse.cpp \
-  MozAngleLink.cpp \
   parseConst.cpp \
   ParseHelper.cpp \
   PoolAlloc.cpp \
   QualifierAlive.cpp \
   RemoveTree.cpp \
   ShaderLang.cpp \
   SymbolTable.cpp \
   VariableInfo.cpp \
@@ -135,16 +134,17 @@ DEFINES += -DANGLE_DISABLE_TRACE
 DEFINES += -DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0
 
 ifndef MOZ_DEBUG
 DEFINES += -D_SECURE_SCL=0
 endif
 
 CPPSRCS += \
   debug.cpp \
+  RefCountObject.cpp \
   Config.cpp \
   Display.cpp \
   libEGL.cpp \
   main.cpp \
   Surface.cpp \
   $(NULL)
 
 DEFFILE = $(srcdir)/libEGL.def
--- a/gfx/angle/src/libEGL/libEGL.vcproj
+++ b/gfx/angle/src/libEGL/libEGL.vcproj
@@ -48,16 +48,17 @@
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBEGL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="1"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="4"
+				WarnAsError="true"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
 			/>
 			<Tool
 				Name="VCResourceCompilerTool"
 			/>
 			<Tool
@@ -127,16 +128,17 @@
 				InlineFunctionExpansion="2"
 				AdditionalIncludeDirectories="$(ProjectDir)/..; $(ProjectDir)/../../include"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBEGL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0"
 				RuntimeLibrary="0"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="3"
+				WarnAsError="true"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
 			/>
 			<Tool
 				Name="VCResourceCompilerTool"
 			/>
 			<Tool
@@ -209,16 +211,17 @@
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBEGL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="1"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="3"
+				WarnAsError="true"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
 			/>
 			<Tool
 				Name="VCResourceCompilerTool"
 			/>
 			<Tool
@@ -289,16 +292,17 @@
 				InlineFunctionExpansion="2"
 				AdditionalIncludeDirectories="$(ProjectDir)/..; $(ProjectDir)/../../include"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBEGL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0"
 				RuntimeLibrary="0"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="3"
+				WarnAsError="true"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
 			/>
 			<Tool
 				Name="VCResourceCompilerTool"
 			/>
 			<Tool
--- a/gfx/angle/src/libGLESv2/Buffer.h
+++ b/gfx/angle/src/libGLESv2/Buffer.h
@@ -13,17 +13,17 @@
 
 #include <cstddef>
 #include <vector>
 
 #define GL_APICALL
 #include <GLES2/gl2.h>
 
 #include "common/angleutils.h"
-#include "libGLESv2/RefCountObject.h"
+#include "common/RefCountObject.h"
 
 namespace gl
 {
 class StaticVertexBuffer;
 class StaticIndexBuffer;
 
 class Buffer : public RefCountObject
 {
--- a/gfx/angle/src/libGLESv2/Context.cpp
+++ b/gfx/angle/src/libGLESv2/Context.cpp
@@ -17,16 +17,17 @@
 #include "libGLESv2/mathutil.h"
 #include "libGLESv2/utilities.h"
 #include "libGLESv2/Blit.h"
 #include "libGLESv2/ResourceManager.h"
 #include "libGLESv2/Buffer.h"
 #include "libGLESv2/Fence.h"
 #include "libGLESv2/FrameBuffer.h"
 #include "libGLESv2/Program.h"
+#include "libGLESv2/Query.h"
 #include "libGLESv2/RenderBuffer.h"
 #include "libGLESv2/Shader.h"
 #include "libGLESv2/Texture.h"
 #include "libGLESv2/VertexDataManager.h"
 #include "libGLESv2/IndexDataManager.h"
 
 #undef near
 #undef far
@@ -165,16 +166,17 @@ Context::Context(const egl::Config *conf
     mResetStatus = GL_NO_ERROR;
     mResetStrategy = (notifyResets ? GL_LOSE_CONTEXT_ON_RESET_EXT : GL_NO_RESET_NOTIFICATION_EXT);
     mRobustAccess = robustAccess;
 
     mSupportsDXT1Textures = false;
     mSupportsDXT3Textures = false;
     mSupportsDXT5Textures = false;
     mSupportsEventQueries = false;
+    mSupportsOcclusionQueries = false;
     mNumCompressedTextureFormats = 0;
     mMaxSupportedSamples = 0;
     mMaskedClearSavedState = NULL;
     markAllStateDirty();
 }
 
 Context::~Context()
 {
@@ -193,16 +195,21 @@ Context::~Context()
         deleteFramebuffer(mFramebufferMap.begin()->first);
     }
 
     while (!mFenceMap.empty())
     {
         deleteFence(mFenceMap.begin()->first);
     }
 
+    while (!mQueryMap.empty())
+    {
+        deleteQuery(mQueryMap.begin()->first);
+    }
+
     while (!mMultiSampleSupport.empty())
     {
         delete [] mMultiSampleSupport.begin()->second;
         mMultiSampleSupport.erase(mMultiSampleSupport.begin());
     }
 
     for (int type = 0; type < TEXTURE_TYPE_COUNT; type++)
     {
@@ -217,16 +224,21 @@ Context::~Context()
         mIncompleteTextures[type].set(NULL);
     }
 
     for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
     {
         mState.vertexAttribute[i].mBoundBuffer.set(NULL);
     }
 
+    for (int i = 0; i < QUERY_TYPE_COUNT; i++)
+    {
+        mState.activeQuery[i].set(NULL);
+    }
+
     mState.arrayBuffer.set(NULL);
     mState.elementArrayBuffer.set(NULL);
     mState.renderbuffer.set(NULL);
 
     mTexture2DZero.set(NULL);
     mTextureCubeMapZero.set(NULL);
 
     delete mVertexDataManager;
@@ -289,16 +301,17 @@ void Context::makeCurrent(egl::Display *
                     max = j;
                 }
             }
         }
 
         mMaxSupportedSamples = max;
 
         mSupportsEventQueries = mDisplay->getEventQuerySupport();
+        mSupportsOcclusionQueries = mDisplay->getOcclusionQuerySupport();
         mSupportsDXT1Textures = mDisplay->getDXT1TextureSupport();
         mSupportsDXT3Textures = mDisplay->getDXT3TextureSupport();
         mSupportsDXT5Textures = mDisplay->getDXT5TextureSupport();
         mSupportsFloat32Textures = mDisplay->getFloat32TextureSupport(&mSupportsFloat32LinearFilter, &mSupportsFloat32RenderableTextures);
         mSupportsFloat16Textures = mDisplay->getFloat16TextureSupport(&mSupportsFloat16LinearFilter, &mSupportsFloat16RenderableTextures);
         mSupportsLuminanceTextures = mDisplay->getLuminanceTextureSupport();
         mSupportsLuminanceAlphaTextures = mDisplay->getLuminanceAlphaTextureSupport();
 
@@ -800,16 +813,42 @@ GLuint Context::getRenderbufferHandle() 
     return mState.renderbuffer.id();
 }
 
 GLuint Context::getArrayBufferHandle() const
 {
     return mState.arrayBuffer.id();
 }
 
+GLuint Context::getActiveQuery(GLenum target) const
+{
+    Query *queryObject = NULL;
+    
+    switch (target)
+    {
+      case GL_ANY_SAMPLES_PASSED_EXT:
+        queryObject = mState.activeQuery[QUERY_ANY_SAMPLES_PASSED].get();
+        break;
+      case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
+        queryObject = mState.activeQuery[QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE].get();
+        break;
+      default:
+        ASSERT(false);
+    }
+
+    if (queryObject)
+    {
+        return queryObject->id();
+    }
+    else
+    {
+        return 0;
+    }
+}
+
 void Context::setEnableVertexAttribArray(unsigned int attribNum, bool enabled)
 {
     mState.vertexAttribute[attribNum].mArrayEnabled = enabled;
 }
 
 const VertexAttribute &Context::getVertexAttribState(unsigned int attribNum)
 {
     return mState.vertexAttribute[attribNum];
@@ -905,16 +944,26 @@ GLuint Context::createFence()
 {
     GLuint handle = mFenceHandleAllocator.allocate();
 
     mFenceMap[handle] = new Fence;
 
     return handle;
 }
 
+// Returns an unused query name
+GLuint Context::createQuery()
+{
+    GLuint handle = mQueryHandleAllocator.allocate();
+
+    mQueryMap[handle] = NULL;
+
+    return handle;
+}
+
 void Context::deleteBuffer(GLuint buffer)
 {
     if (mResourceManager->getBuffer(buffer))
     {
         detachBuffer(buffer);
     }
     
     mResourceManager->deleteBuffer(buffer);
@@ -972,16 +1021,30 @@ void Context::deleteFence(GLuint fence)
     if (fenceObject != mFenceMap.end())
     {
         mFenceHandleAllocator.release(fenceObject->first);
         delete fenceObject->second;
         mFenceMap.erase(fenceObject);
     }
 }
 
+void Context::deleteQuery(GLuint query)
+{
+    QueryMap::iterator queryObject = mQueryMap.find(query);
+    if (queryObject != mQueryMap.end())
+    {
+        mQueryHandleAllocator.release(queryObject->first);
+        if (queryObject->second)
+        {
+            queryObject->second->release();
+        }
+        mQueryMap.erase(queryObject);
+    }
+}
+
 Buffer *Context::getBuffer(GLuint handle)
 {
     return mResourceManager->getBuffer(handle);
 }
 
 Shader *Context::getShader(GLuint handle)
 {
     return mResourceManager->getShader(handle);
@@ -1088,16 +1151,103 @@ void Context::useProgram(GLuint program)
         
         if (oldProgram)
         {
             oldProgram->release();
         }
     }
 }
 
+void Context::beginQuery(GLenum target, GLuint query)
+{
+    // From EXT_occlusion_query_boolean: If BeginQueryEXT is called with an <id>  
+    // of zero, if the active query object name for <target> is non-zero (for the  
+    // targets ANY_SAMPLES_PASSED_EXT and ANY_SAMPLES_PASSED_CONSERVATIVE_EXT, if  
+    // the active query for either target is non-zero), if <id> is the name of an 
+    // existing query object whose type does not match <target>, or if <id> is the
+    // active query object name for any query type, the error INVALID_OPERATION is
+    // generated.
+
+    // Ensure no other queries are active
+    // NOTE: If other queries than occlusion are supported, we will need to check
+    // separately that:
+    //    a) The query ID passed is not the current active query for any target/type
+    //    b) There are no active queries for the requested target (and in the case
+    //       of GL_ANY_SAMPLES_PASSED_EXT and GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT,
+    //       no query may be active for either if glBeginQuery targets either.
+    for (int i = 0; i < QUERY_TYPE_COUNT; i++)
+    {
+        if (mState.activeQuery[i].get() != NULL)
+        {
+            return error(GL_INVALID_OPERATION);
+        }
+    }
+
+    QueryType qType;
+    switch (target)
+    {
+      case GL_ANY_SAMPLES_PASSED_EXT: 
+        qType = QUERY_ANY_SAMPLES_PASSED; 
+        break;
+      case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT: 
+        qType = QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE; 
+        break;
+      default: 
+        ASSERT(false);
+    }
+
+    Query *queryObject = getQuery(query, true, target);
+
+    // check that name was obtained with glGenQueries
+    if (!queryObject)
+    {
+        return error(GL_INVALID_OPERATION);
+    }
+
+    // check for type mismatch
+    if (queryObject->getType() != target)
+    {
+        return error(GL_INVALID_OPERATION);
+    }
+
+    // set query as active for specified target
+    mState.activeQuery[qType].set(queryObject);
+
+    // begin query
+    queryObject->begin();
+}
+
+void Context::endQuery(GLenum target)
+{
+    QueryType qType;
+
+    switch (target)
+    {
+      case GL_ANY_SAMPLES_PASSED_EXT: 
+        qType = QUERY_ANY_SAMPLES_PASSED; 
+        break;
+      case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT: 
+        qType = QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE; 
+        break;
+      default: 
+        ASSERT(false);
+    }
+
+    Query *queryObject = mState.activeQuery[qType].get();
+
+    if (queryObject == NULL)
+    {
+        return error(GL_INVALID_OPERATION);
+    }
+
+    queryObject->end();
+
+    mState.activeQuery[qType].set(NULL);
+}
+
 void Context::setFramebufferZero(Framebuffer *buffer)
 {
     delete mFramebufferMap[0];
     mFramebufferMap[0] = buffer;
     if (mState.drawFramebuffer == 0)
     {
         mBoundDrawFramebuffer = buffer;
     }
@@ -1132,16 +1282,35 @@ Fence *Context::getFence(unsigned int ha
         return NULL;
     }
     else
     {
         return fence->second;
     }
 }
 
+Query *Context::getQuery(unsigned int handle, bool create, GLenum type)
+{
+    QueryMap::iterator query = mQueryMap.find(handle);
+
+    if (query == mQueryMap.end())
+    {
+        return NULL;
+    }
+    else
+    {
+        if (!query->second && create)
+        {
+            query->second = new Query(handle, type);
+            query->second->addRef();
+        }
+        return query->second;
+    }
+}
+
 Buffer *Context::getArrayBuffer()
 {
     return mState.arrayBuffer.get();
 }
 
 Buffer *Context::getElementArrayBuffer()
 {
     return mState.elementArrayBuffer.get();
@@ -2854,66 +3023,17 @@ void Context::drawElements(GLenum mode, 
             drawClosingLine(count, type, indices, indexInfo.minIndex);
         }
     }
 }
 
 // Implements glFlush when block is false, glFinish when block is true
 void Context::sync(bool block)
 {
-    egl::Display *display = getDisplay();
-    IDirect3DQuery9 *eventQuery = NULL;
-    HRESULT result;
-
-    result = mDevice->CreateQuery(D3DQUERYTYPE_EVENT, &eventQuery);
-    if (FAILED(result))
-    {
-        ERR("CreateQuery failed hr=%x\n", result);
-        if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
-        {
-            return error(GL_OUT_OF_MEMORY);
-        }
-        ASSERT(false);
-        return;
-    }
-
-    result = eventQuery->Issue(D3DISSUE_END);
-    if (FAILED(result))
-    {
-        ERR("eventQuery->Issue(END) failed hr=%x\n", result);
-        ASSERT(false);
-        eventQuery->Release();
-        return;
-    }
-
-    do
-    {
-        result = eventQuery->GetData(NULL, 0, D3DGETDATA_FLUSH);
-
-        if(block && result == S_FALSE)
-        {
-            // Keep polling, but allow other threads to do something useful first
-            Sleep(0);
-            // explicitly check for device loss
-            // some drivers seem to return S_FALSE even if the device is lost
-            // instead of D3DERR_DEVICELOST like they should
-            if (display->testDeviceLost())
-            {
-                result = D3DERR_DEVICELOST;
-            }
-        }
-    }
-    while(block && result == S_FALSE);
-
-    eventQuery->Release();
-
-    if (checkDeviceLost(result))
-    {
-        error(GL_OUT_OF_MEMORY);
-    }
+    mDisplay->sync(block);
 }
 
 void Context::drawClosingLine(unsigned int first, unsigned int last, int minIndex)
 {
     IDirect3DIndexBuffer9 *indexBuffer = NULL;
     bool succeeded = false;
     UINT offset;
 
@@ -3157,16 +3277,21 @@ int Context::getNearestSupportedSamples(
     return -1;
 }
 
 bool Context::supportsEventQueries() const
 {
     return mSupportsEventQueries;
 }
 
+bool Context::supportsOcclusionQueries() const
+{
+    return mSupportsOcclusionQueries;
+}
+
 bool Context::supportsDXT1Textures() const
 {
     return mSupportsDXT1Textures;
 }
 
 bool Context::supportsDXT3Textures() const
 {
     return mSupportsDXT3Textures;
@@ -3471,16 +3596,21 @@ void Context::initExtensionString()
     }
 
     if (supportsNonPower2Texture())
     {
         mExtensionString += "GL_OES_texture_npot ";
     }
 
     // Multi-vendor (EXT) extensions
+    if (supportsOcclusionQueries())
+    {
+        mExtensionString += "GL_EXT_occlusion_query_boolean ";
+    }
+
     mExtensionString += "GL_EXT_read_format_bgra ";
     mExtensionString += "GL_EXT_robustness ";
 
     if (supportsDXT1Textures())
     {
         mExtensionString += "GL_EXT_texture_compression_dxt1 ";
     }
 
--- a/gfx/angle/src/libGLESv2/Context.h
+++ b/gfx/angle/src/libGLESv2/Context.h
@@ -16,19 +16,19 @@
 #define EGLAPI
 #include <EGL/egl.h>
 #include <d3d9.h>
 
 #include <map>
 #include <hash_map>
 
 #include "common/angleutils.h"
+#include "common/RefCountObject.h"
 #include "libGLESv2/ResourceManager.h"
 #include "libGLESv2/HandleAllocator.h"
-#include "libGLESv2/RefCountObject.h"
 
 namespace egl
 {
 class Display;
 class Surface;
 class Config;
 }
 
@@ -50,34 +50,47 @@ class Colorbuffer;
 class Depthbuffer;
 class StreamingIndexBuffer;
 class Stencilbuffer;
 class DepthStencilbuffer;
 class VertexDataManager;
 class IndexDataManager;
 class Blit;
 class Fence;
+class Query;
 
 enum
 {
+    D3D9_MAX_FLOAT_CONSTANTS = 256,
+    D3D9_MAX_BOOL_CONSTANTS = 16,
+    D3D9_MAX_INT_CONSTANTS = 16,
+
     MAX_VERTEX_ATTRIBS = 16,
-    MAX_VERTEX_UNIFORM_VECTORS = 256 - 2,   // 256 is the minimum for SM2, and in practice the maximum for DX9. Reserve space for dx_HalfPixelSize and dx_DepthRange.
+    MAX_VERTEX_UNIFORM_VECTORS = D3D9_MAX_FLOAT_CONSTANTS - 2,   // Reserve space for dx_HalfPixelSize and dx_DepthRange.
     MAX_VARYING_VECTORS_SM2 = 8,
     MAX_VARYING_VECTORS_SM3 = 10,
     MAX_TEXTURE_IMAGE_UNITS = 16,
     MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF = 4,   // For devices supporting vertex texture fetch
     MAX_COMBINED_TEXTURE_IMAGE_UNITS_VTF = MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF,    
     MAX_FRAGMENT_UNIFORM_VECTORS_SM2 = 32 - 3,    // Reserve space for dx_Coord, dx_Depth, and dx_DepthRange. dx_PointOrLines and dx_FrontCCW use separate bool registers.
     MAX_FRAGMENT_UNIFORM_VECTORS_SM3 = 224 - 3,
     MAX_DRAW_BUFFERS = 1,
 
     IMPLEMENTATION_COLOR_READ_FORMAT = GL_RGB,
     IMPLEMENTATION_COLOR_READ_TYPE = GL_UNSIGNED_SHORT_5_6_5
 };
 
+enum QueryType
+{
+    QUERY_ANY_SAMPLES_PASSED,
+    QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE,
+
+    QUERY_TYPE_COUNT
+};
+
 const float ALIASED_LINE_WIDTH_RANGE_MIN = 1.0f;
 const float ALIASED_LINE_WIDTH_RANGE_MAX = 1.0f;
 const float ALIASED_POINT_SIZE_RANGE_MIN = 1.0f;
 const float ALIASED_POINT_SIZE_RANGE_MAX_SM2 = 1.0f;
 const float ALIASED_POINT_SIZE_RANGE_MAX_SM3 = 64.0f;
 
 struct Color
 {
@@ -211,16 +224,17 @@ struct State
     BindingPointer<Buffer> elementArrayBuffer;
     GLuint readFramebuffer;
     GLuint drawFramebuffer;
     BindingPointer<Renderbuffer> renderbuffer;
     GLuint currentProgram;
 
     VertexAttribute vertexAttribute[MAX_VERTEX_ATTRIBS];
     BindingPointer<Texture> samplerTexture[TEXTURE_TYPE_COUNT][MAX_COMBINED_TEXTURE_IMAGE_UNITS_VTF];
+    BindingPointer<Query> activeQuery[QUERY_TYPE_COUNT];
 
     GLint unpackAlignment;
     GLint packAlignment;
     bool packReverseRowOrder;
 };
 
 // Helper class to construct and cache vertex declarations
 class VertexDeclarationCache
@@ -342,16 +356,18 @@ class Context
     void setActiveSampler(unsigned int active);
 
     GLuint getReadFramebufferHandle() const;
     GLuint getDrawFramebufferHandle() const;
     GLuint getRenderbufferHandle() const;
 
     GLuint getArrayBufferHandle() const;
 
+    GLuint getActiveQuery(GLenum target) const;
+
     void setEnableVertexAttribArray(unsigned int attribNum, bool enabled);
     const VertexAttribute &getVertexAttribState(unsigned int attribNum);
     void setVertexAttribState(unsigned int attribNum, Buffer *boundBuffer, GLint size, GLenum type,
                               bool normalized, GLsizei stride, const void *pointer);
     const void *getVertexAttribPointer(unsigned int attribNum) const;
 
     const VertexAttributeArray &getVertexAttributes();
 
@@ -380,39 +396,47 @@ class Context
 
     // Framebuffers are owned by the Context, so these methods do not pass through
     GLuint createFramebuffer();
     void deleteFramebuffer(GLuint framebuffer);
 
     // Fences are owned by the Context.
     GLuint createFence();
     void deleteFence(GLuint fence);
+    
+    // Queries are owned by the Context;
+    GLuint createQuery();
+    void deleteQuery(GLuint query);
 
     void bindArrayBuffer(GLuint buffer);
     void bindElementArrayBuffer(GLuint buffer);
     void bindTexture2D(GLuint texture);
     void bindTextureCubeMap(GLuint texture);
     void bindReadFramebuffer(GLuint framebuffer);
     void bindDrawFramebuffer(GLuint framebuffer);
     void bindRenderbuffer(GLuint renderbuffer);
     void useProgram(GLuint program);
 
+    void beginQuery(GLenum target, GLuint query);
+    void endQuery(GLenum target);
+
     void setFramebufferZero(Framebuffer *framebuffer);
 
     void setRenderbufferStorage(RenderbufferStorage *renderbuffer);
 
     void setVertexAttrib(GLuint index, const GLfloat *values);
 
     Buffer *getBuffer(GLuint handle);
     Fence *getFence(GLuint handle);
     Shader *getShader(GLuint handle);
     Program *getProgram(GLuint handle);
     Texture *getTexture(GLuint handle);
     Framebuffer *getFramebuffer(GLuint handle);
     Renderbuffer *getRenderbuffer(GLuint handle);
+    Query *getQuery(GLuint handle, bool create, GLenum type);
 
     Buffer *getArrayBuffer();
     Buffer *getElementArrayBuffer();
     Program *getCurrentProgram();
     Texture2D *getTexture2D();
     TextureCubeMap *getTextureCubeMap();
     Texture *getSamplerTexture(unsigned int sampler, TextureType type);
     Framebuffer *getReadFramebuffer();
@@ -453,16 +477,17 @@ class Context
     int getMaximumTextureDimension() const;
     int getMaximumCubeTextureDimension() const;
     int getMaximumTextureLevel() const;
     GLsizei getMaxSupportedSamples() const;
     int getNearestSupportedSamples(D3DFORMAT format, int requested) const;
     const char *getExtensionString() const;
     const char *getRendererString() const;
     bool supportsEventQueries() const;
+    bool supportsOcclusionQueries() const;
     bool supportsDXT1Textures() const;
     bool supportsDXT3Textures() const;
     bool supportsDXT5Textures() const;
     bool supportsFloat32Textures() const;
     bool supportsFloat32LinearFilter() const;
     bool supportsFloat32RenderableTextures() const;
     bool supportsFloat16Textures() const;
     bool supportsFloat16LinearFilter() const;
@@ -516,16 +541,20 @@ class Context
     typedef stdext::hash_map<GLuint, Framebuffer*> FramebufferMap;
     FramebufferMap mFramebufferMap;
     HandleAllocator mFramebufferHandleAllocator;
 
     typedef stdext::hash_map<GLuint, Fence*> FenceMap;
     FenceMap mFenceMap;
     HandleAllocator mFenceHandleAllocator;
 
+    typedef stdext::hash_map<GLuint, Query*> QueryMap;
+    QueryMap mQueryMap;
+    HandleAllocator mQueryHandleAllocator;
+
     std::string mExtensionString;
     std::string mRendererString;
 
     VertexDataManager *mVertexDataManager;
     IndexDataManager *mIndexDataManager;
 
     Blit *mBlit;
 
@@ -568,16 +597,17 @@ class Context
     bool mSupportsNonPower2Texture;
     int  mMaxRenderbufferDimension;
     int  mMaxTextureDimension;
     int  mMaxCubeTextureDimension;
     int  mMaxTextureLevel;
     std::map<D3DFORMAT, bool *> mMultiSampleSupport;
     GLsizei mMaxSupportedSamples;
     bool mSupportsEventQueries;
+    bool mSupportsOcclusionQueries;
     bool mSupportsDXT1Textures;
     bool mSupportsDXT3Textures;
     bool mSupportsDXT5Textures;
     bool mSupportsFloat32Textures;
     bool mSupportsFloat32LinearFilter;
     bool mSupportsFloat32RenderableTextures;
     bool mSupportsFloat16Textures;
     bool mSupportsFloat16LinearFilter;
--- a/gfx/angle/src/libGLESv2/Fence.cpp
+++ b/gfx/angle/src/libGLESv2/Fence.cpp
@@ -19,39 +19,36 @@ Fence::Fence()
     mCondition = GL_NONE;
     mStatus = GL_FALSE;
 }
 
 Fence::~Fence()
 {
     if (mQuery != NULL)
     {
-        mQuery->Release();
-        mQuery = NULL;
+        getDisplay()->freeEventQuery(mQuery);
     }
 }
 
 GLboolean Fence::isFence()
 {
     // GL_NV_fence spec:
     // A name returned by GenFencesNV, but not yet set via SetFenceNV, is not the name of an existing fence.
     return mQuery != NULL;
 }
 
 void Fence::setFence(GLenum condition)
 {
-    if (mQuery != NULL)
+    if (!mQuery)
     {
-        mQuery->Release();
-        mQuery = NULL;
-    }
-
-    if (FAILED(getDevice()->CreateQuery(D3DQUERYTYPE_EVENT, &mQuery)))
-    {
-        return error(GL_OUT_OF_MEMORY);
+        mQuery = getDisplay()->allocateEventQuery();
+        if (!mQuery)
+        {
+            return error(GL_OUT_OF_MEMORY);
+        }
     }
 
     HRESULT result = mQuery->Issue(D3DISSUE_END);
     ASSERT(SUCCEEDED(result));
 
     mCondition = condition;
     mStatus = GL_FALSE;
 }
--- a/gfx/angle/src/libGLESv2/Framebuffer.cpp
+++ b/gfx/angle/src/libGLESv2/Framebuffer.cpp
@@ -39,17 +39,17 @@ Renderbuffer *Framebuffer::lookupRenderb
     if (type == GL_NONE)
     {
         buffer = NULL;
     }
     else if (type == GL_RENDERBUFFER)
     {
         buffer = context->getRenderbuffer(handle);
     }
-    else if (IsTextureTarget(type))
+    else if (IsInternalTextureTarget(type))
     {
         buffer = context->getTexture(handle)->getRenderbuffer(type);
     }
     else
     {
         UNREACHABLE();
     }
 
@@ -71,29 +71,29 @@ void Framebuffer::setDepthbuffer(GLenum 
 void Framebuffer::setStencilbuffer(GLenum type, GLuint stencilbuffer)
 {
     mStencilbufferType = (stencilbuffer != 0) ? type : GL_NONE;
     mStencilbufferPointer.set(lookupRenderbuffer(type, stencilbuffer));
 }
 
 void Framebuffer::detachTexture(GLuint texture)
 {
-    if (mColorbufferPointer.id() == texture && IsTextureTarget(mColorbufferType))
+    if (mColorbufferPointer.id() == texture && IsInternalTextureTarget(mColorbufferType))
     {
         mColorbufferType = GL_NONE;
         mColorbufferPointer.set(NULL);
     }
 
-    if (mDepthbufferPointer.id() == texture && IsTextureTarget(mDepthbufferType))
+    if (mDepthbufferPointer.id() == texture && IsInternalTextureTarget(mDepthbufferType))
     {
         mDepthbufferType = GL_NONE;
         mDepthbufferPointer.set(NULL);
     }
 
-    if (mStencilbufferPointer.id() == texture && IsTextureTarget(mStencilbufferType))
+    if (mStencilbufferPointer.id() == texture && IsInternalTextureTarget(mStencilbufferType))
     {
         mStencilbufferType = GL_NONE;
         mStencilbufferPointer.set(NULL);
     }
 }
 
 void Framebuffer::detachRenderbuffer(GLuint renderbuffer)
 {
@@ -263,17 +263,17 @@ GLenum Framebuffer::completeness()
 
         if (mColorbufferType == GL_RENDERBUFFER)
         {
             if (!gl::IsColorRenderable(colorbuffer->getInternalFormat()))
             {
                 return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
             }
         }
-        else if (IsTextureTarget(mColorbufferType))
+        else if (IsInternalTextureTarget(mColorbufferType))
         {
             if (IsCompressed(colorbuffer->getInternalFormat()))
             {
                 return GL_FRAMEBUFFER_UNSUPPORTED;
             }
 
             if ((dx2es::IsFloat32Format(colorbuffer->getD3DFormat()) && !getContext()->supportsFloat32RenderableTextures()) || 
                 (dx2es::IsFloat16Format(colorbuffer->getD3DFormat()) && !getContext()->supportsFloat16RenderableTextures()))
--- a/gfx/angle/src/libGLESv2/Framebuffer.h
+++ b/gfx/angle/src/libGLESv2/Framebuffer.h
@@ -10,17 +10,17 @@
 #ifndef LIBGLESV2_FRAMEBUFFER_H_
 #define LIBGLESV2_FRAMEBUFFER_H_
 
 #define GL_APICALL
 #include <GLES2/gl2.h>
 #include <d3d9.h>
 
 #include "common/angleutils.h"
-#include "libGLESv2/RefCountObject.h"
+#include "common/RefCountObject.h"
 
 namespace gl
 {
 class Renderbuffer;
 class Colorbuffer;
 class Depthbuffer;
 class Stencilbuffer;
 class DepthStencilbuffer;
--- a/gfx/angle/src/libGLESv2/Makefile.in
+++ b/gfx/angle/src/libGLESv2/Makefile.in
@@ -77,17 +77,16 @@ CPPSRCS = \
 	Compiler.cpp \
         DetectRecursion.cpp \
         InfoSink.cpp \
         Initialize.cpp \
         InitializeDll.cpp \
         Intermediate.cpp \
         intermOut.cpp \
         IntermTraverse.cpp \
-        MozAngleLink.cpp \
         parseConst.cpp \
         ParseHelper.cpp \
         PoolAlloc.cpp \
         QualifierAlive.cpp \
         RemoveTree.cpp \
         ShaderLang.cpp \
         SymbolTable.cpp \
         VariableInfo.cpp \
@@ -144,16 +143,17 @@ CPPSRCS	+= \
 	Buffer.cpp \
 	Context.cpp \
 	Fence.cpp \
 	Framebuffer.cpp \
 	libGLESv2.cpp \
 	main.cpp \
 	Program.cpp \
 	RefCountObject.cpp \
+	Query.cpp \
 	Renderbuffer.cpp \
 	ResourceManager.cpp \
 	Shader.cpp \
 	Texture.cpp \
 	utilities.cpp \
 	HandleAllocator.cpp \
 	IndexDataManager.cpp \
 	VertexDataManager.cpp \
--- a/gfx/angle/src/libGLESv2/Program.cpp
+++ b/gfx/angle/src/libGLESv2/Program.cpp
@@ -328,34 +328,29 @@ bool Program::setUniform1fv(GLint locati
     else if (targetUniform->type == GL_BOOL)
     {
         int arraySize = targetUniform->arraySize;
 
         if (arraySize == 1 && count > 1)
             return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
 
         count = std::min(arraySize - (int)mUniformIndex[location].element, count);
-        GLboolean *boolParams = new GLboolean[count];
+        GLboolean *boolParams = (GLboolean*)targetUniform->data + mUniformIndex[location].element;
 
         for (int i = 0; i < count; ++i)
         {
             if (v[i] == 0.0f)
             {
                 boolParams[i] = GL_FALSE;
             }
             else
             {
                 boolParams[i] = GL_TRUE;
             }
         }
-
-        memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean),
-               boolParams, sizeof(GLboolean) * count);
-
-        delete [] boolParams;
     }
     else
     {
         return false;
     }
 
     return true;
 }
@@ -395,34 +390,29 @@ bool Program::setUniform2fv(GLint locati
     {
         int arraySize = targetUniform->arraySize;
 
         if (arraySize == 1 && count > 1)
             return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
 
         count = std::min(arraySize - (int)mUniformIndex[location].element, count);
 
-        GLboolean *boolParams = new GLboolean[count * 2];
+        GLboolean *boolParams = (GLboolean*)targetUniform->data + mUniformIndex[location].element * 2;
 
         for (int i = 0; i < count * 2; ++i)
         {
             if (v[i] == 0.0f)
             {
                 boolParams[i] = GL_FALSE;
             }
             else
             {
                 boolParams[i] = GL_TRUE;
             }
         }
-
-        memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean) * 2,
-               boolParams, 2 * sizeof(GLboolean) * count);
-
-        delete [] boolParams;
     }
     else 
     {
         return false;
     }
 
     return true;
 }
@@ -461,34 +451,29 @@ bool Program::setUniform3fv(GLint locati
     else if (targetUniform->type == GL_BOOL_VEC3)
     {
         int arraySize = targetUniform->arraySize;
 
         if (arraySize == 1 && count > 1)
             return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
 
         count = std::min(arraySize - (int)mUniformIndex[location].element, count);
-        GLboolean *boolParams = new GLboolean[count * 3];
+        GLboolean *boolParams = (GLboolean*)targetUniform->data + mUniformIndex[location].element * 3;
 
         for (int i = 0; i < count * 3; ++i)
         {
             if (v[i] == 0.0f)
             {
                 boolParams[i] = GL_FALSE;
             }
             else
             {
                 boolParams[i] = GL_TRUE;
             }
         }
-
-        memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean) * 3,
-               boolParams, 3 * sizeof(GLboolean) * count);
-
-        delete [] boolParams;
     }
     else 
     {
         return false;
     }
 
     return true;
 }
@@ -518,34 +503,29 @@ bool Program::setUniform4fv(GLint locati
     else if (targetUniform->type == GL_BOOL_VEC4)
     {
         int arraySize = targetUniform->arraySize;
 
         if (arraySize == 1 && count > 1)
             return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
 
         count = std::min(arraySize - (int)mUniformIndex[location].element, count);
-        GLboolean *boolParams = new GLboolean[count * 4];
+        GLboolean *boolParams = (GLboolean*)targetUniform->data + mUniformIndex[location].element * 4;
 
         for (int i = 0; i < count * 4; ++i)
         {
             if (v[i] == 0.0f)
             {
                 boolParams[i] = GL_FALSE;
             }
             else
             {
                 boolParams[i] = GL_TRUE;
             }
         }
-
-        memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean) * 4,
-               boolParams, 4 * sizeof(GLboolean) * count);
-
-        delete [] boolParams;
     }
     else 
     {
         return false;
     }
 
     return true;
 }
@@ -708,34 +688,29 @@ bool Program::setUniform1iv(GLint locati
     else if (targetUniform->type == GL_BOOL)
     {
         int arraySize = targetUniform->arraySize;
 
         if (arraySize == 1 && count > 1)
             return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
 
         count = std::min(arraySize - (int)mUniformIndex[location].element, count);
-        GLboolean *boolParams = new GLboolean[count];
+        GLboolean *boolParams = (GLboolean*)targetUniform->data + mUniformIndex[location].element;
 
         for (int i = 0; i < count; ++i)
         {
             if (v[i] == 0)
             {
                 boolParams[i] = GL_FALSE;
             }
             else
             {
                 boolParams[i] = GL_TRUE;
             }
         }
-
-        memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean),
-               boolParams, sizeof(GLboolean) * count);
-
-        delete [] boolParams;
     }
     else
     {
         return false;
     }
 
     return true;
 }
@@ -765,34 +740,29 @@ bool Program::setUniform2iv(GLint locati
     else if (targetUniform->type == GL_BOOL_VEC2)
     {
         int arraySize = targetUniform->arraySize;
 
         if (arraySize == 1 && count > 1)
             return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
 
         count = std::min(arraySize - (int)mUniformIndex[location].element, count);
-        GLboolean *boolParams = new GLboolean[count * 2];
+        GLboolean *boolParams = (GLboolean*)targetUniform->data + mUniformIndex[location].element * 2;
 
         for (int i = 0; i < count * 2; ++i)
         {
             if (v[i] == 0)
             {
                 boolParams[i] = GL_FALSE;
             }
             else
             {
                 boolParams[i] = GL_TRUE;
             }
         }
-
-        memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean) * 2,
-               boolParams, 2 * sizeof(GLboolean) * count);
-
-        delete [] boolParams;
     }
     else
     {
         return false;
     }
 
     return true;
 }
@@ -822,34 +792,29 @@ bool Program::setUniform3iv(GLint locati
     else if (targetUniform->type == GL_BOOL_VEC3)
     {
         int arraySize = targetUniform->arraySize;
 
         if (arraySize == 1 && count > 1)
             return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
 
         count = std::min(arraySize - (int)mUniformIndex[location].element, count);
-        GLboolean *boolParams = new GLboolean[count * 3];
+        GLboolean *boolParams = (GLboolean*)targetUniform->data + mUniformIndex[location].element * 3;
 
         for (int i = 0; i < count * 3; ++i)
         {
             if (v[i] == 0)
             {
                 boolParams[i] = GL_FALSE;
             }
             else
             {
                 boolParams[i] = GL_TRUE;
             }
         }
-
-        memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean) * 3,
-               boolParams, 3 * sizeof(GLboolean) * count);
-
-        delete [] boolParams;
     }
     else
     {
         return false;
     }
 
     return true;
 }
@@ -879,34 +844,29 @@ bool Program::setUniform4iv(GLint locati
     else if (targetUniform->type == GL_BOOL_VEC4)
     {
         int arraySize = targetUniform->arraySize;
 
         if (arraySize == 1 && count > 1)
             return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
 
         count = std::min(arraySize - (int)mUniformIndex[location].element, count);
-        GLboolean *boolParams = new GLboolean[count * 4];
+        GLboolean *boolParams = (GLboolean*)targetUniform->data + mUniformIndex[location].element * 4;
 
         for (int i = 0; i < count * 4; ++i)
         {
             if (v[i] == 0)
             {
                 boolParams[i] = GL_FALSE;
             }
             else
             {
                 boolParams[i] = GL_TRUE;
             }
         }
-
-        memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLboolean) * 4,
-               boolParams, 4 * sizeof(GLboolean) * count);
-
-        delete [] boolParams;
     }
     else
     {
         return false;
     }
 
     return true;
 }
@@ -2080,24 +2040,23 @@ std::string Program::undecorateUniform(c
         return _name.substr(3);
     }
     
     return _name;
 }
 
 void Program::applyUniformnbv(Uniform *targetUniform, GLsizei count, int width, const GLboolean *v)
 {
-    float *vector = NULL;
-    BOOL *boolVector = NULL;
+    float vector[D3D9_MAX_FLOAT_CONSTANTS * 4];
+    BOOL boolVector[D3D9_MAX_BOOL_CONSTANTS];
 
     if (targetUniform->ps.registerCount && targetUniform->ps.registerSet == D3DXRS_FLOAT4 ||
         targetUniform->vs.registerCount && targetUniform->vs.registerSet == D3DXRS_FLOAT4)
     {
-        vector = new float[4 * count];
-
+        ASSERT(count <= D3D9_MAX_FLOAT_CONSTANTS);
         for (int i = 0; i < count; i++)
         {
             for (int j = 0; j < 4; j++)
             {
                 if (j < width)
                 {
                     vector[i * 4 + j] = (v[i * width + j] == GL_FALSE) ? 0.0f : 1.0f;
                 }
@@ -2107,18 +2066,21 @@ void Program::applyUniformnbv(Uniform *t
                 }
             }
         }
     }
 
     if (targetUniform->ps.registerCount && targetUniform->ps.registerSet == D3DXRS_BOOL ||
         targetUniform->vs.registerCount && targetUniform->vs.registerSet == D3DXRS_BOOL)
     {
-        boolVector = new BOOL[count * width];
-        for (int i = 0; i < count * width; i++)
+        int psCount = targetUniform->ps.registerSet == D3DXRS_BOOL ? targetUniform->ps.registerCount : 0;
+        int vsCount = targetUniform->vs.registerSet == D3DXRS_BOOL ? targetUniform->vs.registerCount : 0;
+        int copyCount = std::min(count * width, std::max(psCount, vsCount));
+        ASSERT(copyCount <= D3D9_MAX_BOOL_CONSTANTS);
+        for (int i = 0; i < copyCount; i++)
         {
             boolVector[i] = v[i] != GL_FALSE;
         }
     }
 
     if (targetUniform->ps.registerCount)
     {
         if (targetUniform->ps.registerSet == D3DXRS_FLOAT4)
@@ -2139,19 +2101,16 @@ void Program::applyUniformnbv(Uniform *t
             mDevice->SetVertexShaderConstantF(targetUniform->vs.registerIndex, vector, targetUniform->vs.registerCount);
         }
         else if (targetUniform->vs.registerSet == D3DXRS_BOOL)
         {
             mDevice->SetVertexShaderConstantB(targetUniform->vs.registerIndex, boolVector, targetUniform->vs.registerCount);
         }
         else UNREACHABLE();
     }
-
-    delete [] vector;
-    delete [] boolVector;
 }
 
 bool Program::applyUniformnfv(Uniform *targetUniform, const GLfloat *v)
 {
     if (targetUniform->ps.registerCount)
     {
         mDevice->SetPixelShaderConstantF(targetUniform->ps.registerIndex, v, targetUniform->ps.registerCount);
     }
@@ -2161,17 +2120,18 @@ bool Program::applyUniformnfv(Uniform *t
         mDevice->SetVertexShaderConstantF(targetUniform->vs.registerIndex, v, targetUniform->vs.registerCount);
     }
 
     return true;
 }
 
 bool Program::applyUniform1iv(Uniform *targetUniform, GLsizei count, const GLint *v)
 {
-    D3DXVECTOR4 *vector = new D3DXVECTOR4[count];
+    ASSERT(count <= D3D9_MAX_FLOAT_CONSTANTS);
+    D3DXVECTOR4 vector[D3D9_MAX_FLOAT_CONSTANTS];
 
     for (int i = 0; i < count; i++)
     {
         vector[i] = D3DXVECTOR4((float)v[i], 0, 0, 0);
     }
 
     if (targetUniform->ps.registerCount)
     {
@@ -2216,72 +2176,67 @@ bool Program::applyUniform1iv(Uniform *t
         }
         else
         {
             ASSERT(targetUniform->vs.registerSet == D3DXRS_FLOAT4);
             mDevice->SetVertexShaderConstantF(targetUniform->vs.registerIndex, (const float *)vector, targetUniform->vs.registerCount);
         }
     }
 
-    delete [] vector;
-
     return true;
 }
 
 bool Program::applyUniform2iv(Uniform *targetUniform, GLsizei count, const GLint *v)
 {
-    D3DXVECTOR4 *vector = new D3DXVECTOR4[count];
+    ASSERT(count <= D3D9_MAX_FLOAT_CONSTANTS);
+    D3DXVECTOR4 vector[D3D9_MAX_FLOAT_CONSTANTS];
 
     for (int i = 0; i < count; i++)
     {
         vector[i] = D3DXVECTOR4((float)v[0], (float)v[1], 0, 0);
 
         v += 2;
     }
 
     applyUniformniv(targetUniform, count, vector);
 
-    delete[] vector;
-
     return true;
 }
 
 bool Program::applyUniform3iv(Uniform *targetUniform, GLsizei count, const GLint *v)
 {
-    D3DXVECTOR4 *vector = new D3DXVECTOR4[count];
+    ASSERT(count <= D3D9_MAX_FLOAT_CONSTANTS);
+    D3DXVECTOR4 vector[D3D9_MAX_FLOAT_CONSTANTS];
 
     for (int i = 0; i < count; i++)
     {
         vector[i] = D3DXVECTOR4((float)v[0], (float)v[1], (float)v[2], 0);
 
         v += 3;
     }
 
     applyUniformniv(targetUniform, count, vector);
 
-    delete[] vector;
-
     return true;
 }
 
 bool Program::applyUniform4iv(Uniform *targetUniform, GLsizei count, const GLint *v)
 {
-    D3DXVECTOR4 *vector = new D3DXVECTOR4[count];
+    ASSERT(count <= D3D9_MAX_FLOAT_CONSTANTS);
+    D3DXVECTOR4 vector[D3D9_MAX_FLOAT_CONSTANTS];
 
     for (int i = 0; i < count; i++)
     {
         vector[i] = D3DXVECTOR4((float)v[0], (float)v[1], (float)v[2], (float)v[3]);
 
         v += 4;
     }
 
     applyUniformniv(targetUniform, count, vector);
 
-    delete [] vector;
-
     return true;
 }
 
 void Program::applyUniformniv(Uniform *targetUniform, GLsizei count, const D3DXVECTOR4 *vector)
 {
     if (targetUniform->ps.registerCount)
     {
         ASSERT(targetUniform->ps.registerSet == D3DXRS_FLOAT4);
new file mode 100644
--- /dev/null
+++ b/gfx/angle/src/libGLESv2/Query.cpp
@@ -0,0 +1,128 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Query.cpp: Implements the gl::Query class
+
+#include "libGLESv2/Query.h"
+
+#include "libGLESv2/main.h"
+
+namespace gl
+{
+
+Query::Query(GLuint id, GLenum type) : RefCountObject(id)
+{ 
+    mQuery = NULL;
+    mStatus = GL_FALSE;
+    mResult = GL_FALSE;
+    mType = type;
+}
+
+Query::~Query()
+{
+    if (mQuery != NULL)
+    {
+        mQuery->Release();
+        mQuery = NULL;
+    }
+}
+
+void Query::begin()
+{
+    if (mQuery == NULL)
+    {
+        if (FAILED(getDevice()->CreateQuery(D3DQUERYTYPE_OCCLUSION, &mQuery)))
+        {
+            return error(GL_OUT_OF_MEMORY);
+        }
+    }
+
+    HRESULT result = mQuery->Issue(D3DISSUE_BEGIN);
+    ASSERT(SUCCEEDED(result));
+}
+
+void Query::end()
+{
+    if (mQuery == NULL)
+    {
+        return error(GL_INVALID_OPERATION);
+    }
+
+    HRESULT result = mQuery->Issue(D3DISSUE_END);
+    ASSERT(SUCCEEDED(result));
+    
+    mStatus = GL_FALSE;
+    mResult = GL_FALSE;
+}
+
+GLuint Query::getResult()
+{
+    if (mQuery != NULL)
+    {
+        while (!testQuery())
+        {
+            Sleep(0);
+            // explicitly check for device loss
+            // some drivers seem to return S_FALSE even if the device is lost
+            // instead of D3DERR_DEVICELOST like they should
+            if (gl::getDisplay()->testDeviceLost())
+            {
+                gl::getDisplay()->notifyDeviceLost();
+                return error(GL_OUT_OF_MEMORY, 0);
+            }
+        }
+    }
+
+    return (GLuint)mResult;
+}
+
+GLboolean Query::isResultAvailable()
+{
+    if (mQuery != NULL)
+    {
+        testQuery();
+    }
+    
+    return mStatus;
+}
+
+GLenum Query::getType() const
+{
+    return mType;
+}
+
+GLboolean Query::testQuery()
+{
+    if (mQuery != NULL && mStatus != GL_TRUE)
+    {
+        DWORD numPixels = 0;
+
+        HRESULT hres = mQuery->GetData(&numPixels, sizeof(DWORD), D3DGETDATA_FLUSH);
+        if (hres == S_OK)
+        {
+            mStatus = GL_TRUE;
+
+            switch (mType)
+            {
+              case GL_ANY_SAMPLES_PASSED_EXT:
+              case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
+                mResult = (numPixels > 0) ? GL_TRUE : GL_FALSE;
+                break;
+              default:
+                ASSERT(false);
+            }
+        }
+        else if (checkDeviceLost(hres))
+        {
+            return error(GL_OUT_OF_MEMORY, GL_TRUE);
+        }
+        
+        return mStatus;
+    }
+
+    return GL_TRUE; // prevent blocking when query is null
+}
+}
new file mode 100644
--- /dev/null
+++ b/gfx/angle/src/libGLESv2/Query.h
@@ -0,0 +1,48 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Query.h: Defines the gl::Query class
+
+#ifndef LIBGLESV2_QUERY_H_
+#define LIBGLESV2_QUERY_H_
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
+#include <d3d9.h>
+
+#include "common/angleutils.h"
+#include "common/RefCountObject.h"
+
+namespace gl
+{
+
+class Query : public RefCountObject
+{
+  public:
+    Query(GLuint id, GLenum type);
+    virtual ~Query();
+
+    void begin();
+    void end();
+    GLuint getResult();
+    GLboolean isResultAvailable();
+
+    GLenum getType() const;
+
+  private:
+    DISALLOW_COPY_AND_ASSIGN(Query);
+
+    GLboolean testQuery();
+
+    IDirect3DQuery9* mQuery;
+    GLenum mType;
+    GLboolean mStatus;
+    GLint mResult;
+};
+
+}
+
+#endif   // LIBGLESV2_QUERY_H_
deleted file mode 100644
--- a/gfx/angle/src/libGLESv2/RefCountObject.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// RefCountObject.cpp: Defines the gl::RefCountObject base class that provides
-// lifecycle support for GL objects using the traditional BindObject scheme, but
-// that need to be reference counted for correct cross-context deletion.
-// (Concretely, textures, buffers and renderbuffers.)
-
-#include "RefCountObject.h"
-
-namespace gl
-{
-
-RefCountObject::RefCountObject(GLuint id)
-{
-    mId = id;
-    mRefCount = 0;
-}
-
-RefCountObject::~RefCountObject()
-{
-    ASSERT(mRefCount == 0);
-}
-
-void RefCountObject::addRef() const
-{
-    mRefCount++;
-}
-
-void RefCountObject::release() const
-{
-    ASSERT(mRefCount > 0);
-
-    if (--mRefCount == 0)
-    {
-        delete this;
-    }
-}
-
-void RefCountObjectBindingPointer::set(RefCountObject *newObject)
-{
-    // addRef first in case newObject == mObject and this is the last reference to it.
-    if (newObject != NULL) newObject->addRef();
-    if (mObject != NULL) mObject->release();
-
-    mObject = newObject;
-}
-
-}
deleted file mode 100644
--- a/gfx/angle/src/libGLESv2/RefCountObject.h
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// RefCountObject.h: Defines the gl::RefCountObject base class that provides
-// lifecycle support for GL objects using the traditional BindObject scheme, but
-// that need to be reference counted for correct cross-context deletion.
-// (Concretely, textures, buffers and renderbuffers.)
-
-#ifndef LIBGLESV2_REFCOUNTOBJECT_H_
-#define LIBGLESV2_REFCOUNTOBJECT_H_
-
-#include <cstddef>
-
-#define GL_APICALL
-#include <GLES2/gl2.h>
-
-#include "common/debug.h"
-
-namespace gl
-{
-
-class RefCountObject
-{
-  public:
-    explicit RefCountObject(GLuint id);
-    virtual ~RefCountObject();
-
-    virtual void addRef() const;
-    virtual void release() const;
-
-    GLuint id() const { return mId; }
-    
-  private:
-    GLuint mId;
-
-    mutable std::size_t mRefCount;
-};
-
-class RefCountObjectBindingPointer
-{
-  protected:
-    RefCountObjectBindingPointer() : mObject(NULL) { }
-    ~RefCountObjectBindingPointer() { ASSERT(mObject == NULL); } // Objects have to be released before the resource manager is destroyed, so they must be explicitly cleaned up.
-
-    void set(RefCountObject *newObject);
-    RefCountObject *get() const { return mObject; }
-
-  public:
-    GLuint id() const { return (mObject != NULL) ? mObject->id() : 0; }
-    bool operator ! () const { return (get() == NULL); }
-
-  private:
-    RefCountObject *mObject;
-};
-
-template <class ObjectType>
-class BindingPointer : public RefCountObjectBindingPointer
-{
-  public:
-    void set(ObjectType *newObject) { RefCountObjectBindingPointer::set(newObject); }
-    ObjectType *get() const { return static_cast<ObjectType*>(RefCountObjectBindingPointer::get()); }
-    ObjectType *operator -> () const { return get(); }
-};
-
-}
-
-#endif   // LIBGLESV2_REFCOUNTOBJECT_H_
--- a/gfx/angle/src/libGLESv2/Renderbuffer.cpp
+++ b/gfx/angle/src/libGLESv2/Renderbuffer.cpp
@@ -17,16 +17,27 @@
 namespace gl
 {
 unsigned int RenderbufferStorage::mCurrentSerial = 1;
 
 RenderbufferInterface::RenderbufferInterface()
 {
 }
 
+// The default case for classes inherited from RenderbufferInterface is not to
+// need to do anything upon the reference count to the parent Renderbuffer incrementing
+// or decrementing. 
+void RenderbufferInterface::addProxyRef(const Renderbuffer *proxy)
+{
+}
+
+void RenderbufferInterface::releaseProxy(const Renderbuffer *proxy)
+{
+}
+
 GLuint RenderbufferInterface::getRedSize() const
 {
     return dx2es::GetRedSize(getD3DFormat());
 }
 
 GLuint RenderbufferInterface::getGreenSize() const
 {
     return dx2es::GetGreenSize(getD3DFormat());
@@ -47,22 +58,36 @@ GLuint RenderbufferInterface::getDepthSi
     return dx2es::GetDepthSize(getD3DFormat());
 }
 
 GLuint RenderbufferInterface::getStencilSize() const
 {
     return dx2es::GetStencilSize(getD3DFormat());
 }
 
-RenderbufferTexture::RenderbufferTexture(Texture *texture, GLenum target) : mTexture(texture), mTarget(target)
+RenderbufferTexture::RenderbufferTexture(Texture *texture, GLenum target) : mTarget(target)
 {
+    mTexture.set(texture);
 }
 
 RenderbufferTexture::~RenderbufferTexture()
 {
+    mTexture.set(NULL);
+}
+
+// Textures need to maintain their own reference count for references via
+// Renderbuffers acting as proxies. Here, we notify the texture of a reference.
+void RenderbufferTexture::addProxyRef(const Renderbuffer *proxy)
+{
+    mTexture->addProxyRef(proxy);
+}
+
+void RenderbufferTexture::releaseProxy(const Renderbuffer *proxy)
+{
+    mTexture->releaseProxy(proxy);
 }
 
 IDirect3DSurface9 *RenderbufferTexture::getRenderTarget()
 {
     return mTexture->getRenderTarget(mTarget);
 }
 
 IDirect3DSurface9 *RenderbufferTexture::getDepthStencil()
@@ -106,16 +131,32 @@ Renderbuffer::Renderbuffer(GLuint id, Re
     mInstance = instance;
 }
 
 Renderbuffer::~Renderbuffer()
 {
     delete mInstance;
 }
 
+// The RenderbufferInterface contained in this Renderbuffer may need to maintain
+// its own reference count, so we pass it on here.
+void Renderbuffer::addRef() const
+{
+    mInstance->addProxyRef(this);
+
+    RefCountObject::addRef();
+}
+
+void Renderbuffer::release() const
+{
+    mInstance->releaseProxy(this);
+
+    RefCountObject::release();
+}
+
 IDirect3DSurface9 *Renderbuffer::getRenderTarget()
 {
     return mInstance->getRenderTarget();
 }
 
 IDirect3DSurface9 *Renderbuffer::getDepthStencil()
 {
     return mInstance->getDepthStencil();
--- a/gfx/angle/src/libGLESv2/Renderbuffer.h
+++ b/gfx/angle/src/libGLESv2/Renderbuffer.h
@@ -12,31 +12,35 @@
 #ifndef LIBGLESV2_RENDERBUFFER_H_
 #define LIBGLESV2_RENDERBUFFER_H_
 
 #define GL_APICALL
 #include <GLES2/gl2.h>
 #include <d3d9.h>
 
 #include "common/angleutils.h"
-#include "libGLESv2/RefCountObject.h"
+#include "common/RefCountObject.h"
 
 namespace gl
 {
 class Texture;
+class Renderbuffer;
 class Colorbuffer;
 class DepthStencilbuffer;
 
 class RenderbufferInterface
 {
   public:
     RenderbufferInterface();
 
     virtual ~RenderbufferInterface() {};
 
+    virtual void addProxyRef(const Renderbuffer *proxy);
+    virtual void releaseProxy(const Renderbuffer *proxy);
+
     virtual IDirect3DSurface9 *getRenderTarget() = 0;
     virtual IDirect3DSurface9 *getDepthStencil() = 0;
 
     virtual GLsizei getWidth() const = 0;
     virtual GLsizei getHeight() const = 0;
     virtual GLenum getInternalFormat() const = 0;
     virtual D3DFORMAT getD3DFormat() const = 0;
     virtual GLsizei getSamples() const = 0;
@@ -56,31 +60,34 @@ class RenderbufferInterface
 
 class RenderbufferTexture : public RenderbufferInterface
 {
   public:
     RenderbufferTexture(Texture *texture, GLenum target);
 
     virtual ~RenderbufferTexture();
 
+    void addProxyRef(const Renderbuffer *proxy);
+    void releaseProxy(const Renderbuffer *proxy);
+
     IDirect3DSurface9 *getRenderTarget();
     IDirect3DSurface9 *getDepthStencil();
 
     virtual GLsizei getWidth() const;
     virtual GLsizei getHeight() const;
     virtual GLenum getInternalFormat() const;
     virtual D3DFORMAT getD3DFormat() const;
     virtual GLsizei getSamples() const;
 
     virtual unsigned int getSerial() const;
 
   private:
     DISALLOW_COPY_AND_ASSIGN(RenderbufferTexture);
 
-    Texture *mTexture;
+    BindingPointer <Texture> mTexture;
     GLenum mTarget;
 };
 
 // A class derived from RenderbufferStorage is created whenever glRenderbufferStorage
 // is called. The specific concrete type depends on whether the internal format is
 // colour depth, stencil or packed depth/stencil.
 class RenderbufferStorage : public RenderbufferInterface
 {
@@ -123,16 +130,23 @@ class RenderbufferStorage : public Rende
 // can change whenever glRenderbufferStorage is called.
 class Renderbuffer : public RefCountObject
 {
   public:
     Renderbuffer(GLuint id, RenderbufferInterface *storage);
 
     virtual ~Renderbuffer();
 
+    // These functions from RefCountObject are overloaded here because
+    // Textures need to maintain their own count of references to them via
+    // Renderbuffers/RenderbufferTextures. These functions invoke those
+    // reference counting functions on the RenderbufferInterface.
+    void addRef() const;
+    void release() const;
+
     IDirect3DSurface9 *getRenderTarget();
     IDirect3DSurface9 *getDepthStencil();
 
     GLsizei getWidth() const;
     GLsizei getHeight() const;
     GLenum getInternalFormat() const;
     D3DFORMAT getD3DFormat() const;
     GLuint getRedSize() const;
--- a/gfx/angle/src/libGLESv2/Shader.cpp
+++ b/gfx/angle/src/libGLESv2/Shader.cpp
@@ -42,16 +42,17 @@ Shader::Shader(ResourceManager *manager,
             resources.MaxVertexUniformVectors = MAX_VERTEX_UNIFORM_VECTORS;
             resources.MaxVaryingVectors = context->getMaximumVaryingVectors();
             resources.MaxVertexTextureImageUnits = context->getMaximumVertexTextureImageUnits();
             resources.MaxCombinedTextureImageUnits = context->getMaximumCombinedTextureImageUnits();
             resources.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
             resources.MaxFragmentUniformVectors = context->getMaximumFragmentUniformVectors();
             resources.MaxDrawBuffers = MAX_DRAW_BUFFERS;
             resources.OES_standard_derivatives = 1;
+            // resources.OES_EGL_image_external = getDisplay()->isD3d9ExDevice() ? 1 : 0; // TODO: commented out until the extension is actually supported.
 
             mFragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_GLES2_SPEC, SH_HLSL_OUTPUT, &resources);
             mVertexCompiler = ShConstructCompiler(SH_VERTEX_SHADER, SH_GLES2_SPEC, SH_HLSL_OUTPUT, &resources);
         }
     }
 
     mRefCount = 0;
     mDeleteStatus = false;
--- a/gfx/angle/src/libGLESv2/Texture.cpp
+++ b/gfx/angle/src/libGLESv2/Texture.cpp
@@ -1723,32 +1723,51 @@ unsigned int TextureStorage2D::getRender
 {
     return mRenderTargetSerial;
 }
 
 Texture2D::Texture2D(GLuint id) : Texture(id)
 {
     mTexStorage = NULL;
     mSurface = NULL;
+    mColorbufferProxy = NULL;
+    mProxyRefs = 0;
 }
 
 Texture2D::~Texture2D()
 {
-    mColorbufferProxy.set(NULL);
+    mColorbufferProxy = NULL;
 
     delete mTexStorage;
     mTexStorage = NULL;
     
     if (mSurface)
     {
         mSurface->setBoundTexture(NULL);
         mSurface = NULL;
     }
 }
 
+// We need to maintain a count of references to renderbuffers acting as 
+// proxies for this texture, so that we do not attempt to use a pointer 
+// to a renderbuffer proxy which has been deleted.
+void Texture2D::addProxyRef(const Renderbuffer *proxy)
+{
+    mProxyRefs++;
+}
+
+void Texture2D::releaseProxy(const Renderbuffer *proxy)
+{
+    if (mProxyRefs > 0)
+        mProxyRefs--;
+
+    if (mProxyRefs == 0)
+        mColorbufferProxy = NULL;
+}
+
 GLenum Texture2D::getTarget() const
 {
     return GL_TEXTURE_2D;
 }
 
 GLsizei Texture2D::getWidth(GLint level) const
 {
     if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
@@ -2295,22 +2314,22 @@ void Texture2D::generateMipmaps()
 
 Renderbuffer *Texture2D::getRenderbuffer(GLenum target)
 {
     if (target != GL_TEXTURE_2D)
     {
         return error(GL_INVALID_OPERATION, (Renderbuffer *)NULL);
     }
 
-    if (mColorbufferProxy.get() == NULL)
+    if (mColorbufferProxy == NULL)
     {
-        mColorbufferProxy.set(new Renderbuffer(id(), new RenderbufferTexture(this, target)));
+        mColorbufferProxy = new Renderbuffer(id(), new RenderbufferTexture(this, target));
     }
 
-    return mColorbufferProxy.get();
+    return mColorbufferProxy;
 }
 
 IDirect3DSurface9 *Texture2D::getRenderTarget(GLenum target)
 {
     ASSERT(target == GL_TEXTURE_2D);
 
     // ensure the underlying texture is created
     if (getStorage(true) == NULL)
@@ -2384,29 +2403,63 @@ IDirect3DBaseTexture9 *TextureStorageCub
 unsigned int TextureStorageCubeMap::getRenderTargetSerial(GLenum target) const
 {
     return mFirstRenderTargetSerial + TextureCubeMap::faceIndex(target);
 }
 
 TextureCubeMap::TextureCubeMap(GLuint id) : Texture(id)
 {
     mTexStorage = NULL;
+    for (int i = 0; i < 6; i++)
+    {
+        mFaceProxies[i] = NULL;
+        mFaceProxyRefs[i] = 0;
+    }
 }
 
 TextureCubeMap::~TextureCubeMap()
 {
     for (int i = 0; i < 6; i++)
     {
-        mFaceProxies[i].set(NULL);
+        mFaceProxies[i] = NULL;
     }
 
     delete mTexStorage;
     mTexStorage = NULL;
 }
 
+// We need to maintain a count of references to renderbuffers acting as 
+// proxies for this texture, so that the texture is not deleted while 
+// proxy references still exist. If the reference count drops to zero,
+// we set our proxy pointer NULL, so that a new attempt at referencing
+// will cause recreation.
+void TextureCubeMap::addProxyRef(const Renderbuffer *proxy)
+{
+    for (int i = 0; i < 6; i++)
+    {
+        if (mFaceProxies[i] == proxy)
+            mFaceProxyRefs[i]++;
+    }
+}
+
+void TextureCubeMap::releaseProxy(const Renderbuffer *proxy)
+{
+    for (int i = 0; i < 6; i++)
+    {
+        if (mFaceProxies[i] == proxy)
+        {
+            if (mFaceProxyRefs[i] > 0)
+                mFaceProxyRefs[i]--;
+
+            if (mFaceProxyRefs[i] == 0)
+                mFaceProxies[i] = NULL;
+        }
+    }
+}
+
 GLenum TextureCubeMap::getTarget() const
 {
     return GL_TEXTURE_CUBE_MAP;
 }
 
 GLsizei TextureCubeMap::getWidth(GLint level) const
 {
     if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
@@ -2996,22 +3049,22 @@ Renderbuffer *TextureCubeMap::getRenderb
 {
     if (!IsCubemapTextureTarget(target))
     {
         return error(GL_INVALID_OPERATION, (Renderbuffer *)NULL);
     }
 
     unsigned int face = faceIndex(target);
 
-    if (mFaceProxies[face].get() == NULL)
+    if (mFaceProxies[face] == NULL)
     {
-        mFaceProxies[face].set(new Renderbuffer(id(), new RenderbufferTexture(this, target)));
+        mFaceProxies[face] = new Renderbuffer(id(), new RenderbufferTexture(this, target));
     }
 
-    return mFaceProxies[face].get();
+    return mFaceProxies[face];
 }
 
 IDirect3DSurface9 *TextureCubeMap::getRenderTarget(GLenum target)
 {
     ASSERT(IsCubemapTextureTarget(target));
 
     // ensure the underlying texture is created
     if (getStorage(true) == NULL)
--- a/gfx/angle/src/libGLESv2/Texture.h
+++ b/gfx/angle/src/libGLESv2/Texture.h
@@ -12,20 +12,20 @@
 #define LIBGLESV2_TEXTURE_H_
 
 #include <vector>
 
 #define GL_APICALL
 #include <GLES2/gl2.h>
 #include <d3d9.h>
 
+#include "common/debug.h"
+#include "common/RefCountObject.h"
 #include "libGLESv2/Renderbuffer.h"
-#include "libGLESv2/RefCountObject.h"
 #include "libGLESv2/utilities.h"
-#include "common/debug.h"
 
 namespace egl
 {
 class Surface;
 }
 
 namespace gl
 {
@@ -168,16 +168,19 @@ class TextureStorage
 
 class Texture : public RefCountObject
 {
   public:
     explicit Texture(GLuint id);
 
     virtual ~Texture();
 
+    virtual void addProxyRef(const Renderbuffer *proxy) = 0;
+    virtual void releaseProxy(const Renderbuffer *proxy) = 0;
+
     virtual GLenum getTarget() const = 0;
 
     bool setMinFilter(GLenum filter);
     bool setMagFilter(GLenum filter);
     bool setWrapS(GLenum wrap);
     bool setWrapT(GLenum wrap);
     bool setUsage(GLenum usage);
 
@@ -273,16 +276,19 @@ class TextureStorage2D : public TextureS
 
 class Texture2D : public Texture
 {
   public:
     explicit Texture2D(GLuint id);
 
     ~Texture2D();
 
+    void addProxyRef(const Renderbuffer *proxy);
+    void releaseProxy(const Renderbuffer *proxy);
+
     virtual GLenum getTarget() const;
 
     virtual GLsizei getWidth(GLint level) const;
     virtual GLsizei getHeight(GLint level) const;
     virtual GLenum getInternalFormat() const;
     virtual GLenum getType() const;
     virtual D3DFORMAT getD3DFormat() const;
 
@@ -318,17 +324,23 @@ class Texture2D : public Texture
     void redefineImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLenum type);
     void commitRect(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
 
     Image mImageArray[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
 
     TextureStorage2D *mTexStorage;
     egl::Surface *mSurface;
 
-    BindingPointer<Renderbuffer> mColorbufferProxy;
+    // A specific internal reference count is kept for colorbuffer proxy references,
+    // because, as the renderbuffer acting as proxy will maintain a binding pointer
+    // back to this texture, there would be a circular reference if we used a binding
+    // pointer here. This reference count will cause the pointer to be set to NULL if
+    // the count drops to zero, but will not cause deletion of the Renderbuffer.
+    Renderbuffer *mColorbufferProxy;
+    unsigned int mProxyRefs;
 };
 
 class TextureStorageCubeMap : public TextureStorage
 {
   public:
     TextureStorageCubeMap(int levels, D3DFORMAT format, int size, bool renderTarget);
 
     virtual ~TextureStorageCubeMap();
@@ -347,16 +359,19 @@ class TextureStorageCubeMap : public Tex
 
 class TextureCubeMap : public Texture
 {
   public:
     explicit TextureCubeMap(GLuint id);
 
     ~TextureCubeMap();
 
+    void addProxyRef(const Renderbuffer *proxy);
+    void releaseProxy(const Renderbuffer *proxy);
+
     virtual GLenum getTarget() const;
     
     virtual GLsizei getWidth(GLint level) const;
     virtual GLsizei getHeight(GLint level) const;
     virtual GLenum getInternalFormat() const;
     virtual GLenum getType() const;
     virtual D3DFORMAT getD3DFormat() const;
 
@@ -400,13 +415,19 @@ class TextureCubeMap : public Texture
     void setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
     void commitRect(int faceIndex, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
     void redefineImage(int faceIndex, GLint level, GLenum format, GLsizei width, GLsizei height, GLenum type);
 
     Image mImageArray[6][IMPLEMENTATION_MAX_TEXTURE_LEVELS];
 
     TextureStorageCubeMap *mTexStorage;
 
-    BindingPointer<Renderbuffer> mFaceProxies[6];
+    // A specific internal reference count is kept for colorbuffer proxy references,
+    // because, as the renderbuffer acting as proxy will maintain a binding pointer
+    // back to this texture, there would be a circular reference if we used a binding
+    // pointer here. This reference count will cause the pointer to be set to NULL if
+    // the count drops to zero, but will not cause deletion of the Renderbuffer.
+    Renderbuffer *mFaceProxies[6];
+    unsigned int *mFaceProxyRefs[6];
 };
 }
 
 #endif   // LIBGLESV2_TEXTURE_H_
\ No newline at end of file
--- a/gfx/angle/src/libGLESv2/libGLESv2.cpp
+++ b/gfx/angle/src/libGLESv2/libGLESv2.cpp
@@ -22,16 +22,17 @@
 #include "libGLESv2/Buffer.h"
 #include "libGLESv2/Context.h"
 #include "libGLESv2/Fence.h"
 #include "libGLESv2/Framebuffer.h"
 #include "libGLESv2/Program.h"
 #include "libGLESv2/Renderbuffer.h"
 #include "libGLESv2/Shader.h"
 #include "libGLESv2/Texture.h"
+#include "libGLESv2/Query.h"
 
 bool validImageSize(GLint level, GLsizei width, GLsizei height)
 {
     if (level < 0 || width < 0 || height < 0)
     {
         return false;
     }
 
@@ -199,16 +200,49 @@ void __stdcall glAttachShader(GLuint pro
         }
     }
     catch(std::bad_alloc&)
     {
         return error(GL_OUT_OF_MEMORY);
     }
 }
 
+void __stdcall glBeginQueryEXT(GLenum target, GLuint id)
+{
+    EVENT("(GLenum target = 0x%X, GLuint %d)", target, id);
+
+    try
+    {
+        switch (target)
+        {
+          case GL_ANY_SAMPLES_PASSED_EXT: 
+          case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
+              break;
+          default: 
+              return error(GL_INVALID_ENUM);
+        }
+
+        if (id == 0)
+        {
+            return error(GL_INVALID_OPERATION);
+        }
+
+        gl::Context *context = gl::getNonLostContext();
+
+        if (context)
+        {
+            context->beginQuery(target, id);
+        }
+    }
+    catch(std::bad_alloc&)
+    {
+        return error(GL_OUT_OF_MEMORY);
+    }
+}
+
 void __stdcall glBindAttribLocation(GLuint program, GLuint index, const GLchar* name)
 {
     EVENT("(GLuint program = %d, GLuint index = %d, const GLchar* name = 0x%0.8p)", program, index, name);
 
     try
     {
         if (index >= gl::MAX_VERTEX_ATTRIBS)
         {
@@ -983,17 +1017,17 @@ void __stdcall glCompressedTexSubImage2D
 {
     EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
           "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, "
           "GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)",
           target, level, xoffset, yoffset, width, height, format, imageSize, data);
 
     try
     {
-        if (!gl::IsTextureTarget(target))
+        if (!gl::IsInternalTextureTarget(target))
         {
             return error(GL_INVALID_ENUM);
         }
 
         if (xoffset < 0 || yoffset < 0 || !validImageSize(level, width, height) || imageSize < 0)
         {
             return error(GL_INVALID_VALUE);
         }
@@ -1272,17 +1306,17 @@ void __stdcall glCopyTexImage2D(GLenum t
 void __stdcall glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
 {
     EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
           "GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
           target, level, xoffset, yoffset, x, y, width, height);
 
     try
     {
-        if (!gl::IsTextureTarget(target))
+        if (!gl::IsInternalTextureTarget(target))
         {
             return error(GL_INVALID_ENUM);
         }
 
         if (level < 0 || xoffset < 0 || yoffset < 0 || width < 0 || height < 0)
         {
             return error(GL_INVALID_VALUE);
         }
@@ -1588,16 +1622,43 @@ void __stdcall glDeleteProgram(GLuint pr
         }
     }
     catch(std::bad_alloc&)
     {
         return error(GL_OUT_OF_MEMORY);
     }
 }
 
+void __stdcall glDeleteQueriesEXT(GLsizei n, const GLuint *ids)
+{
+    EVENT("(GLsizei n = %d, const GLuint *ids = 0x%0.8p)", n, ids);
+
+    try
+    {
+        if (n < 0)
+        {
+            return error(GL_INVALID_VALUE);
+        }
+
+        gl::Context *context = gl::getNonLostContext();
+
+        if (context)
+        {
+            for (int i = 0; i < n; i++)
+            {
+                context->deleteQuery(ids[i]);
+            }
+        }
+    }
+    catch(std::bad_alloc&)
+    {
+        return error(GL_OUT_OF_MEMORY);
+    }
+}
+
 void __stdcall glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
 {
     EVENT("(GLsizei n = %d, const GLuint* renderbuffers = 0x%0.8p)", n, renderbuffers);
 
     try
     {
         if (n < 0)
         {
@@ -1982,16 +2043,44 @@ void __stdcall glEnableVertexAttribArray
         }
     }
     catch(std::bad_alloc&)
     {
         return error(GL_OUT_OF_MEMORY);
     }
 }
 
+void __stdcall glEndQueryEXT(GLenum target)
+{
+    EVENT("GLenum target = 0x%X)", target);
+
+    try
+    {
+        switch (target)
+        {
+          case GL_ANY_SAMPLES_PASSED_EXT: 
+          case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
+              break;
+          default: 
+              return error(GL_INVALID_ENUM);
+        }
+
+        gl::Context *context = gl::getNonLostContext();
+
+        if (context)
+        {
+            context->endQuery(target);
+        }
+    }
+    catch(std::bad_alloc&)
+    {
+        return error(GL_OUT_OF_MEMORY);
+    }
+}
+
 void __stdcall glFinishFenceNV(GLuint fence)
 {
     EVENT("(GLuint fence = %d)", fence);
 
     try
     {
         gl::Context *context = gl::getNonLostContext();
 
@@ -2360,16 +2449,43 @@ void __stdcall glGenFramebuffers(GLsizei
         }
     }
     catch(std::bad_alloc&)
     {
         return error(GL_OUT_OF_MEMORY);
     }
 }
 
+void __stdcall glGenQueriesEXT(GLsizei n, GLuint* ids)
+{
+    EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids);
+
+    try
+    {
+        if (n < 0)
+        {
+            return error(GL_INVALID_VALUE);
+        }
+
+        gl::Context *context = gl::getNonLostContext();
+
+        if (context)
+        {
+            for (int i = 0; i < n; i++)
+            {
+                ids[i] = context->createQuery();
+            }
+        }
+    }
+    catch(std::bad_alloc&)
+    {
+        return error(GL_OUT_OF_MEMORY);
+    }
+}
+
 void __stdcall glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
 {
     EVENT("(GLsizei n = %d, GLuint* renderbuffers = 0x%0.8p)", n, renderbuffers);
 
     try
     {
         if (n < 0)
         {
@@ -2855,17 +2971,17 @@ void __stdcall glGetFramebufferAttachmen
               default: return error(GL_INVALID_ENUM);
             }
 
             GLenum attachmentObjectType;   // Type category
             if (attachmentType == GL_NONE || attachmentType == GL_RENDERBUFFER)
             {
                 attachmentObjectType = attachmentType;
             }
-            else if (gl::IsTextureTarget(attachmentType))
+            else if (gl::IsInternalTextureTarget(attachmentType))
             {
                 attachmentObjectType = GL_TEXTURE;
             }
             else UNREACHABLE();
 
             switch (pname)
             {
               case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
@@ -3089,16 +3205,93 @@ void __stdcall glGetProgramInfoLog(GLuin
         }
     }
     catch(std::bad_alloc&)
     {
         return error(GL_OUT_OF_MEMORY);
     }
 }
 
+void __stdcall glGetQueryivEXT(GLenum target, GLenum pname, GLint *params)
+{
+    EVENT("GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname, params);
+
+    try
+    {
+        switch (pname)
+        {
+          case GL_CURRENT_QUERY_EXT:
+            break;
+          default:
+            return error(GL_INVALID_ENUM);
+        }
+
+        gl::Context *context = gl::getNonLostContext();
+
+        if (context)
+        {
+            params[0] = context->getActiveQuery(target);
+        }
+    }
+    catch(std::bad_alloc&)
+    {
+        return error(GL_OUT_OF_MEMORY);
+    }
+}
+
+void __stdcall glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params)
+{
+    EVENT("(GLuint id = %d, GLenum pname = 0x%X, GLuint *params = 0x%0.8p)", id, pname, params);
+
+    try
+    {
+        switch (pname)
+        {
+          case GL_QUERY_RESULT_EXT:
+          case GL_QUERY_RESULT_AVAILABLE_EXT:
+            break;
+          default:
+            return error(GL_INVALID_ENUM);
+        }
+        gl::Context *context = gl::getNonLostContext();
+
+        if (context)
+        {
+
+            gl::Query *queryObject = context->getQuery(id, false, GL_NONE);
+
+            if (!queryObject)
+            {
+                return error(GL_INVALID_OPERATION);
+            }
+
+            if (context->getActiveQuery(queryObject->getType()) == id)
+            {
+                return error(GL_INVALID_OPERATION);
+            }
+
+            switch(pname)
+            {
+              case GL_QUERY_RESULT_EXT:
+                params[0] = queryObject->getResult();
+                break;
+              case GL_QUERY_RESULT_AVAILABLE_EXT:
+                params[0] = queryObject->isResultAvailable();
+                break;
+              default:
+                ASSERT(false);
+            }
+        }
+    }
+    catch(std::bad_alloc&)
+    {
+        return error(GL_OUT_OF_MEMORY);
+    }
+}
+
 void __stdcall glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
 {
     EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params);
 
     try
     {
         gl::Context *context = gl::getNonLostContext();
 
@@ -3988,16 +4181,47 @@ GLboolean __stdcall glIsProgram(GLuint p
     catch(std::bad_alloc&)
     {
         return error(GL_OUT_OF_MEMORY, GL_FALSE);
     }
 
     return GL_FALSE;
 }
 
+GLboolean __stdcall glIsQueryEXT(GLuint id)
+{
+    EVENT("(GLuint id = %d)", id);
+
+    try
+    {
+        if (id == 0)
+        {
+            return GL_FALSE;
+        }
+
+        gl::Context *context = gl::getNonLostContext();
+
+        if (context)
+        {
+            gl::Query *queryObject = context->getQuery(id, false, GL_NONE);
+
+            if (queryObject)
+            {
+                return GL_TRUE;
+            }
+        }
+    }
+    catch(std::bad_alloc&)
+    {
+        return error(GL_OUT_OF_MEMORY, GL_FALSE);
+    }
+
+    return GL_FALSE;
+}
+
 GLboolean __stdcall glIsRenderbuffer(GLuint renderbuffer)
 {
     EVENT("(GLuint renderbuffer = %d)", renderbuffer);
 
     try
     {
         gl::Context *context = gl::getNonLostContext();
 
@@ -5163,17 +5387,17 @@ void __stdcall glTexSubImage2D(GLenum ta
 {
     EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
           "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, GLenum type = 0x%X, "
           "const GLvoid* pixels = 0x%0.8p)",
            target, level, xoffset, yoffset, width, height, format, type, pixels);
 
     try
     {
-        if (!gl::IsTextureTarget(target))
+        if (!gl::IsInternalTextureTarget(target))
         {
             return error(GL_INVALID_ENUM);
         }
 
         if (level < 0 || xoffset < 0 || yoffset < 0 || width < 0 || height < 0)
         {
             return error(GL_INVALID_VALUE);
         }
@@ -6159,16 +6383,23 @@ void __stdcall glTexImage3DOES(GLenum ta
         {"glFinishFenceNV", (__eglMustCastToProperFunctionPointerType)glFinishFenceNV},
         {"glSetFenceNV", (__eglMustCastToProperFunctionPointerType)glSetFenceNV},
         {"glGetTranslatedShaderSourceANGLE", (__eglMustCastToProperFunctionPointerType)glGetTranslatedShaderSourceANGLE},
         {"glTexStorage2DEXT", (__eglMustCastToProperFunctionPointerType)glTexStorage2DEXT},
         {"glGetGraphicsResetStatusEXT", (__eglMustCastToProperFunctionPointerType)glGetGraphicsResetStatusEXT},
         {"glReadnPixelsEXT", (__eglMustCastToProperFunctionPointerType)glReadnPixelsEXT},
         {"glGetnUniformfvEXT", (__eglMustCastToProperFunctionPointerType)glGetnUniformfvEXT},
         {"glGetnUniformivEXT", (__eglMustCastToProperFunctionPointerType)glGetnUniformivEXT},
+        {"glGenQueriesEXT", (__eglMustCastToProperFunctionPointerType)glGenQueriesEXT},
+        {"glDeleteQueriesEXT", (__eglMustCastToProperFunctionPointerType)glDeleteQueriesEXT},
+        {"glIsQueryEXT", (__eglMustCastToProperFunctionPointerType)glIsQueryEXT},
+        {"glBeginQueryEXT", (__eglMustCastToProperFunctionPointerType)glBeginQueryEXT},
+        {"glEndQueryEXT", (__eglMustCastToProperFunctionPointerType)glEndQueryEXT},
+        {"glGetQueryivEXT", (__eglMustCastToProperFunctionPointerType)glGetQueryivEXT},
+        {"glGetQueryObjectuivEXT", (__eglMustCastToProperFunctionPointerType)glGetQueryObjectuivEXT},
     };
 
     for (int ext = 0; ext < sizeof(glExtensions) / sizeof(Extension); ext++)
     {
         if (strcmp(procname, glExtensions[ext].name) == 0)
         {
             return (__eglMustCastToProperFunctionPointerType)glExtensions[ext].address;
         }
--- a/gfx/angle/src/libGLESv2/libGLESv2.def
+++ b/gfx/angle/src/libGLESv2/libGLESv2.def
@@ -155,16 +155,23 @@ EXPORTS
     glSetFenceNV                    @156
     glTestFenceNV                   @157
     glGetTranslatedShaderSourceANGLE @159
     glTexStorage2DEXT               @160
     glGetGraphicsResetStatusEXT     @161
     glReadnPixelsEXT                @162
     glGetnUniformfvEXT              @163
     glGetnUniformivEXT              @164
+    glGenQueriesEXT                 @165
+    glDeleteQueriesEXT              @166
+    glIsQueryEXT                    @167
+    glBeginQueryEXT                 @168
+    glEndQueryEXT                   @169
+    glGetQueryivEXT                 @170
+    glGetQueryObjectuivEXT          @171
 
     ; EGL dependencies
     glCreateContext                 @144 NONAME
     glDestroyContext                @145 NONAME
     glMakeCurrent                   @146 NONAME
     glGetCurrentContext             @147 NONAME
     glGetProcAddress                @148 NONAME
     glBindTexImage                  @158 NONAME
--- a/gfx/angle/src/libGLESv2/utilities.cpp
+++ b/gfx/angle/src/libGLESv2/utilities.cpp
@@ -323,17 +323,17 @@ int ComputePixelSize(GLenum format, GLen
     return 0;
 }
 
 bool IsCubemapTextureTarget(GLenum target)
 {
     return (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z);
 }
 
-bool IsTextureTarget(GLenum target)
+bool IsInternalTextureTarget(GLenum target)
 {
     return target == GL_TEXTURE_2D || IsCubemapTextureTarget(target);
 }
 
 // Verify that format/type are one of the combinations from table 3.4.
 bool CheckTextureFormatType(GLenum format, GLenum type)
 {
     switch (type)
--- a/gfx/angle/src/libGLESv2/utilities.h
+++ b/gfx/angle/src/libGLESv2/utilities.h
@@ -32,17 +32,17 @@ int VariableColumnCount(GLenum type);
 int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize);
 
 int ComputePixelSize(GLenum format, GLenum type);
 GLsizei ComputePitch(GLsizei width, GLenum format, GLenum type, GLint alignment);
 GLsizei ComputeCompressedPitch(GLsizei width, GLenum format);
 GLsizei ComputeCompressedSize(GLsizei width, GLsizei height, GLenum format);
 bool IsCompressed(GLenum format);
 bool IsCubemapTextureTarget(GLenum target);
-bool IsTextureTarget(GLenum target);
+bool IsInternalTextureTarget(GLenum target);
 bool CheckTextureFormatType(GLenum format, GLenum type);
 GLenum ExtractFormat(GLenum internalformat);
 GLenum ExtractType(GLenum internalformat);
 
 bool IsColorRenderable(GLenum internalformat);
 bool IsDepthRenderable(GLenum internalformat);
 bool IsStencilRenderable(GLenum internalformat);