[ANGLE] Update ANGLE in WebKit
https://bugs.webkit.org/show_bug.cgi?id=106274

Reviewed by Dean Jackson.

Update ANGLE to r1641.

Source/ThirdParty/ANGLE: 

ANGLE parsers were generated with Bison 2.3.

Additionally, perform the following changes to WebKit's ANGLE build system. Note that these
changes only apply to WebKit's copy of ANGLE, and do not need to be upstreamed to ANGLE.
(a) Remove all files in the libEGL and libGLESv2 directories because nobody is using them. 
    Add a README in each directory to explain why their contents are not copied over from
    ANGLE. This simplifies updating ANGLE in the future.
(b) Remove the build_angle.xcodeproj file that no-one is using. It appears it was copied
    over from a gyp build of ANGLE. The Mac build uses ANGLE.xcodeproj.
(c) Remove duplicate file entries in ANGLE.xcodeproj. Change its Xcode group structure to
    match ANGLE's directory structure.
(d) Add a Copy Files task to ANGLE.xcodeproj to put the khrplatform.h header in the right
    place so ShaderLang.h can find it. ShaderLang.h is copied to
    <BuildDir>/usr/local/include/ANGLE/ShaderLang.h during the Copy Headers task, and it
    includes "KHR/khrplatform.h". Thus, we need to copy khrplatform.h to
    <BuildDir>/usr/local/include/ANGLE/KHR/khrplatform.h.

Additionally, make one build fix in ANGLE source that should be upstreamed to ANGLE:
(1) Before this patch in ExpressionParser.y, we toggled the "-Wpragmas" flag so compilers
    could ignore the pragmas that they didn't understand instead of generating an error.
    However, clang does not understand "-Wpragmas" itself. Instead, tt understands
    "-Wunknown-pragmas". Now, instead of trying to temporarily ignore pragmas, we apply the
    right flags to the right compiler versions. The new code in ExpressionParser.y looks
    like:

"""
// Turn off uninitialized variable warnings triggered by the auto-generated pplval variable.
// On gcc 4.7+, The flag is called "-Wmaybe-uninitialized".
// On clang and gcc < 4.7, the flag is called "-Wuninitialized".
#if !defined(__clang__) && ((__GNUC__ == 4 && __GNU_C_MINOR__ >= 7) || __GNUC__ >= 5)
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#else
#pragma GCC diagnostic ignored "-Wuninitialized"
#endif
"""

* ANGLE.plist:
* ANGLE.pri:
* ANGLE.xcodeproj/project.pbxproj:
* DerivedSources.pri:
* Target.pri:
* include/GLSLANG/ShaderLang.h:
* src/build_angle.xcodeproj/project.pbxproj: Removed.
* src/common/angleutils.h:
* src/common/debug.cpp:
(gl::ScopedPerfEventHelper::ScopedPerfEventHelper):
* src/common/debug.h:
* src/common/version.h:
* src/compiler/Compiler.cpp:
(TCompiler::Init):
(TCompiler::compile):
(TCompiler::clearResults):
(TCompiler::collectAttribsUniforms):
(TCompiler::enforcePackingRestrictions):
* src/compiler/Diagnostics.cpp:
(TDiagnostics::TDiagnostics):
(TDiagnostics::writeInfo):
(TDiagnostics::print):
* src/compiler/Diagnostics.h:
(TDiagnostics::numErrors):
(TDiagnostics::numWarnings):
(TDiagnostics):
* src/compiler/DirectiveHandler.h:
* src/compiler/HashNames.h: Added.
* src/compiler/Intermediate.cpp:
(TIntermTraverser::hash):
* src/compiler/OutputESSL.cpp:
(TOutputESSL::TOutputESSL):
* src/compiler/OutputESSL.h:
(TOutputESSL):
* src/compiler/OutputGLSL.cpp:
(TOutputGLSL::TOutputGLSL):
* src/compiler/OutputGLSL.h:
(TOutputGLSL):
* src/compiler/OutputGLSLBase.cpp:
(TOutputGLSLBase::TOutputGLSLBase):
(TOutputGLSLBase::writeVariableType):
(TOutputGLSLBase::writeFunctionParameters):
(TOutputGLSLBase::writeConstantUnion):
(TOutputGLSLBase::visitSymbol):
(TOutputGLSLBase::visitBinary):
(TOutputGLSLBase::visitAggregate):
(TOutputGLSLBase::getTypeName):
(TOutputGLSLBase::hashName):
(TOutputGLSLBase::hashVariableName):
(TOutputGLSLBase::hashFunctionName):
* src/compiler/OutputGLSLBase.h:
(TOutputGLSLBase):
* src/compiler/OutputHLSL.cpp:
(sh::OutputHLSL::OutputHLSL):
(sh::OutputHLSL::header):
(sh::OutputHLSL::visitAggregate):
(sh::OutputHLSL::visitBranch):
(sh::OutputHLSL::handleExcessiveLoop):
* src/compiler/OutputHLSL.h:
(OutputHLSL):
* src/compiler/ParseHelper.cpp:
(TParseContext::error):
(TParseContext::nonInitConstErrorCheck):
(PaParseStrings):
* src/compiler/ParseHelper.h:
(TParseContext::TParseContext):
(TParseContext):
(TParseContext::numErrors):
* src/compiler/RenameFunction.h:
(RenameFunction::visitAggregate):
* src/compiler/ShHandle.h:
(TCompiler::getHashFunction):
(TCompiler::getNameMap):
(TCompiler::getSymbolTable):
(TCompiler):
* src/compiler/ShaderLang.cpp:
(ShInitBuiltInResources):
(ShGetInfo):
(ShGetNameHashingEntry):
* src/compiler/SymbolTable.cpp:
(TType::TType):
(TType::isStructureContainingArrays):
* src/compiler/SymbolTable.h:
(TSymbolTable::findBuiltIn):
(TSymbolTable):
* src/compiler/TranslatorESSL.cpp:
(TranslatorESSL::translate):
* src/compiler/TranslatorGLSL.cpp:
(TranslatorGLSL::translate):
* src/compiler/Types.h:
(TType):
(TPublicType):
(TPublicType::setBasic):
(TPublicType::setAggregate):
(TPublicType::setArray):
(TPublicType::isStructureContainingArrays):
* src/compiler/UnfoldShortCircuit.cpp:
(sh::UnfoldShortCircuit::visitBinary):
* src/compiler/VariableInfo.cpp:
(getVariableInfo):
(getUserDefinedVariableInfo):
(TVariableInfo::TVariableInfo):
(CollectAttribsUniforms::CollectAttribsUniforms):
(CollectAttribsUniforms::visitAggregate):
* src/compiler/VariableInfo.h:
(TVariableInfo):
(CollectAttribsUniforms):
* src/compiler/VariablePacker.cpp: Added.
(VariablePacker::GetNumComponentsPerRow):
(VariablePacker::GetNumRows):
(TVariableInfoComparer::operator()):
(VariablePacker::makeColumnFlags):
(VariablePacker::fillColumns):
(VariablePacker::searchColumn):
(VariablePacker::CheckVariablesWithinPackingLimits):
* src/compiler/VariablePacker.h: Added.
(VariablePacker):
* src/compiler/VersionGLSL.cpp:
(TVersionGLSL::visitAggregate):
* src/compiler/VersionGLSL.h:
(TVersionGLSL):
* src/compiler/glslang.l:
* src/compiler/glslang.y:
* src/compiler/glslang_lex.cpp:
(string_input):
(glslang_finalize):
(glslang_scan):
* src/compiler/glslang_tab.cpp:
* src/compiler/intermediate.h:
(TIntermTraverser):
* src/compiler/osinclude.h:
(OS_GetTLSValue):
* src/compiler/ossource_nspr.cpp:
* src/compiler/preprocessor/DiagnosticsBase.cpp: Added.
(pp):
(pp::Diagnostics::~Diagnostics):
(pp::Diagnostics::report):
(pp::Diagnostics::severity):
(pp::Diagnostics::message):
* src/compiler/preprocessor/DiagnosticsBase.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Diagnostics.h.
(pp):
(Diagnostics):
* src/compiler/preprocessor/DirectiveHandlerBase.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveHandlerBase.cpp.
(pp):
(pp::DirectiveHandler::~DirectiveHandler):
* src/compiler/preprocessor/DirectiveHandlerBase.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveHandler.h.
(pp):
(DirectiveHandler):
* src/compiler/preprocessor/DirectiveParser.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveParser.cpp.
(getDirective):
(isConditionalDirective):
(isEOD):
(skipUntilEOD):
(isMacroNameReserved):
(isMacroPredefined):
(pp):
(DefinedParser):
(pp::DefinedParser::DefinedParser):
(pp::DefinedParser::lex):
(pp::DirectiveParser::DirectiveParser):
(pp::DirectiveParser::lex):
(pp::DirectiveParser::parseDirective):
(pp::DirectiveParser::parseDefine):
(pp::DirectiveParser::parseUndef):
(pp::DirectiveParser::parseIf):
(pp::DirectiveParser::parseIfdef):
(pp::DirectiveParser::parseIfndef):
(pp::DirectiveParser::parseElse):
(pp::DirectiveParser::parseElif):
(pp::DirectiveParser::parseEndif):
(pp::DirectiveParser::parseError):
(pp::DirectiveParser::parsePragma):
(pp::DirectiveParser::parseExtension):
(pp::DirectiveParser::parseVersion):
(pp::DirectiveParser::parseLine):
(pp::DirectiveParser::skipping):
(pp::DirectiveParser::parseConditionalIf):
(pp::DirectiveParser::parseExpressionIf):
(pp::DirectiveParser::parseExpressionIfdef):
* src/compiler/preprocessor/DirectiveParser.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveParser.h.
(pp):
(DirectiveParser):
(ConditionalBlock):
(pp::DirectiveParser::ConditionalBlock::ConditionalBlock):
* src/compiler/preprocessor/ExpressionParser.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/ExpressionParser.cpp.
(yysyntax_error):
(yylex):
(yyerror):
(pp):
(pp::ExpressionParser::ExpressionParser):
(pp::ExpressionParser::parse):
* src/compiler/preprocessor/ExpressionParser.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/ExpressionParser.h.
(pp):
(ExpressionParser):
* src/compiler/preprocessor/ExpressionParser.y: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/ExpressionParser.y.
* src/compiler/preprocessor/Input.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Input.cpp.
(pp):
(pp::Input::Input):
(pp::Input::read):
* src/compiler/preprocessor/Input.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Input.h.
(pp):
(Input):
(pp::Input::count):
(pp::Input::string):
(pp::Input::length):
(Location):
(pp::Input::Location::Location):
(pp::Input::readLoc):
* src/compiler/preprocessor/Lexer.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Lexer.cpp.
(pp):
(pp::Lexer::~Lexer):
* src/compiler/preprocessor/Lexer.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Lexer.h.
(pp):
(Lexer):
* src/compiler/preprocessor/Macro.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Macro.cpp.
(pp):
(pp::Macro::equals):
* src/compiler/preprocessor/Macro.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Macro.h.
(pp):
(pp::Macro::Macro):
(Macro):
* src/compiler/preprocessor/MacroExpander.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/MacroExpander.cpp.
(pp):
(TokenLexer):
(pp::TokenLexer::TokenLexer):
(pp::TokenLexer::lex):
(pp::MacroExpander::MacroExpander):
(pp::MacroExpander::~MacroExpander):
(pp::MacroExpander::lex):
(pp::MacroExpander::getToken):
(pp::MacroExpander::ungetToken):
(pp::MacroExpander::isNextTokenLeftParen):
(pp::MacroExpander::pushMacro):
(pp::MacroExpander::popMacro):
(pp::MacroExpander::expandMacro):
(pp::MacroExpander::collectMacroArgs):
(pp::MacroExpander::replaceMacroParams):
* src/compiler/preprocessor/MacroExpander.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/MacroExpander.h.
(pp):
(MacroExpander):
(MacroContext):
(pp::MacroExpander::MacroContext::MacroContext):
(pp::MacroExpander::MacroContext::empty):
(pp::MacroExpander::MacroContext::get):
(pp::MacroExpander::MacroContext::unget):
* src/compiler/preprocessor/Preprocessor.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Preprocessor.cpp.
(pp):
(PreprocessorImpl):
(pp::PreprocessorImpl::PreprocessorImpl):
(pp::Preprocessor::Preprocessor):
(pp::Preprocessor::~Preprocessor):
(pp::Preprocessor::init):
(pp::Preprocessor::predefineMacro):
(pp::Preprocessor::lex):
* src/compiler/preprocessor/Preprocessor.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Preprocessor.h.
(pp):
(Preprocessor):
* src/compiler/preprocessor/SourceLocation.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/SourceLocation.h.
(pp):
(pp::SourceLocation::SourceLocation):
(SourceLocation):
(pp::SourceLocation::equals):
(pp::operator==):
(pp::operator!=):
* src/compiler/preprocessor/Token.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Token.cpp.
(pp):
(pp::Token::reset):
(pp::Token::equals):
(pp::Token::setAtStartOfLine):
(pp::Token::setHasLeadingSpace):
(pp::Token::setExpansionDisabled):
(pp::Token::iValue):
(pp::Token::uValue):
(pp::Token::fValue):
(pp::operator<<):
* src/compiler/preprocessor/Token.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Token.h.
(pp):
(pp::Token::Token):
(Token):
(pp::Token::atStartOfLine):
(pp::Token::hasLeadingSpace):
(pp::Token::expansionDisabled):
(pp::operator==):
(pp::operator!=):
* src/compiler/preprocessor/Tokenizer.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Tokenizer.cpp.
(yy_buffer_state):
(yy_trans_info):
(yyguts_t):
(yy_get_previous_state):
(yy_try_NUL_trans):
(input):
(pprestart):
(pp_switch_to_buffer):
(pp_load_buffer_state):
(pp_create_buffer):
(pp_delete_buffer):
(pp_init_buffer):
(pp_flush_buffer):
(pppush_buffer_state):
(pppop_buffer_state):
(ppensure_buffer_stack):
(pp_scan_buffer):
(pp_scan_string):
(pp_scan_bytes):
(yy_fatal_error):
(ppget_extra):
(ppget_lineno):
(ppget_column):
(ppget_in):
(ppget_out):
(ppget_leng):
(ppget_text):
(ppset_extra):
(ppset_lineno):
(ppset_column):
(ppset_in):
(ppset_out):
(ppget_debug):
(ppset_debug):
(ppget_lval):
(ppset_lval):
(ppget_lloc):
(ppset_lloc):
(pplex_init):
(pplex_init_extra):
(yy_init_globals):
(pplex_destroy):
(yy_flex_strncpy):
(yy_flex_strlen):
(ppalloc):
(pprealloc):
(ppfree):
(pp):
(pp::Tokenizer::Tokenizer):
(pp::Tokenizer::~Tokenizer):
(pp::Tokenizer::init):
(pp::Tokenizer::setFileNumber):
(pp::Tokenizer::setLineNumber):
(pp::Tokenizer::lex):
(pp::Tokenizer::initScanner):
(pp::Tokenizer::destroyScanner):
* src/compiler/preprocessor/Tokenizer.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Tokenizer.h.
(pp):
(Tokenizer):
(Context):
* src/compiler/preprocessor/Tokenizer.l: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Tokenizer.l.
* src/compiler/preprocessor/atom.c: Removed.
* src/compiler/preprocessor/atom.h: Removed.
* src/compiler/preprocessor/compile.h: Removed.
* src/compiler/preprocessor/cpp.c: Removed.
* src/compiler/preprocessor/cpp.h: Removed.
* src/compiler/preprocessor/cppstruct.c: Removed.
* src/compiler/preprocessor/generate_parser.sh: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/generate_parser.sh.
* src/compiler/preprocessor/memory.c: Removed.
* src/compiler/preprocessor/memory.h: Removed.
* src/compiler/preprocessor/new/DiagnosticsBase.cpp: Removed.
* src/compiler/preprocessor/new/new_file.cpp: Removed.
* src/compiler/preprocessor/new/new_file2.cpp: Removed.
* src/compiler/preprocessor/new/preprocessor.vcproj: Removed.
* src/compiler/preprocessor/numeric_lex.h: Added.
(pp):
(pp::numeric_base_int):
(pp::numeric_lex_int):
(pp::numeric_lex_float):
* src/compiler/preprocessor/parser.h: Removed.
* src/compiler/preprocessor/pp_utils.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/pp_utils.h.
* src/compiler/preprocessor/preprocess.h: Removed.
* src/compiler/preprocessor/scanner.c: Removed.
* src/compiler/preprocessor/scanner.h: Removed.
* src/compiler/preprocessor/slglobals.h: Removed.
* src/compiler/preprocessor/symbols.c: Removed.
* src/compiler/preprocessor/symbols.h: Removed.
* src/compiler/preprocessor/tokens.c: Removed.
* src/compiler/preprocessor/tokens.h: Removed.
* src/libEGL/Config.cpp: Removed.
* src/libEGL/Config.h: Removed.
* src/libEGL/Display.cpp: Removed.
* src/libEGL/Display.h: Removed.
* src/libEGL/README: Added.
* src/libEGL/Surface.cpp: Removed.
* src/libEGL/Surface.h: Removed.
* src/libEGL/libEGL.cpp: Removed.
* src/libEGL/libEGL.def: Removed.
* src/libEGL/libEGL.rc: Removed.
* src/libEGL/libEGL.vcproj: Removed.
* src/libEGL/main.cpp: Removed.
* src/libEGL/main.h: Removed.
* src/libEGL/resource.h: Removed.
* src/libGLESv2/Blit.cpp: Removed.
* src/libGLESv2/Blit.h: Removed.
* src/libGLESv2/Buffer.cpp: Removed.
* src/libGLESv2/Buffer.h: Removed.
* src/libGLESv2/Context.cpp: Removed.
* src/libGLESv2/Context.h: Removed.
* src/libGLESv2/Fence.cpp: Removed.
* src/libGLESv2/Fence.h: Removed.
* src/libGLESv2/Framebuffer.cpp: Removed.
* src/libGLESv2/Framebuffer.h: Removed.
* src/libGLESv2/HandleAllocator.cpp: Removed.
* src/libGLESv2/HandleAllocator.h: Removed.
* src/libGLESv2/IndexDataManager.cpp: Removed.
* src/libGLESv2/IndexDataManager.h: Removed.
* src/libGLESv2/Program.cpp: Removed.
* src/libGLESv2/Program.h: Removed.
* src/libGLESv2/ProgramBinary.cpp: Removed.
* src/libGLESv2/ProgramBinary.h: Removed.
* src/libGLESv2/Query.cpp: Removed.
* src/libGLESv2/Query.h: Removed.
* src/libGLESv2/README: Added.
* src/libGLESv2/Renderbuffer.cpp: Removed.
* src/libGLESv2/Renderbuffer.h: Removed.
* src/libGLESv2/ResourceManager.cpp: Removed.
* src/libGLESv2/ResourceManager.h: Removed.
* src/libGLESv2/Shader.cpp: Removed.
* src/libGLESv2/Shader.h: Removed.
* src/libGLESv2/Texture.cpp: Removed.
* src/libGLESv2/Texture.h: Removed.
* src/libGLESv2/VertexDataManager.cpp: Removed.
* src/libGLESv2/VertexDataManager.h: Removed.
* src/libGLESv2/libGLESv2.cpp: Removed.
* src/libGLESv2/libGLESv2.def: Removed.
* src/libGLESv2/libGLESv2.rc: Removed.
* src/libGLESv2/libGLESv2.vcproj: Removed.
* src/libGLESv2/main.cpp: Removed.
* src/libGLESv2/main.h: Removed.
* src/libGLESv2/mathutil.h: Removed.
* src/libGLESv2/resource.h: Removed.
* src/libGLESv2/utilities.cpp: Removed.
* src/libGLESv2/utilities.h: Removed.
* src/libGLESv2/vertexconversion.h: Removed.

Source/WebCore: 

Update the files used in the EFL and GTK builds.

No new tests. No change in behavior.

* CMakeLists.txt:
* GNUmakefile.list.am:

Source/WebKit: 

* PlatformEfl.cmake: Add ANGLE/include to the include directories list because ShaderLang.h
now includes "KHR/khrplatform.h", which is located in ANGLE/include/KHR/khrplatform.h.

Source/WebKit2: 

* PlatformEfl.cmake: Add ANGLE/include to the include directories list because ShaderLang.h
now includes "KHR/khrplatform.h", which is located in ANGLE/include/KHR/khrplatform.h.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139665 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/ThirdParty/ANGLE/ANGLE.plist b/Source/ThirdParty/ANGLE/ANGLE.plist
index 5bc9ff8..809891c 100644
--- a/Source/ThirdParty/ANGLE/ANGLE.plist
+++ b/Source/ThirdParty/ANGLE/ANGLE.plist
@@ -1,22 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
-    <array>
-        <dict>
-            <key>OpenSourceProject</key>
-            <string>ANGLE</string>
-            <key>OpenSourceVersion</key>
-            <string>r1170</string>
-            <key>OpenSourceWebsiteURL</key>
-            <string>http://code.google.com/p/angleproject/</string>
-            <key>OpenSourceSCM</key>
-            <string>svn co -r1170 http://angleproject.googlecode.com/svn/trunk/</string>
-            <key>OpenSourceImportDate</key>
-            <string>2012-06-17</string>
-            <key>OpenSourceLicense</key>
-            <string>BSD</string>
-            <key>OpenSourceLicenseFile</key>
-            <string>ANGLE.txt</string>
-        </dict>
-    </array>
-</plist>
\ No newline at end of file
+<array>
+	<dict>
+		<key>OpenSourceProject</key>
+		<string>ANGLE</string>
+		<key>OpenSourceVersion</key>
+		<string>r1641</string>
+		<key>OpenSourceWebsiteURL</key>
+		<string>http://code.google.com/p/angleproject/</string>
+		<key>OpenSourceSCM</key>
+		<string>svn co -r1641 http://angleproject.googlecode.com/svn/trunk/</string>
+		<key>OpenSourceImportDate</key>
+		<string>2013-01-04</string>
+		<key>OpenSourceLicense</key>
+		<string>BSD</string>
+		<key>OpenSourceLicenseFile</key>
+		<string>ANGLE.txt</string>
+	</dict>
+</array>
+</plist>
diff --git a/Source/ThirdParty/ANGLE/ANGLE.pri b/Source/ThirdParty/ANGLE/ANGLE.pri
index 2f7b700..2bc7fa5 100644
--- a/Source/ThirdParty/ANGLE/ANGLE.pri
+++ b/Source/ThirdParty/ANGLE/ANGLE.pri
@@ -8,5 +8,6 @@
 SOURCE_DIR = $${ROOT_WEBKIT_DIR}/Source/ThirdParty/ANGLE
 
 INCLUDEPATH += \
-    $$SOURCE_DIR/include/GLSLANG
+    $$SOURCE_DIR/include/GLSLANG \
+    $$SOURCE_DIR/include
 
diff --git a/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj b/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj
index 3207eca..5113b79 100644
--- a/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj
+++ b/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj
@@ -42,6 +42,35 @@
 		A0AABE4513AFE94500F2EBD1 /* OutputESSL.h in Headers */ = {isa = PBXBuildFile; fileRef = A0AABE4313AFE94500F2EBD1 /* OutputESSL.h */; };
 		A0AABE4813AFE96100F2EBD1 /* TranslatorESSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0AABE4613AFE96100F2EBD1 /* TranslatorESSL.cpp */; };
 		A0AABE4913AFE96100F2EBD1 /* TranslatorESSL.h in Headers */ = {isa = PBXBuildFile; fileRef = A0AABE4713AFE96100F2EBD1 /* TranslatorESSL.h */; };
+		A264F8AC16974DED006FAA5A /* DiagnosticsBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A264F89316974DED006FAA5A /* DiagnosticsBase.cpp */; };
+		A264F8AD16974DED006FAA5A /* DiagnosticsBase.h in Headers */ = {isa = PBXBuildFile; fileRef = A264F89416974DED006FAA5A /* DiagnosticsBase.h */; };
+		A264F8AE16974DED006FAA5A /* DirectiveHandlerBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A264F89516974DED006FAA5A /* DirectiveHandlerBase.cpp */; };
+		A264F8AF16974DED006FAA5A /* DirectiveHandlerBase.h in Headers */ = {isa = PBXBuildFile; fileRef = A264F89616974DED006FAA5A /* DirectiveHandlerBase.h */; };
+		A264F8B016974DED006FAA5A /* DirectiveParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A264F89716974DED006FAA5A /* DirectiveParser.cpp */; };
+		A264F8B116974DED006FAA5A /* DirectiveParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A264F89816974DED006FAA5A /* DirectiveParser.h */; };
+		A264F8B216974DED006FAA5A /* ExpressionParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A264F89916974DED006FAA5A /* ExpressionParser.cpp */; };
+		A264F8B316974DED006FAA5A /* ExpressionParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A264F89A16974DED006FAA5A /* ExpressionParser.h */; };
+		A264F8B416974DED006FAA5A /* Input.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A264F89B16974DED006FAA5A /* Input.cpp */; };
+		A264F8B516974DED006FAA5A /* Input.h in Headers */ = {isa = PBXBuildFile; fileRef = A264F89C16974DED006FAA5A /* Input.h */; };
+		A264F8B616974DED006FAA5A /* Lexer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A264F89D16974DED006FAA5A /* Lexer.cpp */; };
+		A264F8B716974DED006FAA5A /* Lexer.h in Headers */ = {isa = PBXBuildFile; fileRef = A264F89E16974DED006FAA5A /* Lexer.h */; };
+		A264F8B816974DED006FAA5A /* Macro.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A264F89F16974DED006FAA5A /* Macro.cpp */; };
+		A264F8B916974DED006FAA5A /* Macro.h in Headers */ = {isa = PBXBuildFile; fileRef = A264F8A016974DED006FAA5A /* Macro.h */; };
+		A264F8BA16974DED006FAA5A /* MacroExpander.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A264F8A116974DED006FAA5A /* MacroExpander.cpp */; };
+		A264F8BB16974DED006FAA5A /* MacroExpander.h in Headers */ = {isa = PBXBuildFile; fileRef = A264F8A216974DED006FAA5A /* MacroExpander.h */; };
+		A264F8BC16974DED006FAA5A /* numeric_lex.h in Headers */ = {isa = PBXBuildFile; fileRef = A264F8A316974DED006FAA5A /* numeric_lex.h */; };
+		A264F8BD16974DED006FAA5A /* pp_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = A264F8A416974DED006FAA5A /* pp_utils.h */; };
+		A264F8BE16974DED006FAA5A /* Preprocessor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A264F8A516974DED006FAA5A /* Preprocessor.cpp */; };
+		A264F8BF16974DED006FAA5A /* Preprocessor.h in Headers */ = {isa = PBXBuildFile; fileRef = A264F8A616974DED006FAA5A /* Preprocessor.h */; };
+		A264F8C016974DED006FAA5A /* SourceLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = A264F8A716974DED006FAA5A /* SourceLocation.h */; };
+		A264F8C116974DED006FAA5A /* Token.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A264F8A816974DED006FAA5A /* Token.cpp */; };
+		A264F8C216974DED006FAA5A /* Token.h in Headers */ = {isa = PBXBuildFile; fileRef = A264F8A916974DED006FAA5A /* Token.h */; };
+		A264F8C316974DED006FAA5A /* Tokenizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A264F8AA16974DED006FAA5A /* Tokenizer.cpp */; };
+		A264F8C416974DED006FAA5A /* Tokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = A264F8AB16974DED006FAA5A /* Tokenizer.h */; };
+		A264F8C816974E2A006FAA5A /* HashNames.h in Headers */ = {isa = PBXBuildFile; fileRef = A264F8C516974E2A006FAA5A /* HashNames.h */; };
+		A264F8C916974E2A006FAA5A /* VariablePacker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A264F8C616974E2A006FAA5A /* VariablePacker.cpp */; };
+		A264F8CA16974E2A006FAA5A /* VariablePacker.h in Headers */ = {isa = PBXBuildFile; fileRef = A264F8C716974E2A006FAA5A /* VariablePacker.h */; };
+		A264F8CD169762AA006FAA5A /* khrplatform.h in Headers */ = {isa = PBXBuildFile; fileRef = A264F8CC169762AA006FAA5A /* khrplatform.h */; settings = {ATTRIBUTES = (); }; };
 		A26567BB159C21B100398539 /* Diagnostics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A26567B0159C21B100398539 /* Diagnostics.cpp */; };
 		A26567BC159C21B100398539 /* Diagnostics.h in Headers */ = {isa = PBXBuildFile; fileRef = A26567B1159C21B100398539 /* Diagnostics.h */; };
 		A26567BD159C21B100398539 /* DirectiveHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A26567B2159C21B100398539 /* DirectiveHandler.cpp */; };
@@ -49,30 +78,6 @@
 		A26567BF159C21B100398539 /* InitializeParseContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A26567B4159C21B100398539 /* InitializeParseContext.cpp */; };
 		A26567C0159C21B100398539 /* Pragma.h in Headers */ = {isa = PBXBuildFile; fileRef = A26567B5159C21B100398539 /* Pragma.h */; };
 		A26567C1159C21B100398539 /* RenameFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = A26567B6159C21B100398539 /* RenameFunction.h */; };
-		A26567EC159C21CE00398539 /* DiagnosticsBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A26567C8159C21CE00398539 /* DiagnosticsBase.cpp */; };
-		A26567ED159C21CE00398539 /* Diagnostics.h in Headers */ = {isa = PBXBuildFile; fileRef = A26567C9159C21CE00398539 /* Diagnostics.h */; };
-		A26567EE159C21CE00398539 /* DirectiveHandlerBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A26567CA159C21CE00398539 /* DirectiveHandlerBase.cpp */; };
-		A26567EF159C21CE00398539 /* DirectiveHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = A26567CB159C21CE00398539 /* DirectiveHandler.h */; };
-		A26567F0159C21CE00398539 /* DirectiveParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A26567CC159C21CE00398539 /* DirectiveParser.cpp */; };
-		A26567F1159C21CE00398539 /* DirectiveParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A26567CD159C21CE00398539 /* DirectiveParser.h */; };
-		A26567F2159C21CE00398539 /* ExpressionParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A26567CE159C21CE00398539 /* ExpressionParser.cpp */; };
-		A26567F3159C21CE00398539 /* ExpressionParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A26567CF159C21CE00398539 /* ExpressionParser.h */; };
-		A26567F5159C21CE00398539 /* Input.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A26567D2159C21CE00398539 /* Input.cpp */; };
-		A26567F6159C21CE00398539 /* Input.h in Headers */ = {isa = PBXBuildFile; fileRef = A26567D3159C21CE00398539 /* Input.h */; };
-		A26567F7159C21CE00398539 /* Lexer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A26567D4159C21CE00398539 /* Lexer.cpp */; };
-		A26567F8159C21CE00398539 /* Lexer.h in Headers */ = {isa = PBXBuildFile; fileRef = A26567D5159C21CE00398539 /* Lexer.h */; };
-		A26567F9159C21CE00398539 /* Macro.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A26567D6159C21CE00398539 /* Macro.cpp */; };
-		A26567FA159C21CE00398539 /* Macro.h in Headers */ = {isa = PBXBuildFile; fileRef = A26567D7159C21CE00398539 /* Macro.h */; };
-		A26567FB159C21CE00398539 /* MacroExpander.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A26567D8159C21CE00398539 /* MacroExpander.cpp */; };
-		A26567FC159C21CE00398539 /* MacroExpander.h in Headers */ = {isa = PBXBuildFile; fileRef = A26567D9159C21CE00398539 /* MacroExpander.h */; };
-		A2656803159C21CE00398539 /* Preprocessor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A26567E0159C21CE00398539 /* Preprocessor.cpp */; };
-		A2656804159C21CE00398539 /* Preprocessor.h in Headers */ = {isa = PBXBuildFile; fileRef = A26567E1159C21CE00398539 /* Preprocessor.h */; };
-		A2656805159C21CE00398539 /* SourceLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = A26567E2159C21CE00398539 /* SourceLocation.h */; };
-		A2656807159C21CE00398539 /* Token.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A26567E4159C21CE00398539 /* Token.cpp */; };
-		A2656808159C21CE00398539 /* Token.h in Headers */ = {isa = PBXBuildFile; fileRef = A26567E5159C21CE00398539 /* Token.h */; };
-		A265680A159C21CE00398539 /* Tokenizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A26567E7159C21CE00398539 /* Tokenizer.cpp */; };
-		A265680B159C21CE00398539 /* Tokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = A26567E8159C21CE00398539 /* Tokenizer.h */; };
-		A265682B159C238800398539 /* pp_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = A265682A159C238800398539 /* pp_utils.h */; };
 		A2656839159C23E100398539 /* DependencyGraph.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A265682D159C23E100398539 /* DependencyGraph.cpp */; };
 		A265683A159C23E100398539 /* DependencyGraph.h in Headers */ = {isa = PBXBuildFile; fileRef = A265682E159C23E100398539 /* DependencyGraph.h */; };
 		A265683B159C23E100398539 /* DependencyGraphBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A265682F159C23E100398539 /* DependencyGraphBuilder.cpp */; };
@@ -84,6 +89,7 @@
 		A2656841159C23E100398539 /* RestrictFragmentShaderTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = A2656836159C23E100398539 /* RestrictFragmentShaderTiming.h */; };
 		A2656842159C23E100398539 /* RestrictVertexShaderTiming.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2656837159C23E100398539 /* RestrictVertexShaderTiming.cpp */; };
 		A2656843159C23E100398539 /* RestrictVertexShaderTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = A2656838159C23E100398539 /* RestrictVertexShaderTiming.h */; };
+		A29B15E81697845700111D97 /* khrplatform.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = A264F8CC169762AA006FAA5A /* khrplatform.h */; };
 		FB39D2711200F35A00088E69 /* CodeGenGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2221200F35A00088E69 /* CodeGenGLSL.cpp */; };
 		FB39D2751200F35A00088E69 /* debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2261200F35A00088E69 /* debug.cpp */; };
 		FB39D2791200F35A00088E69 /* InfoSink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D22A1200F35A00088E69 /* InfoSink.cpp */; };
@@ -97,13 +103,6 @@
 		FB39D28E1200F35A00088E69 /* parseConst.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D23F1200F35A00088E69 /* parseConst.cpp */; };
 		FB39D28F1200F35A00088E69 /* ParseHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2401200F35A00088E69 /* ParseHelper.cpp */; };
 		FB39D2911200F35A00088E69 /* PoolAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2421200F35A00088E69 /* PoolAlloc.cpp */; };
-		FB39D2931200F35A00088E69 /* atom.c in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2451200F35A00088E69 /* atom.c */; };
-		FB39D2961200F35A00088E69 /* cpp.c in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2481200F35A00088E69 /* cpp.c */; };
-		FB39D2981200F35A00088E69 /* cppstruct.c in Sources */ = {isa = PBXBuildFile; fileRef = FB39D24A1200F35A00088E69 /* cppstruct.c */; };
-		FB39D2991200F35A00088E69 /* memory.c in Sources */ = {isa = PBXBuildFile; fileRef = FB39D24B1200F35A00088E69 /* memory.c */; };
-		FB39D29D1200F35A00088E69 /* scanner.c in Sources */ = {isa = PBXBuildFile; fileRef = FB39D24F1200F35A00088E69 /* scanner.c */; };
-		FB39D2A01200F35A00088E69 /* symbols.c in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2521200F35A00088E69 /* symbols.c */; };
-		FB39D2A21200F35A00088E69 /* tokens.c in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2541200F35A00088E69 /* tokens.c */; };
 		FB39D2A41200F35A00088E69 /* QualifierAlive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2561200F35A00088E69 /* QualifierAlive.cpp */; };
 		FB39D2A61200F35A00088E69 /* RemoveTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D2581200F35A00088E69 /* RemoveTree.cpp */; };
 		FB39D2A81200F35A00088E69 /* ShaderLang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB39D25A1200F35A00088E69 /* ShaderLang.cpp */; };
@@ -133,6 +132,16 @@
 			);
 			runOnlyForDeploymentPostprocessing = 1;
 		};
+		A29B15E61697844500111D97 /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 12;
+			dstPath = usr/local/include/KHR;
+			dstSubfolderSpec = 16;
+			files = (
+				A29B15E81697845700111D97 /* khrplatform.h in CopyFiles */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
@@ -175,8 +184,35 @@
 		A0AABE4313AFE94500F2EBD1 /* OutputESSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OutputESSL.h; sourceTree = "<group>"; };
 		A0AABE4613AFE96100F2EBD1 /* TranslatorESSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TranslatorESSL.cpp; sourceTree = "<group>"; };
 		A0AABE4713AFE96100F2EBD1 /* TranslatorESSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TranslatorESSL.h; sourceTree = "<group>"; };
-		A26567AE159C21B100398539 /* DetectDiscontinuity.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetectDiscontinuity.cpp; sourceTree = "<group>"; };
-		A26567AF159C21B100398539 /* DetectDiscontinuity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetectDiscontinuity.h; sourceTree = "<group>"; };
+		A264F89316974DED006FAA5A /* DiagnosticsBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DiagnosticsBase.cpp; sourceTree = "<group>"; };
+		A264F89416974DED006FAA5A /* DiagnosticsBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiagnosticsBase.h; sourceTree = "<group>"; };
+		A264F89516974DED006FAA5A /* DirectiveHandlerBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectiveHandlerBase.cpp; sourceTree = "<group>"; };
+		A264F89616974DED006FAA5A /* DirectiveHandlerBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectiveHandlerBase.h; sourceTree = "<group>"; };
+		A264F89716974DED006FAA5A /* DirectiveParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectiveParser.cpp; sourceTree = "<group>"; };
+		A264F89816974DED006FAA5A /* DirectiveParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectiveParser.h; sourceTree = "<group>"; };
+		A264F89916974DED006FAA5A /* ExpressionParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExpressionParser.cpp; sourceTree = "<group>"; };
+		A264F89A16974DED006FAA5A /* ExpressionParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExpressionParser.h; sourceTree = "<group>"; };
+		A264F89B16974DED006FAA5A /* Input.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Input.cpp; sourceTree = "<group>"; };
+		A264F89C16974DED006FAA5A /* Input.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Input.h; sourceTree = "<group>"; };
+		A264F89D16974DED006FAA5A /* Lexer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Lexer.cpp; sourceTree = "<group>"; };
+		A264F89E16974DED006FAA5A /* Lexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Lexer.h; sourceTree = "<group>"; };
+		A264F89F16974DED006FAA5A /* Macro.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Macro.cpp; sourceTree = "<group>"; };
+		A264F8A016974DED006FAA5A /* Macro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Macro.h; sourceTree = "<group>"; };
+		A264F8A116974DED006FAA5A /* MacroExpander.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacroExpander.cpp; sourceTree = "<group>"; };
+		A264F8A216974DED006FAA5A /* MacroExpander.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroExpander.h; sourceTree = "<group>"; };
+		A264F8A316974DED006FAA5A /* numeric_lex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = numeric_lex.h; sourceTree = "<group>"; };
+		A264F8A416974DED006FAA5A /* pp_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pp_utils.h; sourceTree = "<group>"; };
+		A264F8A516974DED006FAA5A /* Preprocessor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Preprocessor.cpp; sourceTree = "<group>"; };
+		A264F8A616974DED006FAA5A /* Preprocessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Preprocessor.h; sourceTree = "<group>"; };
+		A264F8A716974DED006FAA5A /* SourceLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceLocation.h; sourceTree = "<group>"; };
+		A264F8A816974DED006FAA5A /* Token.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Token.cpp; sourceTree = "<group>"; };
+		A264F8A916974DED006FAA5A /* Token.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Token.h; sourceTree = "<group>"; };
+		A264F8AA16974DED006FAA5A /* Tokenizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Tokenizer.cpp; sourceTree = "<group>"; };
+		A264F8AB16974DED006FAA5A /* Tokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tokenizer.h; sourceTree = "<group>"; };
+		A264F8C516974E2A006FAA5A /* HashNames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HashNames.h; sourceTree = "<group>"; };
+		A264F8C616974E2A006FAA5A /* VariablePacker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VariablePacker.cpp; sourceTree = "<group>"; };
+		A264F8C716974E2A006FAA5A /* VariablePacker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VariablePacker.h; sourceTree = "<group>"; };
+		A264F8CC169762AA006FAA5A /* khrplatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = khrplatform.h; sourceTree = "<group>"; };
 		A26567B0159C21B100398539 /* Diagnostics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Diagnostics.cpp; sourceTree = "<group>"; };
 		A26567B1159C21B100398539 /* Diagnostics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Diagnostics.h; sourceTree = "<group>"; };
 		A26567B2159C21B100398539 /* DirectiveHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectiveHandler.cpp; sourceTree = "<group>"; };
@@ -184,32 +220,6 @@
 		A26567B4159C21B100398539 /* InitializeParseContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InitializeParseContext.cpp; sourceTree = "<group>"; };
 		A26567B5159C21B100398539 /* Pragma.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pragma.h; sourceTree = "<group>"; };
 		A26567B6159C21B100398539 /* RenameFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenameFunction.h; sourceTree = "<group>"; };
-		A26567B7159C21B100398539 /* UnfoldShortCircuit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnfoldShortCircuit.cpp; sourceTree = "<group>"; };
-		A26567B8159C21B100398539 /* UnfoldShortCircuit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnfoldShortCircuit.h; sourceTree = "<group>"; };
-		A26567C8159C21CE00398539 /* DiagnosticsBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DiagnosticsBase.cpp; sourceTree = "<group>"; };
-		A26567C9159C21CE00398539 /* Diagnostics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Diagnostics.h; sourceTree = "<group>"; };
-		A26567CA159C21CE00398539 /* DirectiveHandlerBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectiveHandlerBase.cpp; sourceTree = "<group>"; };
-		A26567CB159C21CE00398539 /* DirectiveHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectiveHandler.h; sourceTree = "<group>"; };
-		A26567CC159C21CE00398539 /* DirectiveParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectiveParser.cpp; sourceTree = "<group>"; };
-		A26567CD159C21CE00398539 /* DirectiveParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectiveParser.h; sourceTree = "<group>"; };
-		A26567CE159C21CE00398539 /* ExpressionParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExpressionParser.cpp; sourceTree = "<group>"; };
-		A26567CF159C21CE00398539 /* ExpressionParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExpressionParser.h; sourceTree = "<group>"; };
-		A26567D2159C21CE00398539 /* Input.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Input.cpp; sourceTree = "<group>"; };
-		A26567D3159C21CE00398539 /* Input.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Input.h; sourceTree = "<group>"; };
-		A26567D4159C21CE00398539 /* Lexer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Lexer.cpp; sourceTree = "<group>"; };
-		A26567D5159C21CE00398539 /* Lexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Lexer.h; sourceTree = "<group>"; };
-		A26567D6159C21CE00398539 /* Macro.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Macro.cpp; sourceTree = "<group>"; };
-		A26567D7159C21CE00398539 /* Macro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Macro.h; sourceTree = "<group>"; };
-		A26567D8159C21CE00398539 /* MacroExpander.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacroExpander.cpp; sourceTree = "<group>"; };
-		A26567D9159C21CE00398539 /* MacroExpander.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroExpander.h; sourceTree = "<group>"; };
-		A26567E0159C21CE00398539 /* Preprocessor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Preprocessor.cpp; sourceTree = "<group>"; };
-		A26567E1159C21CE00398539 /* Preprocessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Preprocessor.h; sourceTree = "<group>"; };
-		A26567E2159C21CE00398539 /* SourceLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceLocation.h; sourceTree = "<group>"; };
-		A26567E4159C21CE00398539 /* Token.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Token.cpp; sourceTree = "<group>"; };
-		A26567E5159C21CE00398539 /* Token.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Token.h; sourceTree = "<group>"; };
-		A26567E7159C21CE00398539 /* Tokenizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Tokenizer.cpp; sourceTree = "<group>"; };
-		A26567E8159C21CE00398539 /* Tokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tokenizer.h; sourceTree = "<group>"; };
-		A265682A159C238800398539 /* pp_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pp_utils.h; sourceTree = "<group>"; };
 		A265682D159C23E100398539 /* DependencyGraph.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DependencyGraph.cpp; sourceTree = "<group>"; };
 		A265682E159C23E100398539 /* DependencyGraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DependencyGraph.h; sourceTree = "<group>"; };
 		A265682F159C23E100398539 /* DependencyGraphBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DependencyGraphBuilder.cpp; sourceTree = "<group>"; };
@@ -222,69 +232,6 @@
 		A2656837159C23E100398539 /* RestrictVertexShaderTiming.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RestrictVertexShaderTiming.cpp; sourceTree = "<group>"; };
 		A2656838159C23E100398539 /* RestrictVertexShaderTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RestrictVertexShaderTiming.h; sourceTree = "<group>"; };
 		FB39D0D11200F0E300088E69 /* libANGLE.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libANGLE.a; sourceTree = BUILT_PRODUCTS_DIR; };
-		FB39D1861200F26200088E69 /* BaseTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseTypes.h; sourceTree = "<group>"; };
-		FB39D1871200F26200088E69 /* CodeGenGLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = CodeGenGLSL.cpp; sourceTree = "<group>"; };
-		FB39D1881200F26200088E69 /* CodeGenHLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = CodeGenHLSL.cpp; sourceTree = "<group>"; };
-		FB39D1891200F26200088E69 /* Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Common.h; sourceTree = "<group>"; };
-		FB39D18A1200F26200088E69 /* ConstantUnion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConstantUnion.h; sourceTree = "<group>"; };
-		FB39D18B1200F26200088E69 /* debug.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = debug.cpp; sourceTree = "<group>"; };
-		FB39D18C1200F26200088E69 /* debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = debug.h; sourceTree = "<group>"; };
-		FB39D18F1200F26200088E69 /* InfoSink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = InfoSink.cpp; sourceTree = "<group>"; };
-		FB39D1901200F26200088E69 /* InfoSink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InfoSink.h; sourceTree = "<group>"; };
-		FB39D1911200F26200088E69 /* Initialize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = Initialize.cpp; sourceTree = "<group>"; };
-		FB39D1921200F26200088E69 /* Initialize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Initialize.h; sourceTree = "<group>"; };
-		FB39D1931200F26200088E69 /* InitializeDll.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = InitializeDll.cpp; sourceTree = "<group>"; };
-		FB39D1941200F26200088E69 /* InitializeDll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InitializeDll.h; sourceTree = "<group>"; };
-		FB39D1951200F26200088E69 /* InitializeGlobals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InitializeGlobals.h; sourceTree = "<group>"; };
-		FB39D1961200F26200088E69 /* InitializeParseContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InitializeParseContext.h; sourceTree = "<group>"; };
-		FB39D1971200F26200088E69 /* Intermediate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = Intermediate.cpp; sourceTree = "<group>"; };
-		FB39D1981200F26200088E69 /* intermediate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intermediate.h; sourceTree = "<group>"; };
-		FB39D1991200F26200088E69 /* intermOut.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = intermOut.cpp; sourceTree = "<group>"; };
-		FB39D19A1200F26200088E69 /* IntermTraverse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = IntermTraverse.cpp; sourceTree = "<group>"; };
-		FB39D19B1200F26200088E69 /* localintermediate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = localintermediate.h; sourceTree = "<group>"; };
-		FB39D19C1200F26200088E69 /* MMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMap.h; sourceTree = "<group>"; };
-		FB39D19D1200F26200088E69 /* osinclude.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = osinclude.h; sourceTree = "<group>"; };
-		FB39D19E1200F26200088E69 /* ossource_posix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = ossource_posix.cpp; sourceTree = "<group>"; };
-		FB39D19F1200F26200088E69 /* ossource_win.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = ossource_win.cpp; sourceTree = "<group>"; };
-		FB39D1A01200F26200088E69 /* OutputGLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = OutputGLSL.cpp; sourceTree = "<group>"; };
-		FB39D1A11200F26200088E69 /* OutputGLSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OutputGLSL.h; sourceTree = "<group>"; };
-		FB39D1A21200F26200088E69 /* OutputHLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = OutputHLSL.cpp; sourceTree = "<group>"; };
-		FB39D1A31200F26200088E69 /* OutputHLSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OutputHLSL.h; sourceTree = "<group>"; };
-		FB39D1A41200F26200088E69 /* parseConst.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = parseConst.cpp; sourceTree = "<group>"; };
-		FB39D1A51200F26200088E69 /* ParseHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = ParseHelper.cpp; sourceTree = "<group>"; };
-		FB39D1A61200F26200088E69 /* ParseHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParseHelper.h; sourceTree = "<group>"; };
-		FB39D1A71200F26200088E69 /* PoolAlloc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = PoolAlloc.cpp; sourceTree = "<group>"; };
-		FB39D1A81200F26200088E69 /* PoolAlloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PoolAlloc.h; sourceTree = "<group>"; };
-		FB39D1AA1200F26200088E69 /* atom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = atom.c; sourceTree = "<group>"; };
-		FB39D1AB1200F26200088E69 /* atom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = atom.h; sourceTree = "<group>"; };
-		FB39D1AC1200F26200088E69 /* compile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compile.h; sourceTree = "<group>"; };
-		FB39D1AD1200F26200088E69 /* cpp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpp.c; sourceTree = "<group>"; };
-		FB39D1AE1200F26200088E69 /* cpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpp.h; sourceTree = "<group>"; };
-		FB39D1AF1200F26200088E69 /* cppstruct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cppstruct.c; sourceTree = "<group>"; };
-		FB39D1B01200F26200088E69 /* memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = memory.c; sourceTree = "<group>"; };
-		FB39D1B11200F26200088E69 /* memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = "<group>"; };
-		FB39D1B21200F26200088E69 /* parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = parser.h; sourceTree = "<group>"; };
-		FB39D1B31200F26200088E69 /* preprocess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = preprocess.h; sourceTree = "<group>"; };
-		FB39D1B41200F26200088E69 /* scanner.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = scanner.c; sourceTree = "<group>"; };
-		FB39D1B51200F26200088E69 /* scanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scanner.h; sourceTree = "<group>"; };
-		FB39D1B61200F26200088E69 /* slglobals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = slglobals.h; sourceTree = "<group>"; };
-		FB39D1B71200F26200088E69 /* symbols.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = symbols.c; sourceTree = "<group>"; };
-		FB39D1B81200F26200088E69 /* symbols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = symbols.h; sourceTree = "<group>"; };
-		FB39D1B91200F26200088E69 /* tokens.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tokens.c; sourceTree = "<group>"; };
-		FB39D1BA1200F26200088E69 /* tokens.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tokens.h; sourceTree = "<group>"; };
-		FB39D1BB1200F26200088E69 /* QualifierAlive.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = QualifierAlive.cpp; sourceTree = "<group>"; };
-		FB39D1BC1200F26200088E69 /* QualifierAlive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QualifierAlive.h; sourceTree = "<group>"; };
-		FB39D1BD1200F26200088E69 /* RemoveTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = RemoveTree.cpp; sourceTree = "<group>"; };
-		FB39D1BE1200F26200088E69 /* RemoveTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoveTree.h; sourceTree = "<group>"; };
-		FB39D1BF1200F26200088E69 /* ShaderLang.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; includeInIndex = 0; path = ShaderLang.cpp; sourceTree = "<group>"; };
-		FB39D1C01200F26200088E69 /* ShHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShHandle.h; sourceTree = "<group>"; };
-		FB39D1C11200F26200088E69 /* SymbolTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolTable.cpp; sourceTree = "<group>"; };
-		FB39D1C21200F26200088E69 /* SymbolTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolTable.h; sourceTree = "<group>"; };
-		FB39D1CD1200F26200088E69 /* TranslatorGLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = TranslatorGLSL.cpp; sourceTree = "<group>"; };
-		FB39D1CE1200F26200088E69 /* TranslatorGLSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TranslatorGLSL.h; sourceTree = "<group>"; };
-		FB39D1CF1200F26200088E69 /* TranslatorHLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.cpp.cpp; path = TranslatorHLSL.cpp; sourceTree = "<group>"; };
-		FB39D1D01200F26200088E69 /* TranslatorHLSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TranslatorHLSL.h; sourceTree = "<group>"; };
-		FB39D1D11200F26200088E69 /* Types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Types.h; sourceTree = "<group>"; };
 		FB39D2211200F35A00088E69 /* BaseTypes.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = BaseTypes.h; sourceTree = "<group>"; };
 		FB39D2221200F35A00088E69 /* CodeGenGLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CodeGenGLSL.cpp; sourceTree = "<group>"; };
 		FB39D2241200F35A00088E69 /* Common.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = Common.h; sourceTree = "<group>"; };
@@ -315,23 +262,6 @@
 		FB39D2411200F35A00088E69 /* ParseHelper.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = ParseHelper.h; sourceTree = "<group>"; };
 		FB39D2421200F35A00088E69 /* PoolAlloc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PoolAlloc.cpp; sourceTree = "<group>"; };
 		FB39D2431200F35A00088E69 /* PoolAlloc.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = PoolAlloc.h; sourceTree = "<group>"; };
-		FB39D2451200F35A00088E69 /* atom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = atom.c; sourceTree = "<group>"; };
-		FB39D2461200F35A00088E69 /* atom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = atom.h; sourceTree = "<group>"; };
-		FB39D2471200F35A00088E69 /* compile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compile.h; sourceTree = "<group>"; };
-		FB39D2481200F35A00088E69 /* cpp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpp.c; sourceTree = "<group>"; };
-		FB39D2491200F35A00088E69 /* cpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpp.h; sourceTree = "<group>"; };
-		FB39D24A1200F35A00088E69 /* cppstruct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cppstruct.c; sourceTree = "<group>"; };
-		FB39D24B1200F35A00088E69 /* memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = memory.c; sourceTree = "<group>"; };
-		FB39D24C1200F35A00088E69 /* memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = "<group>"; };
-		FB39D24D1200F35A00088E69 /* parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = parser.h; sourceTree = "<group>"; };
-		FB39D24E1200F35A00088E69 /* preprocess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = preprocess.h; sourceTree = "<group>"; };
-		FB39D24F1200F35A00088E69 /* scanner.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = scanner.c; sourceTree = "<group>"; };
-		FB39D2501200F35A00088E69 /* scanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scanner.h; sourceTree = "<group>"; };
-		FB39D2511200F35A00088E69 /* slglobals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = slglobals.h; sourceTree = "<group>"; };
-		FB39D2521200F35A00088E69 /* symbols.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = symbols.c; sourceTree = "<group>"; };
-		FB39D2531200F35A00088E69 /* symbols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = symbols.h; sourceTree = "<group>"; };
-		FB39D2541200F35A00088E69 /* tokens.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tokens.c; sourceTree = "<group>"; };
-		FB39D2551200F35A00088E69 /* tokens.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tokens.h; sourceTree = "<group>"; };
 		FB39D2561200F35A00088E69 /* QualifierAlive.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = QualifierAlive.cpp; sourceTree = "<group>"; };
 		FB39D2571200F35A00088E69 /* QualifierAlive.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = QualifierAlive.h; sourceTree = "<group>"; };
 		FB39D2581200F35A00088E69 /* RemoveTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoveTree.cpp; sourceTree = "<group>"; };
@@ -376,35 +306,13 @@
 			path = Configurations;
 			sourceTree = "<group>";
 		};
-		A26567C5159C21CE00398539 /* new */ = {
+		A264F8CB169762AA006FAA5A /* KHR */ = {
 			isa = PBXGroup;
 			children = (
-				A265682A159C238800398539 /* pp_utils.h */,
-				A26567C8159C21CE00398539 /* DiagnosticsBase.cpp */,
-				A26567C9159C21CE00398539 /* Diagnostics.h */,
-				A26567CA159C21CE00398539 /* DirectiveHandlerBase.cpp */,
-				A26567CB159C21CE00398539 /* DirectiveHandler.h */,
-				A26567CC159C21CE00398539 /* DirectiveParser.cpp */,
-				A26567CD159C21CE00398539 /* DirectiveParser.h */,
-				A26567CE159C21CE00398539 /* ExpressionParser.cpp */,
-				A26567CF159C21CE00398539 /* ExpressionParser.h */,
-				A26567D2159C21CE00398539 /* Input.cpp */,
-				A26567D3159C21CE00398539 /* Input.h */,
-				A26567D4159C21CE00398539 /* Lexer.cpp */,
-				A26567D5159C21CE00398539 /* Lexer.h */,
-				A26567D6159C21CE00398539 /* Macro.cpp */,
-				A26567D7159C21CE00398539 /* Macro.h */,
-				A26567D8159C21CE00398539 /* MacroExpander.cpp */,
-				A26567D9159C21CE00398539 /* MacroExpander.h */,
-				A26567E0159C21CE00398539 /* Preprocessor.cpp */,
-				A26567E1159C21CE00398539 /* Preprocessor.h */,
-				A26567E2159C21CE00398539 /* SourceLocation.h */,
-				A26567E4159C21CE00398539 /* Token.cpp */,
-				A26567E5159C21CE00398539 /* Token.h */,
-				A26567E7159C21CE00398539 /* Tokenizer.cpp */,
-				A26567E8159C21CE00398539 /* Tokenizer.h */,
+				A264F8CC169762AA006FAA5A /* khrplatform.h */,
 			);
-			path = new;
+			name = KHR;
+			path = include/KHR;
 			sourceTree = "<group>";
 		};
 		A265682C159C23E100398539 /* depgraph */ = {
@@ -432,24 +340,32 @@
 			path = timing;
 			sourceTree = "<group>";
 		};
+		A29B15E916978B7D00111D97 /* include */ = {
+			isa = PBXGroup;
+			children = (
+				FB39D2BD1200F3E600088E69 /* GLSLANG */,
+				A264F8CB169762AA006FAA5A /* KHR */,
+			);
+			name = include;
+			sourceTree = "<group>";
+		};
 		FB39D06E1200ED9200088E69 = {
 			isa = PBXGroup;
 			children = (
+				A29B15E916978B7D00111D97 /* include */,
 				312BDB0715FEC8E60097EBC7 /* misc */,
-				FB39D2201200F35A00088E69 /* compiler */,
-				FB39D0841200EDEB00088E69 /* Source */,
+				FB39D0841200EDEB00088E69 /* src */,
 				5D7C59C41208C68B001C873E /* Configurations */,
 				FB39D0CC1200EF9B00088E69 /* Products */,
 			);
 			sourceTree = "<group>";
 		};
-		FB39D0841200EDEB00088E69 /* Source */ = {
+		FB39D0841200EDEB00088E69 /* src */ = {
 			isa = PBXGroup;
 			children = (
-				FB39D1851200F26200088E69 /* compiler */,
-				FB39D2BD1200F3E600088E69 /* GLSLANG */,
+				FB39D2201200F35A00088E69 /* compiler */,
 			);
-			name = Source;
+			name = src;
 			sourceTree = "<group>";
 		};
 		FB39D0CC1200EF9B00088E69 /* Products */ = {
@@ -460,94 +376,12 @@
 			name = Products;
 			sourceTree = "<group>";
 		};
-		FB39D1851200F26200088E69 /* compiler */ = {
-			isa = PBXGroup;
-			children = (
-				FB39D1861200F26200088E69 /* BaseTypes.h */,
-				FB39D1871200F26200088E69 /* CodeGenGLSL.cpp */,
-				FB39D1881200F26200088E69 /* CodeGenHLSL.cpp */,
-				FB39D1891200F26200088E69 /* Common.h */,
-				FB39D18A1200F26200088E69 /* ConstantUnion.h */,
-				FB39D18B1200F26200088E69 /* debug.cpp */,
-				FB39D18C1200F26200088E69 /* debug.h */,
-				A26567AE159C21B100398539 /* DetectDiscontinuity.cpp */,
-				A26567AF159C21B100398539 /* DetectDiscontinuity.h */,
-				FB39D18F1200F26200088E69 /* InfoSink.cpp */,
-				FB39D1901200F26200088E69 /* InfoSink.h */,
-				FB39D1911200F26200088E69 /* Initialize.cpp */,
-				FB39D1921200F26200088E69 /* Initialize.h */,
-				FB39D1931200F26200088E69 /* InitializeDll.cpp */,
-				FB39D1941200F26200088E69 /* InitializeDll.h */,
-				FB39D1951200F26200088E69 /* InitializeGlobals.h */,
-				FB39D1961200F26200088E69 /* InitializeParseContext.h */,
-				FB39D1971200F26200088E69 /* Intermediate.cpp */,
-				FB39D1981200F26200088E69 /* intermediate.h */,
-				FB39D1991200F26200088E69 /* intermOut.cpp */,
-				FB39D19A1200F26200088E69 /* IntermTraverse.cpp */,
-				FB39D19B1200F26200088E69 /* localintermediate.h */,
-				FB39D19C1200F26200088E69 /* MMap.h */,
-				FB39D19D1200F26200088E69 /* osinclude.h */,
-				FB39D19E1200F26200088E69 /* ossource_posix.cpp */,
-				FB39D19F1200F26200088E69 /* ossource_win.cpp */,
-				FB39D1A01200F26200088E69 /* OutputGLSL.cpp */,
-				FB39D1A11200F26200088E69 /* OutputGLSL.h */,
-				FB39D1A21200F26200088E69 /* OutputHLSL.cpp */,
-				FB39D1A31200F26200088E69 /* OutputHLSL.h */,
-				FB39D1A41200F26200088E69 /* parseConst.cpp */,
-				FB39D1A51200F26200088E69 /* ParseHelper.cpp */,
-				FB39D1A61200F26200088E69 /* ParseHelper.h */,
-				FB39D1A71200F26200088E69 /* PoolAlloc.cpp */,
-				FB39D1A81200F26200088E69 /* PoolAlloc.h */,
-				FB39D1A91200F26200088E69 /* preprocessor */,
-				FB39D1BB1200F26200088E69 /* QualifierAlive.cpp */,
-				FB39D1BC1200F26200088E69 /* QualifierAlive.h */,
-				FB39D1BD1200F26200088E69 /* RemoveTree.cpp */,
-				FB39D1BE1200F26200088E69 /* RemoveTree.h */,
-				FB39D1BF1200F26200088E69 /* ShaderLang.cpp */,
-				FB39D1C01200F26200088E69 /* ShHandle.h */,
-				FB39D1C11200F26200088E69 /* SymbolTable.cpp */,
-				FB39D1C21200F26200088E69 /* SymbolTable.h */,
-				FB39D1CD1200F26200088E69 /* TranslatorGLSL.cpp */,
-				FB39D1CE1200F26200088E69 /* TranslatorGLSL.h */,
-				FB39D1CF1200F26200088E69 /* TranslatorHLSL.cpp */,
-				FB39D1D01200F26200088E69 /* TranslatorHLSL.h */,
-				FB39D1D11200F26200088E69 /* Types.h */,
-				A26567B7159C21B100398539 /* UnfoldShortCircuit.cpp */,
-				A26567B8159C21B100398539 /* UnfoldShortCircuit.h */,
-			);
-			includeInIndex = 0;
-			name = compiler;
-			path = src/compiler;
-			sourceTree = "<group>";
-		};
-		FB39D1A91200F26200088E69 /* preprocessor */ = {
-			isa = PBXGroup;
-			children = (
-				FB39D1AA1200F26200088E69 /* atom.c */,
-				FB39D1AB1200F26200088E69 /* atom.h */,
-				FB39D1AC1200F26200088E69 /* compile.h */,
-				FB39D1AD1200F26200088E69 /* cpp.c */,
-				FB39D1AE1200F26200088E69 /* cpp.h */,
-				FB39D1AF1200F26200088E69 /* cppstruct.c */,
-				FB39D1B01200F26200088E69 /* memory.c */,
-				FB39D1B11200F26200088E69 /* memory.h */,
-				FB39D1B21200F26200088E69 /* parser.h */,
-				FB39D1B31200F26200088E69 /* preprocess.h */,
-				FB39D1B41200F26200088E69 /* scanner.c */,
-				FB39D1B51200F26200088E69 /* scanner.h */,
-				FB39D1B61200F26200088E69 /* slglobals.h */,
-				FB39D1B71200F26200088E69 /* symbols.c */,
-				FB39D1B81200F26200088E69 /* symbols.h */,
-				FB39D1B91200F26200088E69 /* tokens.c */,
-				FB39D1BA1200F26200088E69 /* tokens.h */,
-			);
-			includeInIndex = 0;
-			path = preprocessor;
-			sourceTree = "<group>";
-		};
 		FB39D2201200F35A00088E69 /* compiler */ = {
 			isa = PBXGroup;
 			children = (
+				A264F8C516974E2A006FAA5A /* HashNames.h */,
+				A264F8C616974E2A006FAA5A /* VariablePacker.cpp */,
+				A264F8C716974E2A006FAA5A /* VariablePacker.h */,
 				3158EA0C1630968D006BE5EE /* ArrayBoundsClamper.cpp */,
 				3158EA0D1630968D006BE5EE /* ArrayBoundsClamper.h */,
 				FB39D2211200F35A00088E69 /* BaseTypes.h */,
@@ -640,25 +474,32 @@
 		FB39D2441200F35A00088E69 /* preprocessor */ = {
 			isa = PBXGroup;
 			children = (
-				A26567C5159C21CE00398539 /* new */,
-				FB39D2451200F35A00088E69 /* atom.c */,
-				FB39D2461200F35A00088E69 /* atom.h */,
-				FB39D2471200F35A00088E69 /* compile.h */,
-				FB39D2481200F35A00088E69 /* cpp.c */,
-				FB39D2491200F35A00088E69 /* cpp.h */,
-				FB39D24A1200F35A00088E69 /* cppstruct.c */,
+				A264F89316974DED006FAA5A /* DiagnosticsBase.cpp */,
+				A264F89416974DED006FAA5A /* DiagnosticsBase.h */,
+				A264F89516974DED006FAA5A /* DirectiveHandlerBase.cpp */,
+				A264F89616974DED006FAA5A /* DirectiveHandlerBase.h */,
+				A264F89716974DED006FAA5A /* DirectiveParser.cpp */,
+				A264F89816974DED006FAA5A /* DirectiveParser.h */,
+				A264F89916974DED006FAA5A /* ExpressionParser.cpp */,
+				A264F89A16974DED006FAA5A /* ExpressionParser.h */,
+				A264F89B16974DED006FAA5A /* Input.cpp */,
+				A264F89C16974DED006FAA5A /* Input.h */,
+				A264F89D16974DED006FAA5A /* Lexer.cpp */,
+				A264F89E16974DED006FAA5A /* Lexer.h */,
+				A264F89F16974DED006FAA5A /* Macro.cpp */,
+				A264F8A016974DED006FAA5A /* Macro.h */,
+				A264F8A116974DED006FAA5A /* MacroExpander.cpp */,
+				A264F8A216974DED006FAA5A /* MacroExpander.h */,
+				A264F8A316974DED006FAA5A /* numeric_lex.h */,
+				A264F8A416974DED006FAA5A /* pp_utils.h */,
+				A264F8A516974DED006FAA5A /* Preprocessor.cpp */,
+				A264F8A616974DED006FAA5A /* Preprocessor.h */,
+				A264F8A716974DED006FAA5A /* SourceLocation.h */,
+				A264F8A816974DED006FAA5A /* Token.cpp */,
+				A264F8A916974DED006FAA5A /* Token.h */,
+				A264F8AA16974DED006FAA5A /* Tokenizer.cpp */,
+				A264F8AB16974DED006FAA5A /* Tokenizer.h */,
 				49951C0214B7AAB30060E96E /* length_limits.h */,
-				FB39D24B1200F35A00088E69 /* memory.c */,
-				FB39D24C1200F35A00088E69 /* memory.h */,
-				FB39D24D1200F35A00088E69 /* parser.h */,
-				FB39D24E1200F35A00088E69 /* preprocess.h */,
-				FB39D24F1200F35A00088E69 /* scanner.c */,
-				FB39D2501200F35A00088E69 /* scanner.h */,
-				FB39D2511200F35A00088E69 /* slglobals.h */,
-				FB39D2521200F35A00088E69 /* symbols.c */,
-				FB39D2531200F35A00088E69 /* symbols.h */,
-				FB39D2541200F35A00088E69 /* tokens.c */,
-				FB39D2551200F35A00088E69 /* tokens.h */,
 			);
 			path = preprocessor;
 			sourceTree = "<group>";
@@ -700,25 +541,29 @@
 				A26567BE159C21B100398539 /* DirectiveHandler.h in Headers */,
 				A26567C0159C21B100398539 /* Pragma.h in Headers */,
 				A26567C1159C21B100398539 /* RenameFunction.h in Headers */,
-				A26567ED159C21CE00398539 /* Diagnostics.h in Headers */,
-				A26567EF159C21CE00398539 /* DirectiveHandler.h in Headers */,
-				A26567F1159C21CE00398539 /* DirectiveParser.h in Headers */,
-				A26567F3159C21CE00398539 /* ExpressionParser.h in Headers */,
-				A26567F6159C21CE00398539 /* Input.h in Headers */,
-				A26567F8159C21CE00398539 /* Lexer.h in Headers */,
-				A26567FA159C21CE00398539 /* Macro.h in Headers */,
-				A26567FC159C21CE00398539 /* MacroExpander.h in Headers */,
-				A2656804159C21CE00398539 /* Preprocessor.h in Headers */,
-				A2656805159C21CE00398539 /* SourceLocation.h in Headers */,
-				A2656808159C21CE00398539 /* Token.h in Headers */,
-				A265680B159C21CE00398539 /* Tokenizer.h in Headers */,
-				A265682B159C238800398539 /* pp_utils.h in Headers */,
 				A265683A159C23E100398539 /* DependencyGraph.h in Headers */,
 				A265683C159C23E100398539 /* DependencyGraphBuilder.h in Headers */,
 				A265683E159C23E100398539 /* DependencyGraphOutput.h in Headers */,
 				A2656841159C23E100398539 /* RestrictFragmentShaderTiming.h in Headers */,
 				A2656843159C23E100398539 /* RestrictVertexShaderTiming.h in Headers */,
 				3158EA0F1630968D006BE5EE /* ArrayBoundsClamper.h in Headers */,
+				A264F8AD16974DED006FAA5A /* DiagnosticsBase.h in Headers */,
+				A264F8AF16974DED006FAA5A /* DirectiveHandlerBase.h in Headers */,
+				A264F8B116974DED006FAA5A /* DirectiveParser.h in Headers */,
+				A264F8B316974DED006FAA5A /* ExpressionParser.h in Headers */,
+				A264F8B516974DED006FAA5A /* Input.h in Headers */,
+				A264F8B716974DED006FAA5A /* Lexer.h in Headers */,
+				A264F8B916974DED006FAA5A /* Macro.h in Headers */,
+				A264F8BB16974DED006FAA5A /* MacroExpander.h in Headers */,
+				A264F8BC16974DED006FAA5A /* numeric_lex.h in Headers */,
+				A264F8BD16974DED006FAA5A /* pp_utils.h in Headers */,
+				A264F8BF16974DED006FAA5A /* Preprocessor.h in Headers */,
+				A264F8C016974DED006FAA5A /* SourceLocation.h in Headers */,
+				A264F8C216974DED006FAA5A /* Token.h in Headers */,
+				A264F8C416974DED006FAA5A /* Tokenizer.h in Headers */,
+				A264F8C816974E2A006FAA5A /* HashNames.h in Headers */,
+				A264F8CA16974E2A006FAA5A /* VariablePacker.h in Headers */,
+				A264F8CD169762AA006FAA5A /* khrplatform.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -734,6 +579,7 @@
 				FB39D0CF1200F0E300088E69 /* Frameworks */,
 				312BDB0B15FECAB00097EBC7 /* CopyFiles */,
 				312BDB0D15FECACE0097EBC7 /* CopyFiles */,
+				A29B15E61697844500111D97 /* CopyFiles */,
 			);
 			buildRules = (
 			);
@@ -789,13 +635,6 @@
 				FB39D28E1200F35A00088E69 /* parseConst.cpp in Sources */,
 				FB39D28F1200F35A00088E69 /* ParseHelper.cpp in Sources */,
 				FB39D2911200F35A00088E69 /* PoolAlloc.cpp in Sources */,
-				FB39D2931200F35A00088E69 /* atom.c in Sources */,
-				FB39D2961200F35A00088E69 /* cpp.c in Sources */,
-				FB39D2981200F35A00088E69 /* cppstruct.c in Sources */,
-				FB39D2991200F35A00088E69 /* memory.c in Sources */,
-				FB39D29D1200F35A00088E69 /* scanner.c in Sources */,
-				FB39D2A01200F35A00088E69 /* symbols.c in Sources */,
-				FB39D2A21200F35A00088E69 /* tokens.c in Sources */,
 				FB39D2A41200F35A00088E69 /* QualifierAlive.cpp in Sources */,
 				FB39D2A61200F35A00088E69 /* RemoveTree.cpp in Sources */,
 				FB39D2A81200F35A00088E69 /* ShaderLang.cpp in Sources */,
@@ -819,17 +658,6 @@
 				A26567BB159C21B100398539 /* Diagnostics.cpp in Sources */,
 				A26567BD159C21B100398539 /* DirectiveHandler.cpp in Sources */,
 				A26567BF159C21B100398539 /* InitializeParseContext.cpp in Sources */,
-				A26567EC159C21CE00398539 /* DiagnosticsBase.cpp in Sources */,
-				A26567EE159C21CE00398539 /* DirectiveHandlerBase.cpp in Sources */,
-				A26567F0159C21CE00398539 /* DirectiveParser.cpp in Sources */,
-				A26567F2159C21CE00398539 /* ExpressionParser.cpp in Sources */,
-				A26567F5159C21CE00398539 /* Input.cpp in Sources */,
-				A26567F7159C21CE00398539 /* Lexer.cpp in Sources */,
-				A26567F9159C21CE00398539 /* Macro.cpp in Sources */,
-				A26567FB159C21CE00398539 /* MacroExpander.cpp in Sources */,
-				A2656803159C21CE00398539 /* Preprocessor.cpp in Sources */,
-				A2656807159C21CE00398539 /* Token.cpp in Sources */,
-				A265680A159C21CE00398539 /* Tokenizer.cpp in Sources */,
 				A2656839159C23E100398539 /* DependencyGraph.cpp in Sources */,
 				A265683B159C23E100398539 /* DependencyGraphBuilder.cpp in Sources */,
 				A265683D159C23E100398539 /* DependencyGraphOutput.cpp in Sources */,
@@ -837,6 +665,18 @@
 				A2656840159C23E100398539 /* RestrictFragmentShaderTiming.cpp in Sources */,
 				A2656842159C23E100398539 /* RestrictVertexShaderTiming.cpp in Sources */,
 				3158EA0E1630968D006BE5EE /* ArrayBoundsClamper.cpp in Sources */,
+				A264F8AC16974DED006FAA5A /* DiagnosticsBase.cpp in Sources */,
+				A264F8AE16974DED006FAA5A /* DirectiveHandlerBase.cpp in Sources */,
+				A264F8B016974DED006FAA5A /* DirectiveParser.cpp in Sources */,
+				A264F8B216974DED006FAA5A /* ExpressionParser.cpp in Sources */,
+				A264F8B416974DED006FAA5A /* Input.cpp in Sources */,
+				A264F8B616974DED006FAA5A /* Lexer.cpp in Sources */,
+				A264F8B816974DED006FAA5A /* Macro.cpp in Sources */,
+				A264F8BA16974DED006FAA5A /* MacroExpander.cpp in Sources */,
+				A264F8BE16974DED006FAA5A /* Preprocessor.cpp in Sources */,
+				A264F8C116974DED006FAA5A /* Token.cpp in Sources */,
+				A264F8C316974DED006FAA5A /* Tokenizer.cpp in Sources */,
+				A264F8C916974E2A006FAA5A /* VariablePacker.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/Source/ThirdParty/ANGLE/ChangeLog b/Source/ThirdParty/ANGLE/ChangeLog
index cf79ca0..011f1ec 100644
--- a/Source/ThirdParty/ANGLE/ChangeLog
+++ b/Source/ThirdParty/ANGLE/ChangeLog
@@ -1,3 +1,479 @@
+2013-01-14  Max Vujovic  <mvujovic@adobe.com>
+
+        [ANGLE] Update ANGLE in WebKit
+        https://bugs.webkit.org/show_bug.cgi?id=106274
+
+        Reviewed by Dean Jackson.
+
+        Update ANGLE to r1641.
+
+        ANGLE parsers were generated with Bison 2.3.
+
+        Additionally, perform the following changes to WebKit's ANGLE build system. Note that these
+        changes only apply to WebKit's copy of ANGLE, and do not need to be upstreamed to ANGLE.
+        (a) Remove all files in the libEGL and libGLESv2 directories because nobody is using them. 
+            Add a README in each directory to explain why their contents are not copied over from
+            ANGLE. This simplifies updating ANGLE in the future.
+        (b) Remove the build_angle.xcodeproj file that no-one is using. It appears it was copied
+            over from a gyp build of ANGLE. The Mac build uses ANGLE.xcodeproj.
+        (c) Remove duplicate file entries in ANGLE.xcodeproj. Change its Xcode group structure to
+            match ANGLE's directory structure.
+        (d) Add a Copy Files task to ANGLE.xcodeproj to put the khrplatform.h header in the right
+            place so ShaderLang.h can find it. ShaderLang.h is copied to
+            <BuildDir>/usr/local/include/ANGLE/ShaderLang.h during the Copy Headers task, and it
+            includes "KHR/khrplatform.h". Thus, we need to copy khrplatform.h to
+            <BuildDir>/usr/local/include/ANGLE/KHR/khrplatform.h.
+
+        Additionally, make one build fix in ANGLE source that should be upstreamed to ANGLE:
+        (1) Before this patch in ExpressionParser.y, we toggled the "-Wpragmas" flag so compilers
+            could ignore the pragmas that they didn't understand instead of generating an error.
+            However, clang does not understand "-Wpragmas" itself. Instead, tt understands
+            "-Wunknown-pragmas". Now, instead of trying to temporarily ignore pragmas, we apply the
+            right flags to the right compiler versions. The new code in ExpressionParser.y looks
+            like:
+
+        """
+        // Turn off uninitialized variable warnings triggered by the auto-generated pplval variable.
+        // On gcc 4.7+, The flag is called "-Wmaybe-uninitialized".
+        // On clang and gcc < 4.7, the flag is called "-Wuninitialized".
+        #if !defined(__clang__) && ((__GNUC__ == 4 && __GNU_C_MINOR__ >= 7) || __GNUC__ >= 5)
+        #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+        #else
+        #pragma GCC diagnostic ignored "-Wuninitialized"
+        #endif
+        """
+
+        * ANGLE.plist:
+        * ANGLE.pri:
+        * ANGLE.xcodeproj/project.pbxproj:
+        * DerivedSources.pri:
+        * Target.pri:
+        * include/GLSLANG/ShaderLang.h:
+        * src/build_angle.xcodeproj/project.pbxproj: Removed.
+        * src/common/angleutils.h:
+        * src/common/debug.cpp:
+        (gl::ScopedPerfEventHelper::ScopedPerfEventHelper):
+        * src/common/debug.h:
+        * src/common/version.h:
+        * src/compiler/Compiler.cpp:
+        (TCompiler::Init):
+        (TCompiler::compile):
+        (TCompiler::clearResults):
+        (TCompiler::collectAttribsUniforms):
+        (TCompiler::enforcePackingRestrictions):
+        * src/compiler/Diagnostics.cpp:
+        (TDiagnostics::TDiagnostics):
+        (TDiagnostics::writeInfo):
+        (TDiagnostics::print):
+        * src/compiler/Diagnostics.h:
+        (TDiagnostics::numErrors):
+        (TDiagnostics::numWarnings):
+        (TDiagnostics):
+        * src/compiler/DirectiveHandler.h:
+        * src/compiler/HashNames.h: Added.
+        * src/compiler/Intermediate.cpp:
+        (TIntermTraverser::hash):
+        * src/compiler/OutputESSL.cpp:
+        (TOutputESSL::TOutputESSL):
+        * src/compiler/OutputESSL.h:
+        (TOutputESSL):
+        * src/compiler/OutputGLSL.cpp:
+        (TOutputGLSL::TOutputGLSL):
+        * src/compiler/OutputGLSL.h:
+        (TOutputGLSL):
+        * src/compiler/OutputGLSLBase.cpp:
+        (TOutputGLSLBase::TOutputGLSLBase):
+        (TOutputGLSLBase::writeVariableType):
+        (TOutputGLSLBase::writeFunctionParameters):
+        (TOutputGLSLBase::writeConstantUnion):
+        (TOutputGLSLBase::visitSymbol):
+        (TOutputGLSLBase::visitBinary):
+        (TOutputGLSLBase::visitAggregate):
+        (TOutputGLSLBase::getTypeName):
+        (TOutputGLSLBase::hashName):
+        (TOutputGLSLBase::hashVariableName):
+        (TOutputGLSLBase::hashFunctionName):
+        * src/compiler/OutputGLSLBase.h:
+        (TOutputGLSLBase):
+        * src/compiler/OutputHLSL.cpp:
+        (sh::OutputHLSL::OutputHLSL):
+        (sh::OutputHLSL::header):
+        (sh::OutputHLSL::visitAggregate):
+        (sh::OutputHLSL::visitBranch):
+        (sh::OutputHLSL::handleExcessiveLoop):
+        * src/compiler/OutputHLSL.h:
+        (OutputHLSL):
+        * src/compiler/ParseHelper.cpp:
+        (TParseContext::error):
+        (TParseContext::nonInitConstErrorCheck):
+        (PaParseStrings):
+        * src/compiler/ParseHelper.h:
+        (TParseContext::TParseContext):
+        (TParseContext):
+        (TParseContext::numErrors):
+        * src/compiler/RenameFunction.h:
+        (RenameFunction::visitAggregate):
+        * src/compiler/ShHandle.h:
+        (TCompiler::getHashFunction):
+        (TCompiler::getNameMap):
+        (TCompiler::getSymbolTable):
+        (TCompiler):
+        * src/compiler/ShaderLang.cpp:
+        (ShInitBuiltInResources):
+        (ShGetInfo):
+        (ShGetNameHashingEntry):
+        * src/compiler/SymbolTable.cpp:
+        (TType::TType):
+        (TType::isStructureContainingArrays):
+        * src/compiler/SymbolTable.h:
+        (TSymbolTable::findBuiltIn):
+        (TSymbolTable):
+        * src/compiler/TranslatorESSL.cpp:
+        (TranslatorESSL::translate):
+        * src/compiler/TranslatorGLSL.cpp:
+        (TranslatorGLSL::translate):
+        * src/compiler/Types.h:
+        (TType):
+        (TPublicType):
+        (TPublicType::setBasic):
+        (TPublicType::setAggregate):
+        (TPublicType::setArray):
+        (TPublicType::isStructureContainingArrays):
+        * src/compiler/UnfoldShortCircuit.cpp:
+        (sh::UnfoldShortCircuit::visitBinary):
+        * src/compiler/VariableInfo.cpp:
+        (getVariableInfo):
+        (getUserDefinedVariableInfo):
+        (TVariableInfo::TVariableInfo):
+        (CollectAttribsUniforms::CollectAttribsUniforms):
+        (CollectAttribsUniforms::visitAggregate):
+        * src/compiler/VariableInfo.h:
+        (TVariableInfo):
+        (CollectAttribsUniforms):
+        * src/compiler/VariablePacker.cpp: Added.
+        (VariablePacker::GetNumComponentsPerRow):
+        (VariablePacker::GetNumRows):
+        (TVariableInfoComparer::operator()):
+        (VariablePacker::makeColumnFlags):
+        (VariablePacker::fillColumns):
+        (VariablePacker::searchColumn):
+        (VariablePacker::CheckVariablesWithinPackingLimits):
+        * src/compiler/VariablePacker.h: Added.
+        (VariablePacker):
+        * src/compiler/VersionGLSL.cpp:
+        (TVersionGLSL::visitAggregate):
+        * src/compiler/VersionGLSL.h:
+        (TVersionGLSL):
+        * src/compiler/glslang.l:
+        * src/compiler/glslang.y:
+        * src/compiler/glslang_lex.cpp:
+        (string_input):
+        (glslang_finalize):
+        (glslang_scan):
+        * src/compiler/glslang_tab.cpp:
+        * src/compiler/intermediate.h:
+        (TIntermTraverser):
+        * src/compiler/osinclude.h:
+        (OS_GetTLSValue):
+        * src/compiler/ossource_nspr.cpp:
+        * src/compiler/preprocessor/DiagnosticsBase.cpp: Added.
+        (pp):
+        (pp::Diagnostics::~Diagnostics):
+        (pp::Diagnostics::report):
+        (pp::Diagnostics::severity):
+        (pp::Diagnostics::message):
+        * src/compiler/preprocessor/DiagnosticsBase.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Diagnostics.h.
+        (pp):
+        (Diagnostics):
+        * src/compiler/preprocessor/DirectiveHandlerBase.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveHandlerBase.cpp.
+        (pp):
+        (pp::DirectiveHandler::~DirectiveHandler):
+        * src/compiler/preprocessor/DirectiveHandlerBase.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveHandler.h.
+        (pp):
+        (DirectiveHandler):
+        * src/compiler/preprocessor/DirectiveParser.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveParser.cpp.
+        (getDirective):
+        (isConditionalDirective):
+        (isEOD):
+        (skipUntilEOD):
+        (isMacroNameReserved):
+        (isMacroPredefined):
+        (pp):
+        (DefinedParser):
+        (pp::DefinedParser::DefinedParser):
+        (pp::DefinedParser::lex):
+        (pp::DirectiveParser::DirectiveParser):
+        (pp::DirectiveParser::lex):
+        (pp::DirectiveParser::parseDirective):
+        (pp::DirectiveParser::parseDefine):
+        (pp::DirectiveParser::parseUndef):
+        (pp::DirectiveParser::parseIf):
+        (pp::DirectiveParser::parseIfdef):
+        (pp::DirectiveParser::parseIfndef):
+        (pp::DirectiveParser::parseElse):
+        (pp::DirectiveParser::parseElif):
+        (pp::DirectiveParser::parseEndif):
+        (pp::DirectiveParser::parseError):
+        (pp::DirectiveParser::parsePragma):
+        (pp::DirectiveParser::parseExtension):
+        (pp::DirectiveParser::parseVersion):
+        (pp::DirectiveParser::parseLine):
+        (pp::DirectiveParser::skipping):
+        (pp::DirectiveParser::parseConditionalIf):
+        (pp::DirectiveParser::parseExpressionIf):
+        (pp::DirectiveParser::parseExpressionIfdef):
+        * src/compiler/preprocessor/DirectiveParser.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveParser.h.
+        (pp):
+        (DirectiveParser):
+        (ConditionalBlock):
+        (pp::DirectiveParser::ConditionalBlock::ConditionalBlock):
+        * src/compiler/preprocessor/ExpressionParser.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/ExpressionParser.cpp.
+        (yysyntax_error):
+        (yylex):
+        (yyerror):
+        (pp):
+        (pp::ExpressionParser::ExpressionParser):
+        (pp::ExpressionParser::parse):
+        * src/compiler/preprocessor/ExpressionParser.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/ExpressionParser.h.
+        (pp):
+        (ExpressionParser):
+        * src/compiler/preprocessor/ExpressionParser.y: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/ExpressionParser.y.
+        * src/compiler/preprocessor/Input.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Input.cpp.
+        (pp):
+        (pp::Input::Input):
+        (pp::Input::read):
+        * src/compiler/preprocessor/Input.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Input.h.
+        (pp):
+        (Input):
+        (pp::Input::count):
+        (pp::Input::string):
+        (pp::Input::length):
+        (Location):
+        (pp::Input::Location::Location):
+        (pp::Input::readLoc):
+        * src/compiler/preprocessor/Lexer.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Lexer.cpp.
+        (pp):
+        (pp::Lexer::~Lexer):
+        * src/compiler/preprocessor/Lexer.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Lexer.h.
+        (pp):
+        (Lexer):
+        * src/compiler/preprocessor/Macro.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Macro.cpp.
+        (pp):
+        (pp::Macro::equals):
+        * src/compiler/preprocessor/Macro.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Macro.h.
+        (pp):
+        (pp::Macro::Macro):
+        (Macro):
+        * src/compiler/preprocessor/MacroExpander.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/MacroExpander.cpp.
+        (pp):
+        (TokenLexer):
+        (pp::TokenLexer::TokenLexer):
+        (pp::TokenLexer::lex):
+        (pp::MacroExpander::MacroExpander):
+        (pp::MacroExpander::~MacroExpander):
+        (pp::MacroExpander::lex):
+        (pp::MacroExpander::getToken):
+        (pp::MacroExpander::ungetToken):
+        (pp::MacroExpander::isNextTokenLeftParen):
+        (pp::MacroExpander::pushMacro):
+        (pp::MacroExpander::popMacro):
+        (pp::MacroExpander::expandMacro):
+        (pp::MacroExpander::collectMacroArgs):
+        (pp::MacroExpander::replaceMacroParams):
+        * src/compiler/preprocessor/MacroExpander.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/MacroExpander.h.
+        (pp):
+        (MacroExpander):
+        (MacroContext):
+        (pp::MacroExpander::MacroContext::MacroContext):
+        (pp::MacroExpander::MacroContext::empty):
+        (pp::MacroExpander::MacroContext::get):
+        (pp::MacroExpander::MacroContext::unget):
+        * src/compiler/preprocessor/Preprocessor.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Preprocessor.cpp.
+        (pp):
+        (PreprocessorImpl):
+        (pp::PreprocessorImpl::PreprocessorImpl):
+        (pp::Preprocessor::Preprocessor):
+        (pp::Preprocessor::~Preprocessor):
+        (pp::Preprocessor::init):
+        (pp::Preprocessor::predefineMacro):
+        (pp::Preprocessor::lex):
+        * src/compiler/preprocessor/Preprocessor.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Preprocessor.h.
+        (pp):
+        (Preprocessor):
+        * src/compiler/preprocessor/SourceLocation.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/SourceLocation.h.
+        (pp):
+        (pp::SourceLocation::SourceLocation):
+        (SourceLocation):
+        (pp::SourceLocation::equals):
+        (pp::operator==):
+        (pp::operator!=):
+        * src/compiler/preprocessor/Token.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Token.cpp.
+        (pp):
+        (pp::Token::reset):
+        (pp::Token::equals):
+        (pp::Token::setAtStartOfLine):
+        (pp::Token::setHasLeadingSpace):
+        (pp::Token::setExpansionDisabled):
+        (pp::Token::iValue):
+        (pp::Token::uValue):
+        (pp::Token::fValue):
+        (pp::operator<<):
+        * src/compiler/preprocessor/Token.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Token.h.
+        (pp):
+        (pp::Token::Token):
+        (Token):
+        (pp::Token::atStartOfLine):
+        (pp::Token::hasLeadingSpace):
+        (pp::Token::expansionDisabled):
+        (pp::operator==):
+        (pp::operator!=):
+        * src/compiler/preprocessor/Tokenizer.cpp: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Tokenizer.cpp.
+        (yy_buffer_state):
+        (yy_trans_info):
+        (yyguts_t):
+        (yy_get_previous_state):
+        (yy_try_NUL_trans):
+        (input):
+        (pprestart):
+        (pp_switch_to_buffer):
+        (pp_load_buffer_state):
+        (pp_create_buffer):
+        (pp_delete_buffer):
+        (pp_init_buffer):
+        (pp_flush_buffer):
+        (pppush_buffer_state):
+        (pppop_buffer_state):
+        (ppensure_buffer_stack):
+        (pp_scan_buffer):
+        (pp_scan_string):
+        (pp_scan_bytes):
+        (yy_fatal_error):
+        (ppget_extra):
+        (ppget_lineno):
+        (ppget_column):
+        (ppget_in):
+        (ppget_out):
+        (ppget_leng):
+        (ppget_text):
+        (ppset_extra):
+        (ppset_lineno):
+        (ppset_column):
+        (ppset_in):
+        (ppset_out):
+        (ppget_debug):
+        (ppset_debug):
+        (ppget_lval):
+        (ppset_lval):
+        (ppget_lloc):
+        (ppset_lloc):
+        (pplex_init):
+        (pplex_init_extra):
+        (yy_init_globals):
+        (pplex_destroy):
+        (yy_flex_strncpy):
+        (yy_flex_strlen):
+        (ppalloc):
+        (pprealloc):
+        (ppfree):
+        (pp):
+        (pp::Tokenizer::Tokenizer):
+        (pp::Tokenizer::~Tokenizer):
+        (pp::Tokenizer::init):
+        (pp::Tokenizer::setFileNumber):
+        (pp::Tokenizer::setLineNumber):
+        (pp::Tokenizer::lex):
+        (pp::Tokenizer::initScanner):
+        (pp::Tokenizer::destroyScanner):
+        * src/compiler/preprocessor/Tokenizer.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Tokenizer.h.
+        (pp):
+        (Tokenizer):
+        (Context):
+        * src/compiler/preprocessor/Tokenizer.l: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Tokenizer.l.
+        * src/compiler/preprocessor/atom.c: Removed.
+        * src/compiler/preprocessor/atom.h: Removed.
+        * src/compiler/preprocessor/compile.h: Removed.
+        * src/compiler/preprocessor/cpp.c: Removed.
+        * src/compiler/preprocessor/cpp.h: Removed.
+        * src/compiler/preprocessor/cppstruct.c: Removed.
+        * src/compiler/preprocessor/generate_parser.sh: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/generate_parser.sh.
+        * src/compiler/preprocessor/memory.c: Removed.
+        * src/compiler/preprocessor/memory.h: Removed.
+        * src/compiler/preprocessor/new/DiagnosticsBase.cpp: Removed.
+        * src/compiler/preprocessor/new/new_file.cpp: Removed.
+        * src/compiler/preprocessor/new/new_file2.cpp: Removed.
+        * src/compiler/preprocessor/new/preprocessor.vcproj: Removed.
+        * src/compiler/preprocessor/numeric_lex.h: Added.
+        (pp):
+        (pp::numeric_base_int):
+        (pp::numeric_lex_int):
+        (pp::numeric_lex_float):
+        * src/compiler/preprocessor/parser.h: Removed.
+        * src/compiler/preprocessor/pp_utils.h: Renamed from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/pp_utils.h.
+        * src/compiler/preprocessor/preprocess.h: Removed.
+        * src/compiler/preprocessor/scanner.c: Removed.
+        * src/compiler/preprocessor/scanner.h: Removed.
+        * src/compiler/preprocessor/slglobals.h: Removed.
+        * src/compiler/preprocessor/symbols.c: Removed.
+        * src/compiler/preprocessor/symbols.h: Removed.
+        * src/compiler/preprocessor/tokens.c: Removed.
+        * src/compiler/preprocessor/tokens.h: Removed.
+        * src/libEGL/Config.cpp: Removed.
+        * src/libEGL/Config.h: Removed.
+        * src/libEGL/Display.cpp: Removed.
+        * src/libEGL/Display.h: Removed.
+        * src/libEGL/README: Added.
+        * src/libEGL/Surface.cpp: Removed.
+        * src/libEGL/Surface.h: Removed.
+        * src/libEGL/libEGL.cpp: Removed.
+        * src/libEGL/libEGL.def: Removed.
+        * src/libEGL/libEGL.rc: Removed.
+        * src/libEGL/libEGL.vcproj: Removed.
+        * src/libEGL/main.cpp: Removed.
+        * src/libEGL/main.h: Removed.
+        * src/libEGL/resource.h: Removed.
+        * src/libGLESv2/Blit.cpp: Removed.
+        * src/libGLESv2/Blit.h: Removed.
+        * src/libGLESv2/Buffer.cpp: Removed.
+        * src/libGLESv2/Buffer.h: Removed.
+        * src/libGLESv2/Context.cpp: Removed.
+        * src/libGLESv2/Context.h: Removed.
+        * src/libGLESv2/Fence.cpp: Removed.
+        * src/libGLESv2/Fence.h: Removed.
+        * src/libGLESv2/Framebuffer.cpp: Removed.
+        * src/libGLESv2/Framebuffer.h: Removed.
+        * src/libGLESv2/HandleAllocator.cpp: Removed.
+        * src/libGLESv2/HandleAllocator.h: Removed.
+        * src/libGLESv2/IndexDataManager.cpp: Removed.
+        * src/libGLESv2/IndexDataManager.h: Removed.
+        * src/libGLESv2/Program.cpp: Removed.
+        * src/libGLESv2/Program.h: Removed.
+        * src/libGLESv2/ProgramBinary.cpp: Removed.
+        * src/libGLESv2/ProgramBinary.h: Removed.
+        * src/libGLESv2/Query.cpp: Removed.
+        * src/libGLESv2/Query.h: Removed.
+        * src/libGLESv2/README: Added.
+        * src/libGLESv2/Renderbuffer.cpp: Removed.
+        * src/libGLESv2/Renderbuffer.h: Removed.
+        * src/libGLESv2/ResourceManager.cpp: Removed.
+        * src/libGLESv2/ResourceManager.h: Removed.
+        * src/libGLESv2/Shader.cpp: Removed.
+        * src/libGLESv2/Shader.h: Removed.
+        * src/libGLESv2/Texture.cpp: Removed.
+        * src/libGLESv2/Texture.h: Removed.
+        * src/libGLESv2/VertexDataManager.cpp: Removed.
+        * src/libGLESv2/VertexDataManager.h: Removed.
+        * src/libGLESv2/libGLESv2.cpp: Removed.
+        * src/libGLESv2/libGLESv2.def: Removed.
+        * src/libGLESv2/libGLESv2.rc: Removed.
+        * src/libGLESv2/libGLESv2.vcproj: Removed.
+        * src/libGLESv2/main.cpp: Removed.
+        * src/libGLESv2/main.h: Removed.
+        * src/libGLESv2/mathutil.h: Removed.
+        * src/libGLESv2/resource.h: Removed.
+        * src/libGLESv2/utilities.cpp: Removed.
+        * src/libGLESv2/utilities.h: Removed.
+        * src/libGLESv2/vertexconversion.h: Removed.
+
 2012-12-18  Max Vujovic  <mvujovic@adobe.com>
 
         [ANGLE] Use of uninitialized memory in ArrayBoundsClamper
diff --git a/Source/ThirdParty/ANGLE/DerivedSources.pri b/Source/ThirdParty/ANGLE/DerivedSources.pri
index b3a89fc..8f950e8 100644
--- a/Source/ThirdParty/ANGLE/DerivedSources.pri
+++ b/Source/ThirdParty/ANGLE/DerivedSources.pri
@@ -13,7 +13,7 @@
 
 ANGLE_FLEX_SOURCES = \
     $$PWD/src/compiler/glslang.l \
-    $$PWD/src/compiler/preprocessor/new/Tokenizer.l
+    $$PWD/src/compiler/preprocessor/Tokenizer.l
 
 angleflex.output = ${QMAKE_FILE_BASE}_lex.cpp
 angleflex.input = ANGLE_FLEX_SOURCES
@@ -22,7 +22,7 @@
 
 ANGLE_BISON_SOURCES = \
     $$PWD/src/compiler/glslang.y \
-    $$PWD/src/compiler/preprocessor/new/ExpressionParser.y
+    $$PWD/src/compiler/preprocessor/ExpressionParser.y
 
 anglebison_decl.output = ${QMAKE_FILE_BASE}_tab.h
 anglebison_decl.input = ANGLE_BISON_SOURCES
diff --git a/Source/ThirdParty/ANGLE/Target.pri b/Source/ThirdParty/ANGLE/Target.pri
index eaa936d..b779538 100644
--- a/Source/ThirdParty/ANGLE/Target.pri
+++ b/Source/ThirdParty/ANGLE/Target.pri
@@ -13,7 +13,7 @@
 
 INCLUDEPATH += \
     $$SOURCE_DIR/src \
-    $$SOURCE_DIR/src/compiler/preprocessor/new \
+    $$SOURCE_DIR/src/compiler/preprocessor \
     $$SOURCE_DIR/include
 
 HEADERS += \
@@ -33,6 +33,7 @@
     src/compiler/ExtensionBehavior.h \
     src/compiler/ForLoopUnroll.h \
     src/compiler/glslang.h \
+    src/compiler/HashNames.h \
     src/compiler/InfoSink.h \
     src/compiler/InitializeDll.h \
     src/compiler/InitializeGlobals.h \
@@ -44,28 +45,19 @@
     src/compiler/MapLongVariableNames.h \
     src/compiler/osinclude.h \
     src/compiler/Pragma.h \
-    src/compiler/preprocessor/atom.h \
-    src/compiler/preprocessor/compile.h \
-    src/compiler/preprocessor/cpp.h \
+    src/compiler/preprocessor/DiagnosticsBase.h \
+    src/compiler/preprocessor/DirectiveHandlerBase.h \
+    src/compiler/preprocessor/DirectiveParser.h \
+    src/compiler/preprocessor/Input.h \
     src/compiler/preprocessor/length_limits.h \
-    src/compiler/preprocessor/memory.h \
-    src/compiler/preprocessor/new/Diagnostics.h \
-    src/compiler/preprocessor/new/DirectiveHandler.h \
-    src/compiler/preprocessor/new/DirectiveParser.h \
-    src/compiler/preprocessor/new/Input.h \
-    src/compiler/preprocessor/new/Lexer.h \
-    src/compiler/preprocessor/new/Macro.h \
-    src/compiler/preprocessor/new/MacroExpander.h \
-    src/compiler/preprocessor/new/Preprocessor.h \
-    src/compiler/preprocessor/new/SourceLocation.h \
-    src/compiler/preprocessor/new/Token.h \
-    src/compiler/preprocessor/new/Tokenizer.h \
-    src/compiler/preprocessor/parser.h \
-    src/compiler/preprocessor/preprocess.h \
-    src/compiler/preprocessor/scanner.h \
-    src/compiler/preprocessor/slglobals.h \
-    src/compiler/preprocessor/symbols.h \
-    src/compiler/preprocessor/tokens.h \
+    src/compiler/preprocessor/Lexer.h \
+    src/compiler/preprocessor/Macro.h \
+    src/compiler/preprocessor/MacroExpander.h \
+    src/compiler/preprocessor/numeric_lex.h \
+    src/compiler/preprocessor/Preprocessor.h \
+    src/compiler/preprocessor/SourceLocation.h \
+    src/compiler/preprocessor/Token.h \
+    src/compiler/preprocessor/Tokenizer.h \
     src/compiler/OutputESSL.h \
     src/compiler/OutputGLSL.h \
     src/compiler/OutputGLSLBase.h \
@@ -88,6 +80,7 @@
     src/compiler/util.h \
     src/compiler/ValidateLimitations.h \
     src/compiler/VariableInfo.h \
+    src/compiler/VariablePacker.h \
     src/compiler/VersionGLSL.h
 
 SOURCES += \
@@ -134,23 +127,17 @@
     src/compiler/util.cpp \
     src/compiler/ValidateLimitations.cpp \
     src/compiler/VariableInfo.cpp \
+    src/compiler/VariablePacker.cpp \
     src/compiler/VersionGLSL.cpp \
-    src/compiler/preprocessor/atom.c \
-    src/compiler/preprocessor/cpp.c \
-    src/compiler/preprocessor/cppstruct.c \
-    src/compiler/preprocessor/memory.c \
-    src/compiler/preprocessor/new/DiagnosticsBase.cpp \
-    src/compiler/preprocessor/new/DirectiveHandlerBase.cpp \
-    src/compiler/preprocessor/new/DirectiveParser.cpp \
-    src/compiler/preprocessor/new/Input.cpp \
-    src/compiler/preprocessor/new/Lexer.cpp \
-    src/compiler/preprocessor/new/Macro.cpp \
-    src/compiler/preprocessor/new/MacroExpander.cpp \
-    src/compiler/preprocessor/new/Preprocessor.cpp \
-    src/compiler/preprocessor/new/Token.cpp \
-    src/compiler/preprocessor/scanner.c \
-    src/compiler/preprocessor/symbols.c \
-    src/compiler/preprocessor/tokens.c
+    src/compiler/preprocessor/DiagnosticsBase.cpp \
+    src/compiler/preprocessor/DirectiveHandlerBase.cpp \
+    src/compiler/preprocessor/DirectiveParser.cpp \
+    src/compiler/preprocessor/Input.cpp \
+    src/compiler/preprocessor/Lexer.cpp \
+    src/compiler/preprocessor/Macro.cpp \
+    src/compiler/preprocessor/MacroExpander.cpp \
+    src/compiler/preprocessor/Preprocessor.cpp \
+    src/compiler/preprocessor/Token.cpp \
 
 win32: SOURCES += src/compiler/ossource_win.cpp
 else: SOURCES += src/compiler/ossource_posix.cpp
diff --git a/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h b/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h
index d82931e..46237f1 100644
--- a/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h
+++ b/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h
@@ -23,6 +23,8 @@
 #define COMPILER_EXPORT
 #endif
 
+#include "KHR/khrplatform.h"
+
 //
 // This is the platform independent interface between an OGL driver
 // and the shading language compiler.
@@ -110,7 +112,10 @@
   SH_ACTIVE_UNIFORM_MAX_LENGTH   =  0x8B87,
   SH_ACTIVE_ATTRIBUTES           =  0x8B89,
   SH_ACTIVE_ATTRIBUTE_MAX_LENGTH =  0x8B8A,
-  SH_MAPPED_NAME_MAX_LENGTH      =  0x8B8B
+  SH_MAPPED_NAME_MAX_LENGTH      =  0x6000,
+  SH_NAME_MAX_LENGTH             =  0x6001,
+  SH_HASHED_NAME_MAX_LENGTH      =  0x6002,
+  SH_HASHED_NAMES_COUNT          =  0x6003
 } ShShaderInfo;
 
 // Compile options.
@@ -144,11 +149,14 @@
   // - The shader type is SH_FRAGMENT_SHADER.
   SH_DEPENDENCY_GRAPH = 0x0400,
 
+  // Enforce the GLSL 1.017 Appendix A section 7 packing restrictions.
+  SH_ENFORCE_PACKING_RESTRICTIONS = 0x0800,
+
   // This flag ensures all indirect (expression-based) array indexing
   // is clamped to the bounds of the array. This ensures, for example,
   // that you cannot read off the end of a uniform, whether an array
   // vec234, or mat234 type.
-  SH_CLAMP_INDIRECT_ARRAY_BOUNDS = 0x0800
+  SH_CLAMP_INDIRECT_ARRAY_BOUNDS = 0x1000
 } ShCompileOptions;
 
 //
@@ -163,6 +171,10 @@
 //
 COMPILER_EXPORT int ShFinalize();
 
+// The 64 bits hash function. The first parameter is the input string; the
+// second parameter is the string length.
+typedef khronos_uint64_t (*ShHashFunction64)(const char*, unsigned int);
+
 //
 // Implementation dependent built-in resources (constants and extensions).
 // The names for these resources has been obtained by stripping gl_/GL_.
@@ -184,6 +196,11 @@
     int OES_standard_derivatives;
     int OES_EGL_image_external;
     int ARB_texture_rectangle;
+
+    // Name Hashing.
+    // Set a 64 bit hash function to enable user-defined name hashing.
+    // Default is NULL.
+    ShHashFunction64 HashFunction;
 } ShBuiltInResources;
 
 //
@@ -270,6 +287,11 @@
 //                               termination character.
 // SH_MAPPED_NAME_MAX_LENGTH: the length of the mapped variable name including
 //                            the null termination character.
+// SH_NAME_MAX_LENGTH: the max length of a user-defined name including the
+//                     null termination character.
+// SH_HASHED_NAME_MAX_LENGTH: the max length of a hashed name including the
+//                            null termination character.
+// SH_HASHED_NAMES_COUNT: the number of hashed names from the latest compile.
 // 
 // params: Requested parameter
 COMPILER_EXPORT void ShGetInfo(const ShHandle handle,
@@ -350,6 +372,24 @@
                                         char* name,
                                         char* mappedName);
 
+// Returns information about a name hashing entry from the latest compile.
+// Parameters:
+// handle: Specifies the compiler
+// index: Specifies the index of the name hashing entry to be queried.
+// name: Returns a null terminated string containing the user defined name.
+//       It is assumed that name has enough memory to accomodate the name.
+//       The size of the buffer required to store the user defined name can
+//       be obtained by calling ShGetInfo with SH_NAME_MAX_LENGTH.
+// hashedName: Returns a null terminated string containing the hashed name of
+//             the uniform variable, It is assumed that hashedName has enough
+//             memory to accomodate the name. The size of the buffer required
+//             to store the name can be obtained by calling ShGetInfo with
+//             SH_HASHED_NAME_MAX_LENGTH.
+COMPILER_EXPORT void ShGetNameHashingEntry(const ShHandle handle,
+                                           int index,
+                                           char* name,
+                                           char* hashedName);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/Source/ThirdParty/ANGLE/src/build_angle.xcodeproj/project.pbxproj b/Source/ThirdParty/ANGLE/src/build_angle.xcodeproj/project.pbxproj
deleted file mode 100644
index 565db7d..0000000
--- a/Source/ThirdParty/ANGLE/src/build_angle.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,935 +0,0 @@
-// !$*UTF8*$!
-{
-	archiveVersion = 1;
-	classes = {
-	};
-	objectVersion = 45;
-	objects = {
-
-/* Begin PBXAggregateTarget section */
-		1563D9916BFDAD853032CE1A /* All */ = {
-			isa = PBXAggregateTarget;
-			buildConfigurationList = 77CEFB7B40F05B0A804E6B2B /* Build configuration list for PBXAggregateTarget "All" */;
-			buildPhases = (
-			);
-			dependencies = (
-				A15E78BECDFF20BC3FFF040A /* PBXTargetDependency */,
-				BA246CA19435A9FA8AC69146 /* PBXTargetDependency */,
-				E4A3D33CA49D013550B8BA5F /* PBXTargetDependency */,
-			);
-			name = All;
-			productName = All;
-		};
-/* End PBXAggregateTarget section */
-
-/* Begin PBXBuildFile section */
-		05563ADFEA15116D7233332F /* QualifierAlive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4857E18799D332C30EF460C7 /* QualifierAlive.cpp */; };
-		08A7933BD2F78A86B90200F6 /* Compiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0A118E5003E5C0E253C53839 /* Compiler.cpp */; };
-		0A216949103E1E228F9C12F0 /* InitializeDll.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 60C3998C9CE66DE0C5B0FD99 /* InitializeDll.cpp */; };
-		0AC1897E461A0D4758E3DCE3 /* VersionGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F727AEC906712EC238041464 /* VersionGLSL.cpp */; };
-		0E9456F464E16392D1CCD030 /* ValidateLimitations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B148D967B8D288A8267BFF3A /* ValidateLimitations.cpp */; };
-		0EC09B3B254829F8F1D952D3 /* ForLoopUnroll.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5DC9B647E10F65F66142ECC1 /* ForLoopUnroll.cpp */; };
-		1ED1D2C7C74C6B625AFB1CCF /* VariableInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27C11EE10FED2979931FFC11 /* VariableInfo.cpp */; };
-		296466566D8C0F023A553760 /* SearchSymbol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 228A6DEDDF08DB370394A7AD /* SearchSymbol.cpp */; };
-		2E7C0D3804B8308A493D9B4B /* glslang_tab.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3F68A6AA811495718A6938C0 /* glslang_tab.cpp */; };
-		3021E0BF1BC8442FF1F2F2B4 /* glslang_lex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 73A57C6D413773AEBA3C47A6 /* glslang_lex.cpp */; };
-		3065D29E97FAC6E127388D15 /* Initialize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A54F2ED0D82D7BBCA4E9EEEA /* Initialize.cpp */; };
-		32B1DBCD6B83F2146D787A62 /* atom.c in Sources */ = {isa = PBXBuildFile; fileRef = 0C9B4616A65A5ABEF91FD6DC /* atom.c */; };
-		35BE1BBEE6135A1CB0608EA8 /* cppstruct.c in Sources */ = {isa = PBXBuildFile; fileRef = 8058A0A2A0A02386867517EA /* cppstruct.c */; };
-		3A96E9CAC8A25AF1564B652C /* memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 294F442A2606FEC55F12A28E /* memory.c */; };
-		3F18389BCB89370A930667F4 /* TranslatorGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6FB70DC74A21FBCD665ABDF9 /* TranslatorGLSL.cpp */; };
-		40FC189B8A246EDF14C2FDE3 /* intermOut.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DEAF6F3126C2EC4397785C3F /* intermOut.cpp */; };
-		4B4BDE7AD6266B39ED43C2D4 /* CodeGenHLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C49549DCCAF450EB761520E1 /* CodeGenHLSL.cpp */; };
-		50DF00005CC4212F6FB1291D /* Intermediate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3F7C486C370A72938FE8160F /* Intermediate.cpp */; };
-		55CBD87573B803A173AC9129 /* util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3EE7215A7AB4EF71C97D2545 /* util.cpp */; };
-		5F7B52A54DCE8155ED94ECF8 /* OutputHLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A5B5BB2526802479E19F993 /* OutputHLSL.cpp */; };
-		6F9F875017A68ABE5D39FF19 /* ParseHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 976C831A75EBE009A9861796 /* ParseHelper.cpp */; };
-		888F1382498E2D74AF2801C8 /* debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4ABA230FEA3654B030E4C4FB /* debug.cpp */; };
-		896B720BD21F6749A7D83F30 /* MapLongVariableNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57CF1F83E842901C42D44825 /* MapLongVariableNames.cpp */; };
-		93A41AF036E5EF87B366B563 /* TranslatorESSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0A3A260F5379A7E2655D40F3 /* TranslatorESSL.cpp */; };
-		9B111B83FB636FD5CDEC32A0 /* OutputGLSLBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCDF01F002ADE9DB8A3EF4FE /* OutputGLSLBase.cpp */; };
-		9E8DFE1CCEF038BF2B65428C /* parseConst.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D2C9C8EB4A7EFF5B67FF9DBF /* parseConst.cpp */; };
-		A201083B159C31A000E57BBE /* Diagnostics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A201081F159C31A000E57BBE /* Diagnostics.cpp */; };
-		A201083C159C31A000E57BBE /* DirectiveHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2010821159C31A000E57BBE /* DirectiveHandler.cpp */; };
-		A201083D159C31A000E57BBE /* DirectiveParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2010823159C31A000E57BBE /* DirectiveParser.cpp */; };
-		A201083E159C31A000E57BBE /* ExpressionParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2010825159C31A000E57BBE /* ExpressionParser.cpp */; };
-		A2010840159C31A000E57BBE /* Input.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2010829159C31A000E57BBE /* Input.cpp */; };
-		A2010841159C31A000E57BBE /* Lexer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A201082B159C31A000E57BBE /* Lexer.cpp */; };
-		A2010842159C31A000E57BBE /* Macro.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A201082D159C31A000E57BBE /* Macro.cpp */; };
-		A2010843159C31A000E57BBE /* MacroExpander.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A201082F159C31A000E57BBE /* MacroExpander.cpp */; };
-		A2010844159C31A000E57BBE /* Preprocessor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2010832159C31A000E57BBE /* Preprocessor.cpp */; };
-		A2010845159C31A000E57BBE /* Token.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2010836159C31A000E57BBE /* Token.cpp */; };
-		A2010846159C31A000E57BBE /* Tokenizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2010838159C31A000E57BBE /* Tokenizer.cpp */; };
-		A2010862159C324F00E57BBE /* BuiltInFunctionEmulator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2010849159C324F00E57BBE /* BuiltInFunctionEmulator.cpp */; };
-		A2010863159C324F00E57BBE /* DependencyGraph.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A201084C159C324F00E57BBE /* DependencyGraph.cpp */; };
-		A2010864159C324F00E57BBE /* DependencyGraphBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A201084E159C324F00E57BBE /* DependencyGraphBuilder.cpp */; };
-		A2010865159C324F00E57BBE /* DependencyGraphOutput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2010850159C324F00E57BBE /* DependencyGraphOutput.cpp */; };
-		A2010866159C324F00E57BBE /* DependencyGraphTraverse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2010852159C324F00E57BBE /* DependencyGraphTraverse.cpp */; };
-		A2010867159C324F00E57BBE /* DetectRecursion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2010853159C324F00E57BBE /* DetectRecursion.cpp */; };
-		A2010868159C324F00E57BBE /* Diagnostics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2010855159C324F00E57BBE /* Diagnostics.cpp */; };
-		A2010869159C324F00E57BBE /* DirectiveHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2010857159C324F00E57BBE /* DirectiveHandler.cpp */; };
-		A201086A159C324F00E57BBE /* InitializeParseContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A201085A159C324F00E57BBE /* InitializeParseContext.cpp */; };
-		A201086B159C324F00E57BBE /* RestrictFragmentShaderTiming.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A201085E159C324F00E57BBE /* RestrictFragmentShaderTiming.cpp */; };
-		A201086C159C324F00E57BBE /* RestrictVertexShaderTiming.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2010860159C324F00E57BBE /* RestrictVertexShaderTiming.cpp */; };
-		A2010871159C326200E57BBE /* DetectDiscontinuity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A201086D159C326200E57BBE /* DetectDiscontinuity.cpp */; };
-		A2010872159C326200E57BBE /* UnfoldShortCircuit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A201086F159C326200E57BBE /* UnfoldShortCircuit.cpp */; };
-		AC23F58FDD3C55F5CA18EED7 /* RemoveTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B436EFF06913FCB19C3522A7 /* RemoveTree.cpp */; };
-		AD85517F086FDCEF3947C403 /* symbols.c in Sources */ = {isa = PBXBuildFile; fileRef = F013A7240BDAE8A61413D8C0 /* symbols.c */; };
-		B4858417E54365BE8CDE3919 /* ossource_posix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE258486005F6696CC031622 /* ossource_posix.cpp */; };
-		B8BD2685A16B188CCDFB052B /* ShaderLang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 56C7E99BA500A84C35216FE0 /* ShaderLang.cpp */; };
-		BEBBF4F0819EA3D03977A8FC /* InfoSink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E6927BE5D3C2C82F86111DF /* InfoSink.cpp */; };
-		C4AAB2BB4594C0DA318DCB1C /* OutputESSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DB2917C5B624712364DE4A75 /* OutputESSL.cpp */; };
-		C75EB9292A0DDA45592A8ACF /* OutputGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 48B7402CC07A059FEF5EC351 /* OutputGLSL.cpp */; };
-		CB7F0EF0D6A89FA8C4DF5513 /* cpp.c in Sources */ = {isa = PBXBuildFile; fileRef = B75707B393B7EAB7DD9999CB /* cpp.c */; };
-		D56F7D00E9B162E416D37DF0 /* CodeGenGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B7B1127C75B576FC00D74AED /* CodeGenGLSL.cpp */; };
-		E1C7C5DFF0B2DFEC09387F4E /* PoolAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B64EABE738FC666A5E4E2F42 /* PoolAlloc.cpp */; };
-		E8C727AA8E9DC5E7B58857DF /* tokens.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D00745DA9914FDE274D03D5 /* tokens.c */; };
-		E99D6D80DBF05ECE7108B26D /* TranslatorHLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3DAFF6BF12BB7F4784D6C7E /* TranslatorHLSL.cpp */; };
-		F098F463EDABCF0769007678 /* scanner.c in Sources */ = {isa = PBXBuildFile; fileRef = FF3AA694DF9A4455A813234D /* scanner.c */; };
-		F5AE2A292DFAF8C158412AA2 /* IntermTraverse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C4FE988EF9A293867E5C771B /* IntermTraverse.cpp */; };
-		F6ABD58F8CAB7641D8BFE935 /* SymbolTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B7E5B0F04635E6090F0DE8EF /* SymbolTable.cpp */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXContainerItemProxy section */
-		1F7242496103EDF29CC25D87 /* PBXContainerItemProxy */ = {
-			isa = PBXContainerItemProxy;
-			containerPortal = DA188D8C6BF8073122539131 /* Project object */;
-			proxyType = 1;
-			remoteGlobalIDString = A838E9574B3FF14791DBDAB1;
-			remoteInfo = translator_hlsl;
-		};
-		55D5F9BF727E4A3B6637802B /* PBXContainerItemProxy */ = {
-			isa = PBXContainerItemProxy;
-			containerPortal = DA188D8C6BF8073122539131 /* Project object */;
-			proxyType = 1;
-			remoteGlobalIDString = 6F4FD35CB3DFC89D70ECD432;
-			remoteInfo = translator_common;
-		};
-		60D3546AC27B094D6CA04CD6 /* PBXContainerItemProxy */ = {
-			isa = PBXContainerItemProxy;
-			containerPortal = DA188D8C6BF8073122539131 /* Project object */;
-			proxyType = 1;
-			remoteGlobalIDString = 5892C7A3695330437AFE5714;
-			remoteInfo = translator_glsl;
-		};
-/* End PBXContainerItemProxy section */
-
-/* Begin PBXFileReference section */
-		056FEADC7D95C6D4C9CF1113 /* scanner.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scanner.h; sourceTree = "<group>"; };
-		0A118E5003E5C0E253C53839 /* Compiler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Compiler.cpp; sourceTree = "<group>"; };
-		0A3A260F5379A7E2655D40F3 /* TranslatorESSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TranslatorESSL.cpp; sourceTree = "<group>"; };
-		0C9B4616A65A5ABEF91FD6DC /* atom.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = atom.c; sourceTree = "<group>"; };
-		120AD0A3B7642FB5A9AE3A56 /* VersionGLSL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VersionGLSL.h; sourceTree = "<group>"; };
-		12EAF028311EEA4753E82818 /* PoolAlloc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PoolAlloc.h; sourceTree = "<group>"; };
-		153BF06BF12C6F50496C6156 /* localintermediate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = localintermediate.h; sourceTree = "<group>"; };
-		182BAD50D4E58B884F5EB9F3 /* ForLoopUnroll.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ForLoopUnroll.h; sourceTree = "<group>"; };
-		228A6DEDDF08DB370394A7AD /* SearchSymbol.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SearchSymbol.cpp; sourceTree = "<group>"; };
-		27C11EE10FED2979931FFC11 /* VariableInfo.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = VariableInfo.cpp; sourceTree = "<group>"; };
-		27E4C7ED0B82E18DCBEDF1C9 /* BaseTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseTypes.h; sourceTree = "<group>"; };
-		294F442A2606FEC55F12A28E /* memory.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memory.c; sourceTree = "<group>"; };
-		2D00745DA9914FDE274D03D5 /* tokens.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tokens.c; sourceTree = "<group>"; };
-		2E7C9B6E6DB751E12A2F6CB6 /* InitializeGlobals.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InitializeGlobals.h; sourceTree = "<group>"; };
-		3DDDC77216202A4DE1808BDB /* libtranslator_common.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libtranslator_common.a; sourceTree = BUILT_PRODUCTS_DIR; };
-		3EE7215A7AB4EF71C97D2545 /* util.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = util.cpp; sourceTree = "<group>"; };
-		3F68A6AA811495718A6938C0 /* glslang_tab.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = glslang_tab.cpp; sourceTree = "<group>"; };
-		3F7C486C370A72938FE8160F /* Intermediate.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Intermediate.cpp; sourceTree = "<group>"; };
-		4857E18799D332C30EF460C7 /* QualifierAlive.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = QualifierAlive.cpp; sourceTree = "<group>"; };
-		48B7402CC07A059FEF5EC351 /* OutputGLSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = OutputGLSL.cpp; sourceTree = "<group>"; };
-		497C5C24EEF466FB4B50A259 /* glslang.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = glslang.h; sourceTree = "<group>"; };
-		4ABA230FEA3654B030E4C4FB /* debug.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = debug.cpp; sourceTree = "<group>"; };
-		4FCF32CB2D8A42C930A66B00 /* glslang_tab.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = glslang_tab.h; sourceTree = "<group>"; };
-		528FF201839C6F233E26FFDA /* cpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cpp.h; sourceTree = "<group>"; };
-		56C7E99BA500A84C35216FE0 /* ShaderLang.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ShaderLang.cpp; sourceTree = "<group>"; };
-		57CF1F83E842901C42D44825 /* MapLongVariableNames.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MapLongVariableNames.cpp; sourceTree = "<group>"; };
-		580B2A31F7C51A59B40F11A3 /* compile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = compile.h; sourceTree = "<group>"; };
-		5A21599C59BC1A75A7FABA34 /* OutputHLSL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OutputHLSL.h; sourceTree = "<group>"; };
-		5D99354C4D8187D384C81207 /* VariableInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VariableInfo.h; sourceTree = "<group>"; };
-		5DC9B647E10F65F66142ECC1 /* ForLoopUnroll.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ForLoopUnroll.cpp; sourceTree = "<group>"; };
-		60C3998C9CE66DE0C5B0FD99 /* InitializeDll.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InitializeDll.cpp; sourceTree = "<group>"; };
-		6BB66AB5873868E23675B6DB /* OutputESSL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OutputESSL.h; sourceTree = "<group>"; };
-		6BBC8224B9D8E234D117FA0C /* preprocess.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = preprocess.h; sourceTree = "<group>"; };
-		6E6927BE5D3C2C82F86111DF /* InfoSink.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InfoSink.cpp; sourceTree = "<group>"; };
-		6FB70DC74A21FBCD665ABDF9 /* TranslatorGLSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TranslatorGLSL.cpp; sourceTree = "<group>"; };
-		73A57C6D413773AEBA3C47A6 /* glslang_lex.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = glslang_lex.cpp; sourceTree = "<group>"; };
-		799DC9611EE2EA3BA7CF5477 /* intermediate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = intermediate.h; sourceTree = "<group>"; };
-		7C6BB12AB099556CF379D78F /* SymbolTable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SymbolTable.h; sourceTree = "<group>"; };
-		7D9CF376DC5799B4C6B3331E /* symbols.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = symbols.h; sourceTree = "<group>"; };
-		8058A0A2A0A02386867517EA /* cppstruct.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cppstruct.c; sourceTree = "<group>"; };
-		81CC4245A8E5AB5584D336F3 /* MapLongVariableNames.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MapLongVariableNames.h; sourceTree = "<group>"; };
-		831399DEE5DABA09570FB3E7 /* memory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = "<group>"; };
-		8513FAC699DB1558D1D49A48 /* Initialize.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Initialize.h; sourceTree = "<group>"; };
-		85845FFF5A8E63364308236D /* InitializeParseContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InitializeParseContext.h; sourceTree = "<group>"; };
-		89A6F7B1AD3918E64DF76EB1 /* slglobals.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = slglobals.h; sourceTree = "<group>"; };
-		90254842D72975672C2E9A93 /* ValidateLimitations.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ValidateLimitations.h; sourceTree = "<group>"; };
-		93D61CB0BCE54E069D71F920 /* OutputGLSL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OutputGLSL.h; sourceTree = "<group>"; };
-		95276AA6B36FC1B1D913FCE4 /* debug.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = debug.h; sourceTree = "<group>"; };
-		976C831A75EBE009A9861796 /* ParseHelper.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ParseHelper.cpp; sourceTree = "<group>"; };
-		9A5B5BB2526802479E19F993 /* OutputHLSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = OutputHLSL.cpp; sourceTree = "<group>"; };
-		9CED3AFF1E61B45EE1005656 /* atom.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = atom.h; sourceTree = "<group>"; };
-		9D47B1AC82E4EE859AC54243 /* QualifierAlive.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QualifierAlive.h; sourceTree = "<group>"; };
-		A0CE43631849276A31187C7B /* InitializeDll.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InitializeDll.h; sourceTree = "<group>"; };
-		A1644B00E9304C407FDC5F47 /* libtranslator_glsl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libtranslator_glsl.a; sourceTree = BUILT_PRODUCTS_DIR; };
-		A20107FF159C313C00E57BBE /* libtranslator_common copy.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libtranslator_common copy.a"; sourceTree = BUILT_PRODUCTS_DIR; };
-		A201081F159C31A000E57BBE /* Diagnostics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Diagnostics.cpp; sourceTree = "<group>"; };
-		A2010820159C31A000E57BBE /* Diagnostics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Diagnostics.h; sourceTree = "<group>"; };
-		A2010821159C31A000E57BBE /* DirectiveHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectiveHandler.cpp; sourceTree = "<group>"; };
-		A2010822159C31A000E57BBE /* DirectiveHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectiveHandler.h; sourceTree = "<group>"; };
-		A2010823159C31A000E57BBE /* DirectiveParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectiveParser.cpp; sourceTree = "<group>"; };
-		A2010824159C31A000E57BBE /* DirectiveParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectiveParser.h; sourceTree = "<group>"; };
-		A2010825159C31A000E57BBE /* ExpressionParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExpressionParser.cpp; sourceTree = "<group>"; };
-		A2010826159C31A000E57BBE /* ExpressionParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExpressionParser.h; sourceTree = "<group>"; };
-		A2010829159C31A000E57BBE /* Input.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Input.cpp; sourceTree = "<group>"; };
-		A201082A159C31A000E57BBE /* Input.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Input.h; sourceTree = "<group>"; };
-		A201082B159C31A000E57BBE /* Lexer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Lexer.cpp; sourceTree = "<group>"; };
-		A201082C159C31A000E57BBE /* Lexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Lexer.h; sourceTree = "<group>"; };
-		A201082D159C31A000E57BBE /* Macro.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Macro.cpp; sourceTree = "<group>"; };
-		A201082E159C31A000E57BBE /* Macro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Macro.h; sourceTree = "<group>"; };
-		A201082F159C31A000E57BBE /* MacroExpander.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacroExpander.cpp; sourceTree = "<group>"; };
-		A2010830159C31A000E57BBE /* MacroExpander.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroExpander.h; sourceTree = "<group>"; };
-		A2010831159C31A000E57BBE /* pp_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pp_utils.h; sourceTree = "<group>"; };
-		A2010832159C31A000E57BBE /* Preprocessor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Preprocessor.cpp; sourceTree = "<group>"; };
-		A2010833159C31A000E57BBE /* Preprocessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Preprocessor.h; sourceTree = "<group>"; };
-		A2010835159C31A000E57BBE /* SourceLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceLocation.h; sourceTree = "<group>"; };
-		A2010836159C31A000E57BBE /* Token.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Token.cpp; sourceTree = "<group>"; };
-		A2010837159C31A000E57BBE /* Token.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Token.h; sourceTree = "<group>"; };
-		A2010838159C31A000E57BBE /* Tokenizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Tokenizer.cpp; sourceTree = "<group>"; };
-		A2010839159C31A000E57BBE /* Tokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tokenizer.h; sourceTree = "<group>"; };
-		A2010848159C320900E57BBE /* length_limits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = length_limits.h; sourceTree = "<group>"; };
-		A2010849159C324F00E57BBE /* BuiltInFunctionEmulator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BuiltInFunctionEmulator.cpp; sourceTree = "<group>"; };
-		A201084A159C324F00E57BBE /* BuiltInFunctionEmulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BuiltInFunctionEmulator.h; sourceTree = "<group>"; };
-		A201084C159C324F00E57BBE /* DependencyGraph.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DependencyGraph.cpp; sourceTree = "<group>"; };
-		A201084D159C324F00E57BBE /* DependencyGraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DependencyGraph.h; sourceTree = "<group>"; };
-		A201084E159C324F00E57BBE /* DependencyGraphBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DependencyGraphBuilder.cpp; sourceTree = "<group>"; };
-		A201084F159C324F00E57BBE /* DependencyGraphBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DependencyGraphBuilder.h; sourceTree = "<group>"; };
-		A2010850159C324F00E57BBE /* DependencyGraphOutput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DependencyGraphOutput.cpp; sourceTree = "<group>"; };
-		A2010851159C324F00E57BBE /* DependencyGraphOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DependencyGraphOutput.h; sourceTree = "<group>"; };
-		A2010852159C324F00E57BBE /* DependencyGraphTraverse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DependencyGraphTraverse.cpp; sourceTree = "<group>"; };
-		A2010853159C324F00E57BBE /* DetectRecursion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetectRecursion.cpp; sourceTree = "<group>"; };
-		A2010854159C324F00E57BBE /* DetectRecursion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetectRecursion.h; sourceTree = "<group>"; };
-		A2010855159C324F00E57BBE /* Diagnostics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Diagnostics.cpp; sourceTree = "<group>"; };
-		A2010856159C324F00E57BBE /* Diagnostics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Diagnostics.h; sourceTree = "<group>"; };
-		A2010857159C324F00E57BBE /* DirectiveHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectiveHandler.cpp; sourceTree = "<group>"; };
-		A2010858159C324F00E57BBE /* DirectiveHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectiveHandler.h; sourceTree = "<group>"; };
-		A2010859159C324F00E57BBE /* ExtensionBehavior.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtensionBehavior.h; sourceTree = "<group>"; };
-		A201085A159C324F00E57BBE /* InitializeParseContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InitializeParseContext.cpp; sourceTree = "<group>"; };
-		A201085B159C324F00E57BBE /* Pragma.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pragma.h; sourceTree = "<group>"; };
-		A201085C159C324F00E57BBE /* RenameFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenameFunction.h; sourceTree = "<group>"; };
-		A201085E159C324F00E57BBE /* RestrictFragmentShaderTiming.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RestrictFragmentShaderTiming.cpp; sourceTree = "<group>"; };
-		A201085F159C324F00E57BBE /* RestrictFragmentShaderTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RestrictFragmentShaderTiming.h; sourceTree = "<group>"; };
-		A2010860159C324F00E57BBE /* RestrictVertexShaderTiming.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RestrictVertexShaderTiming.cpp; sourceTree = "<group>"; };
-		A2010861159C324F00E57BBE /* RestrictVertexShaderTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RestrictVertexShaderTiming.h; sourceTree = "<group>"; };
-		A201086D159C326200E57BBE /* DetectDiscontinuity.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetectDiscontinuity.cpp; sourceTree = "<group>"; };
-		A201086E159C326200E57BBE /* DetectDiscontinuity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetectDiscontinuity.h; sourceTree = "<group>"; };
-		A201086F159C326200E57BBE /* UnfoldShortCircuit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnfoldShortCircuit.cpp; sourceTree = "<group>"; };
-		A2010870159C326200E57BBE /* UnfoldShortCircuit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnfoldShortCircuit.h; sourceTree = "<group>"; };
-		A447F75F33DA4C4C123AC952 /* libtranslator_hlsl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libtranslator_hlsl.a; sourceTree = BUILT_PRODUCTS_DIR; };
-		A51C728B615B41E1D59E9902 /* util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = "<group>"; };
-		A54F2ED0D82D7BBCA4E9EEEA /* Initialize.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Initialize.cpp; sourceTree = "<group>"; };
-		AA53B6632C76F905DF08E564 /* Types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Types.h; sourceTree = "<group>"; };
-		AE65E139AE10DE9EFAD8D5B1 /* ShHandle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ShHandle.h; sourceTree = "<group>"; };
-		AE7674C52BDDDB28AF5FFD9F /* unistd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = unistd.h; sourceTree = "<group>"; };
-		B148D967B8D288A8267BFF3A /* ValidateLimitations.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ValidateLimitations.cpp; sourceTree = "<group>"; };
-		B2F5CA11EEA92DF2384EFD93 /* ConstantUnion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ConstantUnion.h; sourceTree = "<group>"; };
-		B436EFF06913FCB19C3522A7 /* RemoveTree.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoveTree.cpp; sourceTree = "<group>"; };
-		B55B359CF7E486DBC49BBF0A /* OutputGLSLBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OutputGLSLBase.h; sourceTree = "<group>"; };
-		B64EABE738FC666A5E4E2F42 /* PoolAlloc.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PoolAlloc.cpp; sourceTree = "<group>"; };
-		B75707B393B7EAB7DD9999CB /* cpp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cpp.c; sourceTree = "<group>"; };
-		B7B1127C75B576FC00D74AED /* CodeGenGLSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CodeGenGLSL.cpp; sourceTree = "<group>"; };
-		B7E5B0F04635E6090F0DE8EF /* SymbolTable.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolTable.cpp; sourceTree = "<group>"; };
-		BCDF01F002ADE9DB8A3EF4FE /* OutputGLSLBase.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = OutputGLSLBase.cpp; sourceTree = "<group>"; };
-		BE258486005F6696CC031622 /* ossource_posix.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ossource_posix.cpp; sourceTree = "<group>"; };
-		C3DAFF6BF12BB7F4784D6C7E /* TranslatorHLSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TranslatorHLSL.cpp; sourceTree = "<group>"; };
-		C49549DCCAF450EB761520E1 /* CodeGenHLSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CodeGenHLSL.cpp; sourceTree = "<group>"; };
-		C4FE988EF9A293867E5C771B /* IntermTraverse.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = IntermTraverse.cpp; sourceTree = "<group>"; };
-		C8BD59BD7056FFC21373C50A /* osinclude.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = osinclude.h; sourceTree = "<group>"; };
-		CEE0C90DF6D504D1F3629711 /* ParseHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ParseHelper.h; sourceTree = "<group>"; };
-		CF2B62E0820C831AF812D000 /* build_angle.gyp */ = {isa = PBXFileReference; lastKnownFileType = text; path = build_angle.gyp; sourceTree = "<group>"; };
-		CFD12C6E46EBE0839BBE52B5 /* parser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = parser.h; sourceTree = "<group>"; };
-		D13C3693B9E40D37F2FAB34A /* tokens.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = tokens.h; sourceTree = "<group>"; };
-		D2C9C8EB4A7EFF5B67FF9DBF /* parseConst.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = parseConst.cpp; sourceTree = "<group>"; };
-		D40F78CB9BA0C89921FA319D /* RemoveTree.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoveTree.h; sourceTree = "<group>"; };
-		D53DDD0CDF15EE1DD01F1A20 /* TranslatorESSL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TranslatorESSL.h; sourceTree = "<group>"; };
-		DB2917C5B624712364DE4A75 /* OutputESSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = OutputESSL.cpp; sourceTree = "<group>"; };
-		DDD3B7E3B7B35A0B8469AB87 /* TranslatorGLSL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TranslatorGLSL.h; sourceTree = "<group>"; };
-		DEAF6F3126C2EC4397785C3F /* intermOut.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = intermOut.cpp; sourceTree = "<group>"; };
-		DEEAFC618A3B33F1FBFE3536 /* MMap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMap.h; sourceTree = "<group>"; };
-		E3A29B6E9C21B67C25FF0D2B /* TranslatorHLSL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TranslatorHLSL.h; sourceTree = "<group>"; };
-		F013A7240BDAE8A61413D8C0 /* symbols.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = symbols.c; sourceTree = "<group>"; };
-		F3E09DC8E1BF5D2958AACEDE /* SearchSymbol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SearchSymbol.h; sourceTree = "<group>"; };
-		F727AEC906712EC238041464 /* VersionGLSL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = VersionGLSL.cpp; sourceTree = "<group>"; };
-		F74618F18FE5448115017C44 /* Common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Common.h; sourceTree = "<group>"; };
-		F7B2971D4EB3836B94B7ECAF /* InfoSink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InfoSink.h; sourceTree = "<group>"; };
-		F99E737D3FFD30CA5E354150 /* common.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; name = common.gypi; path = ../build/common.gypi; sourceTree = "<group>"; };
-		FF3AA694DF9A4455A813234D /* scanner.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = scanner.c; sourceTree = "<group>"; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
-		A20107FB159C313C00E57BBE /* Frameworks */ = {
-			isa = PBXFrameworksBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		A5C994E74DB1E60338E7BC11 /* Frameworks */ = {
-			isa = PBXFrameworksBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		CA71CBA633EFC63166BEC9F3 /* Frameworks */ = {
-			isa = PBXFrameworksBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		FE3679A0955B25EB7BF116E6 /* Frameworks */ = {
-			isa = PBXFrameworksBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
-		0E8D65F584FDB84DAABD3969 /* preprocessor */ = {
-			isa = PBXGroup;
-			children = (
-				0C9B4616A65A5ABEF91FD6DC /* atom.c */,
-				9CED3AFF1E61B45EE1005656 /* atom.h */,
-				580B2A31F7C51A59B40F11A3 /* compile.h */,
-				B75707B393B7EAB7DD9999CB /* cpp.c */,
-				528FF201839C6F233E26FFDA /* cpp.h */,
-				8058A0A2A0A02386867517EA /* cppstruct.c */,
-				A2010848159C320900E57BBE /* length_limits.h */,
-				294F442A2606FEC55F12A28E /* memory.c */,
-				831399DEE5DABA09570FB3E7 /* memory.h */,
-				A201081E159C31A000E57BBE /* new */,
-				CFD12C6E46EBE0839BBE52B5 /* parser.h */,
-				6BBC8224B9D8E234D117FA0C /* preprocess.h */,
-				FF3AA694DF9A4455A813234D /* scanner.c */,
-				056FEADC7D95C6D4C9CF1113 /* scanner.h */,
-				89A6F7B1AD3918E64DF76EB1 /* slglobals.h */,
-				F013A7240BDAE8A61413D8C0 /* symbols.c */,
-				7D9CF376DC5799B4C6B3331E /* symbols.h */,
-				2D00745DA9914FDE274D03D5 /* tokens.c */,
-				D13C3693B9E40D37F2FAB34A /* tokens.h */,
-			);
-			path = preprocessor;
-			sourceTree = "<group>";
-		};
-		196DB6AB006BB83503C7D786 /* Source */ = {
-			isa = PBXGroup;
-			children = (
-				27E4C7ED0B82E18DCBEDF1C9 /* BaseTypes.h */,
-				A2010849159C324F00E57BBE /* BuiltInFunctionEmulator.cpp */,
-				A201084A159C324F00E57BBE /* BuiltInFunctionEmulator.h */,
-				B7B1127C75B576FC00D74AED /* CodeGenGLSL.cpp */,
-				C49549DCCAF450EB761520E1 /* CodeGenHLSL.cpp */,
-				F74618F18FE5448115017C44 /* Common.h */,
-				0A118E5003E5C0E253C53839 /* Compiler.cpp */,
-				B2F5CA11EEA92DF2384EFD93 /* ConstantUnion.h */,
-				4ABA230FEA3654B030E4C4FB /* debug.cpp */,
-				95276AA6B36FC1B1D913FCE4 /* debug.h */,
-				A201084B159C324F00E57BBE /* depgraph */,
-				A201086D159C326200E57BBE /* DetectDiscontinuity.cpp */,
-				A201086E159C326200E57BBE /* DetectDiscontinuity.h */,
-				A2010853159C324F00E57BBE /* DetectRecursion.cpp */,
-				A2010854159C324F00E57BBE /* DetectRecursion.h */,
-				A2010855159C324F00E57BBE /* Diagnostics.cpp */,
-				A2010856159C324F00E57BBE /* Diagnostics.h */,
-				A2010857159C324F00E57BBE /* DirectiveHandler.cpp */,
-				A2010858159C324F00E57BBE /* DirectiveHandler.h */,
-				A2010859159C324F00E57BBE /* ExtensionBehavior.h */,
-				5DC9B647E10F65F66142ECC1 /* ForLoopUnroll.cpp */,
-				182BAD50D4E58B884F5EB9F3 /* ForLoopUnroll.h */,
-				497C5C24EEF466FB4B50A259 /* glslang.h */,
-				73A57C6D413773AEBA3C47A6 /* glslang_lex.cpp */,
-				3F68A6AA811495718A6938C0 /* glslang_tab.cpp */,
-				4FCF32CB2D8A42C930A66B00 /* glslang_tab.h */,
-				6E6927BE5D3C2C82F86111DF /* InfoSink.cpp */,
-				F7B2971D4EB3836B94B7ECAF /* InfoSink.h */,
-				A54F2ED0D82D7BBCA4E9EEEA /* Initialize.cpp */,
-				8513FAC699DB1558D1D49A48 /* Initialize.h */,
-				60C3998C9CE66DE0C5B0FD99 /* InitializeDll.cpp */,
-				A0CE43631849276A31187C7B /* InitializeDll.h */,
-				2E7C9B6E6DB751E12A2F6CB6 /* InitializeGlobals.h */,
-				A201085A159C324F00E57BBE /* InitializeParseContext.cpp */,
-				85845FFF5A8E63364308236D /* InitializeParseContext.h */,
-				3F7C486C370A72938FE8160F /* Intermediate.cpp */,
-				799DC9611EE2EA3BA7CF5477 /* intermediate.h */,
-				DEAF6F3126C2EC4397785C3F /* intermOut.cpp */,
-				C4FE988EF9A293867E5C771B /* IntermTraverse.cpp */,
-				153BF06BF12C6F50496C6156 /* localintermediate.h */,
-				57CF1F83E842901C42D44825 /* MapLongVariableNames.cpp */,
-				81CC4245A8E5AB5584D336F3 /* MapLongVariableNames.h */,
-				DEEAFC618A3B33F1FBFE3536 /* MMap.h */,
-				C8BD59BD7056FFC21373C50A /* osinclude.h */,
-				BE258486005F6696CC031622 /* ossource_posix.cpp */,
-				DB2917C5B624712364DE4A75 /* OutputESSL.cpp */,
-				6BB66AB5873868E23675B6DB /* OutputESSL.h */,
-				48B7402CC07A059FEF5EC351 /* OutputGLSL.cpp */,
-				93D61CB0BCE54E069D71F920 /* OutputGLSL.h */,
-				BCDF01F002ADE9DB8A3EF4FE /* OutputGLSLBase.cpp */,
-				B55B359CF7E486DBC49BBF0A /* OutputGLSLBase.h */,
-				9A5B5BB2526802479E19F993 /* OutputHLSL.cpp */,
-				5A21599C59BC1A75A7FABA34 /* OutputHLSL.h */,
-				D2C9C8EB4A7EFF5B67FF9DBF /* parseConst.cpp */,
-				976C831A75EBE009A9861796 /* ParseHelper.cpp */,
-				CEE0C90DF6D504D1F3629711 /* ParseHelper.h */,
-				B64EABE738FC666A5E4E2F42 /* PoolAlloc.cpp */,
-				12EAF028311EEA4753E82818 /* PoolAlloc.h */,
-				A201085B159C324F00E57BBE /* Pragma.h */,
-				0E8D65F584FDB84DAABD3969 /* preprocessor */,
-				4857E18799D332C30EF460C7 /* QualifierAlive.cpp */,
-				9D47B1AC82E4EE859AC54243 /* QualifierAlive.h */,
-				B436EFF06913FCB19C3522A7 /* RemoveTree.cpp */,
-				D40F78CB9BA0C89921FA319D /* RemoveTree.h */,
-				A201085C159C324F00E57BBE /* RenameFunction.h */,
-				228A6DEDDF08DB370394A7AD /* SearchSymbol.cpp */,
-				F3E09DC8E1BF5D2958AACEDE /* SearchSymbol.h */,
-				56C7E99BA500A84C35216FE0 /* ShaderLang.cpp */,
-				AE65E139AE10DE9EFAD8D5B1 /* ShHandle.h */,
-				B7E5B0F04635E6090F0DE8EF /* SymbolTable.cpp */,
-				7C6BB12AB099556CF379D78F /* SymbolTable.h */,
-				A201085D159C324F00E57BBE /* timing */,
-				0A3A260F5379A7E2655D40F3 /* TranslatorESSL.cpp */,
-				D53DDD0CDF15EE1DD01F1A20 /* TranslatorESSL.h */,
-				6FB70DC74A21FBCD665ABDF9 /* TranslatorGLSL.cpp */,
-				DDD3B7E3B7B35A0B8469AB87 /* TranslatorGLSL.h */,
-				C3DAFF6BF12BB7F4784D6C7E /* TranslatorHLSL.cpp */,
-				E3A29B6E9C21B67C25FF0D2B /* TranslatorHLSL.h */,
-				AA53B6632C76F905DF08E564 /* Types.h */,
-				A201086F159C326200E57BBE /* UnfoldShortCircuit.cpp */,
-				A2010870159C326200E57BBE /* UnfoldShortCircuit.h */,
-				AE7674C52BDDDB28AF5FFD9F /* unistd.h */,
-				3EE7215A7AB4EF71C97D2545 /* util.cpp */,
-				A51C728B615B41E1D59E9902 /* util.h */,
-				B148D967B8D288A8267BFF3A /* ValidateLimitations.cpp */,
-				90254842D72975672C2E9A93 /* ValidateLimitations.h */,
-				27C11EE10FED2979931FFC11 /* VariableInfo.cpp */,
-				5D99354C4D8187D384C81207 /* VariableInfo.h */,
-				F727AEC906712EC238041464 /* VersionGLSL.cpp */,
-				120AD0A3B7642FB5A9AE3A56 /* VersionGLSL.h */,
-			);
-			name = Source;
-			path = compiler;
-			sourceTree = "<group>";
-		};
-		5BBEFF9B91738297B95C568D = {
-			isa = PBXGroup;
-			children = (
-				196DB6AB006BB83503C7D786 /* Source */,
-				E0EDC4130E7D374318CE72BE /* Products */,
-				B2C184C3543198BA51592EA4 /* Build */,
-			);
-			sourceTree = "<group>";
-		};
-		A201081E159C31A000E57BBE /* new */ = {
-			isa = PBXGroup;
-			children = (
-				A201081F159C31A000E57BBE /* Diagnostics.cpp */,
-				A2010820159C31A000E57BBE /* Diagnostics.h */,
-				A2010821159C31A000E57BBE /* DirectiveHandler.cpp */,
-				A2010822159C31A000E57BBE /* DirectiveHandler.h */,
-				A2010823159C31A000E57BBE /* DirectiveParser.cpp */,
-				A2010824159C31A000E57BBE /* DirectiveParser.h */,
-				A2010825159C31A000E57BBE /* ExpressionParser.cpp */,
-				A2010826159C31A000E57BBE /* ExpressionParser.h */,
-				A2010829159C31A000E57BBE /* Input.cpp */,
-				A201082A159C31A000E57BBE /* Input.h */,
-				A201082B159C31A000E57BBE /* Lexer.cpp */,
-				A201082C159C31A000E57BBE /* Lexer.h */,
-				A201082D159C31A000E57BBE /* Macro.cpp */,
-				A201082E159C31A000E57BBE /* Macro.h */,
-				A201082F159C31A000E57BBE /* MacroExpander.cpp */,
-				A2010830159C31A000E57BBE /* MacroExpander.h */,
-				A2010831159C31A000E57BBE /* pp_utils.h */,
-				A2010832159C31A000E57BBE /* Preprocessor.cpp */,
-				A2010833159C31A000E57BBE /* Preprocessor.h */,
-				A2010835159C31A000E57BBE /* SourceLocation.h */,
-				A2010836159C31A000E57BBE /* Token.cpp */,
-				A2010837159C31A000E57BBE /* Token.h */,
-				A2010838159C31A000E57BBE /* Tokenizer.cpp */,
-				A2010839159C31A000E57BBE /* Tokenizer.h */,
-			);
-			path = new;
-			sourceTree = "<group>";
-		};
-		A201084B159C324F00E57BBE /* depgraph */ = {
-			isa = PBXGroup;
-			children = (
-				A201084C159C324F00E57BBE /* DependencyGraph.cpp */,
-				A201084D159C324F00E57BBE /* DependencyGraph.h */,
-				A201084E159C324F00E57BBE /* DependencyGraphBuilder.cpp */,
-				A201084F159C324F00E57BBE /* DependencyGraphBuilder.h */,
-				A2010850159C324F00E57BBE /* DependencyGraphOutput.cpp */,
-				A2010851159C324F00E57BBE /* DependencyGraphOutput.h */,
-				A2010852159C324F00E57BBE /* DependencyGraphTraverse.cpp */,
-			);
-			path = depgraph;
-			sourceTree = "<group>";
-		};
-		A201085D159C324F00E57BBE /* timing */ = {
-			isa = PBXGroup;
-			children = (
-				A201085E159C324F00E57BBE /* RestrictFragmentShaderTiming.cpp */,
-				A201085F159C324F00E57BBE /* RestrictFragmentShaderTiming.h */,
-				A2010860159C324F00E57BBE /* RestrictVertexShaderTiming.cpp */,
-				A2010861159C324F00E57BBE /* RestrictVertexShaderTiming.h */,
-			);
-			path = timing;
-			sourceTree = "<group>";
-		};
-		B2C184C3543198BA51592EA4 /* Build */ = {
-			isa = PBXGroup;
-			children = (
-				CF2B62E0820C831AF812D000 /* build_angle.gyp */,
-				F99E737D3FFD30CA5E354150 /* common.gypi */,
-			);
-			name = Build;
-			sourceTree = "<group>";
-		};
-		E0EDC4130E7D374318CE72BE /* Products */ = {
-			isa = PBXGroup;
-			children = (
-				3DDDC77216202A4DE1808BDB /* libtranslator_common.a */,
-				A1644B00E9304C407FDC5F47 /* libtranslator_glsl.a */,
-				A447F75F33DA4C4C123AC952 /* libtranslator_hlsl.a */,
-				A20107FF159C313C00E57BBE /* libtranslator_common copy.a */,
-			);
-			name = Products;
-			sourceTree = "<group>";
-		};
-/* End PBXGroup section */
-
-/* Begin PBXNativeTarget section */
-		5892C7A3695330437AFE5714 /* translator_glsl */ = {
-			isa = PBXNativeTarget;
-			buildConfigurationList = 8B8815CA2EFE60FD0C0361BF /* Build configuration list for PBXNativeTarget "translator_glsl" */;
-			buildPhases = (
-				BABCE721106B5C1527EFEF0D /* Sources */,
-				CA71CBA633EFC63166BEC9F3 /* Frameworks */,
-			);
-			buildRules = (
-			);
-			dependencies = (
-			);
-			name = translator_glsl;
-			productName = translator_glsl;
-			productReference = A1644B00E9304C407FDC5F47 /* libtranslator_glsl.a */;
-			productType = "com.apple.product-type.library.static";
-		};
-		6F4FD35CB3DFC89D70ECD432 /* translator_common */ = {
-			isa = PBXNativeTarget;
-			buildConfigurationList = 34BB38E3A74418B2A063B49E /* Build configuration list for PBXNativeTarget "translator_common" */;
-			buildPhases = (
-				EAA22CA63FD572FCCB913D22 /* Sources */,
-				A5C994E74DB1E60338E7BC11 /* Frameworks */,
-			);
-			buildRules = (
-			);
-			dependencies = (
-			);
-			name = translator_common;
-			productName = translator_common;
-			productReference = 3DDDC77216202A4DE1808BDB /* libtranslator_common.a */;
-			productType = "com.apple.product-type.library.static";
-		};
-		A20107DC159C313C00E57BBE /* preprocessor */ = {
-			isa = PBXNativeTarget;
-			buildConfigurationList = A20107FC159C313C00E57BBE /* Build configuration list for PBXNativeTarget "preprocessor" */;
-			buildPhases = (
-				A20107DD159C313C00E57BBE /* Sources */,
-				A20107FB159C313C00E57BBE /* Frameworks */,
-			);
-			buildRules = (
-			);
-			dependencies = (
-			);
-			name = preprocessor;
-			productName = translator_common;
-			productReference = A20107FF159C313C00E57BBE /* libtranslator_common copy.a */;
-			productType = "com.apple.product-type.library.static";
-		};
-		A838E9574B3FF14791DBDAB1 /* translator_hlsl */ = {
-			isa = PBXNativeTarget;
-			buildConfigurationList = C71E79C7829FD796CF621B44 /* Build configuration list for PBXNativeTarget "translator_hlsl" */;
-			buildPhases = (
-				05F3BCA9518770BE3F1E0A38 /* Sources */,
-				FE3679A0955B25EB7BF116E6 /* Frameworks */,
-			);
-			buildRules = (
-			);
-			dependencies = (
-			);
-			name = translator_hlsl;
-			productName = translator_hlsl;
-			productReference = A447F75F33DA4C4C123AC952 /* libtranslator_hlsl.a */;
-			productType = "com.apple.product-type.library.static";
-		};
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
-		DA188D8C6BF8073122539131 /* Project object */ = {
-			isa = PBXProject;
-			attributes = {
-				BuildIndependentTargetsInParallel = YES;
-			};
-			buildConfigurationList = 0E59F8FE4A8099E8DDCA4CE7 /* Build configuration list for PBXProject "build_angle" */;
-			compatibilityVersion = "Xcode 3.1";
-			developmentRegion = English;
-			hasScannedForEncodings = 1;
-			knownRegions = (
-				en,
-			);
-			mainGroup = 5BBEFF9B91738297B95C568D;
-			projectDirPath = "";
-			projectRoot = "";
-			targets = (
-				1563D9916BFDAD853032CE1A /* All */,
-				6F4FD35CB3DFC89D70ECD432 /* translator_common */,
-				5892C7A3695330437AFE5714 /* translator_glsl */,
-				A838E9574B3FF14791DBDAB1 /* translator_hlsl */,
-				A20107DC159C313C00E57BBE /* preprocessor */,
-			);
-		};
-/* End PBXProject section */
-
-/* Begin PBXSourcesBuildPhase section */
-		05F3BCA9518770BE3F1E0A38 /* Sources */ = {
-			isa = PBXSourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				4B4BDE7AD6266B39ED43C2D4 /* CodeGenHLSL.cpp in Sources */,
-				5F7B52A54DCE8155ED94ECF8 /* OutputHLSL.cpp in Sources */,
-				E99D6D80DBF05ECE7108B26D /* TranslatorHLSL.cpp in Sources */,
-				296466566D8C0F023A553760 /* SearchSymbol.cpp in Sources */,
-				A2010871159C326200E57BBE /* DetectDiscontinuity.cpp in Sources */,
-				A2010872159C326200E57BBE /* UnfoldShortCircuit.cpp in Sources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		A20107DD159C313C00E57BBE /* Sources */ = {
-			isa = PBXSourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				A201083B159C31A000E57BBE /* Diagnostics.cpp in Sources */,
-				A201083C159C31A000E57BBE /* DirectiveHandler.cpp in Sources */,
-				A201083D159C31A000E57BBE /* DirectiveParser.cpp in Sources */,
-				A201083E159C31A000E57BBE /* ExpressionParser.cpp in Sources */,
-				A2010840159C31A000E57BBE /* Input.cpp in Sources */,
-				A2010841159C31A000E57BBE /* Lexer.cpp in Sources */,
-				A2010842159C31A000E57BBE /* Macro.cpp in Sources */,
-				A2010843159C31A000E57BBE /* MacroExpander.cpp in Sources */,
-				A2010844159C31A000E57BBE /* Preprocessor.cpp in Sources */,
-				A2010845159C31A000E57BBE /* Token.cpp in Sources */,
-				A2010846159C31A000E57BBE /* Tokenizer.cpp in Sources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		BABCE721106B5C1527EFEF0D /* Sources */ = {
-			isa = PBXSourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				D56F7D00E9B162E416D37DF0 /* CodeGenGLSL.cpp in Sources */,
-				0EC09B3B254829F8F1D952D3 /* ForLoopUnroll.cpp in Sources */,
-				C4AAB2BB4594C0DA318DCB1C /* OutputESSL.cpp in Sources */,
-				9B111B83FB636FD5CDEC32A0 /* OutputGLSLBase.cpp in Sources */,
-				C75EB9292A0DDA45592A8ACF /* OutputGLSL.cpp in Sources */,
-				93A41AF036E5EF87B366B563 /* TranslatorESSL.cpp in Sources */,
-				3F18389BCB89370A930667F4 /* TranslatorGLSL.cpp in Sources */,
-				0AC1897E461A0D4758E3DCE3 /* VersionGLSL.cpp in Sources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		EAA22CA63FD572FCCB913D22 /* Sources */ = {
-			isa = PBXSourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				08A7933BD2F78A86B90200F6 /* Compiler.cpp in Sources */,
-				888F1382498E2D74AF2801C8 /* debug.cpp in Sources */,
-				3021E0BF1BC8442FF1F2F2B4 /* glslang_lex.cpp in Sources */,
-				2E7C0D3804B8308A493D9B4B /* glslang_tab.cpp in Sources */,
-				BEBBF4F0819EA3D03977A8FC /* InfoSink.cpp in Sources */,
-				3065D29E97FAC6E127388D15 /* Initialize.cpp in Sources */,
-				0A216949103E1E228F9C12F0 /* InitializeDll.cpp in Sources */,
-				50DF00005CC4212F6FB1291D /* Intermediate.cpp in Sources */,
-				40FC189B8A246EDF14C2FDE3 /* intermOut.cpp in Sources */,
-				F5AE2A292DFAF8C158412AA2 /* IntermTraverse.cpp in Sources */,
-				896B720BD21F6749A7D83F30 /* MapLongVariableNames.cpp in Sources */,
-				9E8DFE1CCEF038BF2B65428C /* parseConst.cpp in Sources */,
-				6F9F875017A68ABE5D39FF19 /* ParseHelper.cpp in Sources */,
-				E1C7C5DFF0B2DFEC09387F4E /* PoolAlloc.cpp in Sources */,
-				05563ADFEA15116D7233332F /* QualifierAlive.cpp in Sources */,
-				AC23F58FDD3C55F5CA18EED7 /* RemoveTree.cpp in Sources */,
-				B8BD2685A16B188CCDFB052B /* ShaderLang.cpp in Sources */,
-				F6ABD58F8CAB7641D8BFE935 /* SymbolTable.cpp in Sources */,
-				55CBD87573B803A173AC9129 /* util.cpp in Sources */,
-				0E9456F464E16392D1CCD030 /* ValidateLimitations.cpp in Sources */,
-				1ED1D2C7C74C6B625AFB1CCF /* VariableInfo.cpp in Sources */,
-				32B1DBCD6B83F2146D787A62 /* atom.c in Sources */,
-				CB7F0EF0D6A89FA8C4DF5513 /* cpp.c in Sources */,
-				35BE1BBEE6135A1CB0608EA8 /* cppstruct.c in Sources */,
-				3A96E9CAC8A25AF1564B652C /* memory.c in Sources */,
-				F098F463EDABCF0769007678 /* scanner.c in Sources */,
-				AD85517F086FDCEF3947C403 /* symbols.c in Sources */,
-				E8C727AA8E9DC5E7B58857DF /* tokens.c in Sources */,
-				B4858417E54365BE8CDE3919 /* ossource_posix.cpp in Sources */,
-				A2010862159C324F00E57BBE /* BuiltInFunctionEmulator.cpp in Sources */,
-				A2010863159C324F00E57BBE /* DependencyGraph.cpp in Sources */,
-				A2010864159C324F00E57BBE /* DependencyGraphBuilder.cpp in Sources */,
-				A2010865159C324F00E57BBE /* DependencyGraphOutput.cpp in Sources */,
-				A2010866159C324F00E57BBE /* DependencyGraphTraverse.cpp in Sources */,
-				A2010867159C324F00E57BBE /* DetectRecursion.cpp in Sources */,
-				A2010868159C324F00E57BBE /* Diagnostics.cpp in Sources */,
-				A2010869159C324F00E57BBE /* DirectiveHandler.cpp in Sources */,
-				A201086A159C324F00E57BBE /* InitializeParseContext.cpp in Sources */,
-				A201086B159C324F00E57BBE /* RestrictFragmentShaderTiming.cpp in Sources */,
-				A201086C159C324F00E57BBE /* RestrictVertexShaderTiming.cpp in Sources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXSourcesBuildPhase section */
-
-/* Begin PBXTargetDependency section */
-		A15E78BECDFF20BC3FFF040A /* PBXTargetDependency */ = {
-			isa = PBXTargetDependency;
-			target = 6F4FD35CB3DFC89D70ECD432 /* translator_common */;
-			targetProxy = 55D5F9BF727E4A3B6637802B /* PBXContainerItemProxy */;
-		};
-		BA246CA19435A9FA8AC69146 /* PBXTargetDependency */ = {
-			isa = PBXTargetDependency;
-			target = 5892C7A3695330437AFE5714 /* translator_glsl */;
-			targetProxy = 60D3546AC27B094D6CA04CD6 /* PBXContainerItemProxy */;
-		};
-		E4A3D33CA49D013550B8BA5F /* PBXTargetDependency */ = {
-			isa = PBXTargetDependency;
-			target = A838E9574B3FF14791DBDAB1 /* translator_hlsl */;
-			targetProxy = 1F7242496103EDF29CC25D87 /* PBXContainerItemProxy */;
-		};
-/* End PBXTargetDependency section */
-
-/* Begin XCBuildConfiguration section */
-		322A8C62423B595E11BAD42D /* Debug */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				PRODUCT_NAME = All;
-			};
-			name = Debug;
-		};
-		4DA42A78D3B855C9CD8F658D /* Release */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				EXECUTABLE_PREFIX = lib;
-				GCC_PREPROCESSOR_DEFINITIONS = (
-					"\"ANGLE_DISABLE_TRACE\"",
-					"\"ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0\"",
-				);
-				HEADER_SEARCH_PATHS = (
-					.,
-					../include,
-				);
-				PRODUCT_NAME = translator_common;
-			};
-			name = Release;
-		};
-		4F851F5BA5FA43E9E0B9CB86 /* Release */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				PRODUCT_NAME = All;
-			};
-			name = Release;
-		};
-		88ADC9285519A668808B51EE /* Debug */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				EXECUTABLE_PREFIX = lib;
-				GCC_PREPROCESSOR_DEFINITIONS = (
-					"\"ANGLE_DISABLE_TRACE\"",
-					"\"ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0\"",
-				);
-				HEADER_SEARCH_PATHS = (
-					.,
-					../include,
-				);
-				PRODUCT_NAME = translator_glsl;
-			};
-			name = Debug;
-		};
-		9DC66E1FF9349CDCC8D52C46 /* Debug */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				INTERMEDIATE_DIR = "$(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION)";
-				SHARED_INTERMEDIATE_DIR = "$(SYMROOT)/DerivedSources/$(CONFIGURATION)";
-			};
-			name = Debug;
-		};
-		A20107FD159C313C00E57BBE /* Debug */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				EXECUTABLE_PREFIX = lib;
-				GCC_PREPROCESSOR_DEFINITIONS = (
-					"\"ANGLE_DISABLE_TRACE\"",
-					"\"ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0\"",
-				);
-				HEADER_SEARCH_PATHS = (
-					.,
-					../include,
-				);
-				PRODUCT_NAME = "translator_common copy";
-			};
-			name = Debug;
-		};
-		A20107FE159C313C00E57BBE /* Release */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				EXECUTABLE_PREFIX = lib;
-				GCC_PREPROCESSOR_DEFINITIONS = (
-					"\"ANGLE_DISABLE_TRACE\"",
-					"\"ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0\"",
-				);
-				HEADER_SEARCH_PATHS = (
-					.,
-					../include,
-				);
-				PRODUCT_NAME = "translator_common copy";
-			};
-			name = Release;
-		};
-		AF7C2CD10C6FEA076B141E6E /* Release */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				EXECUTABLE_PREFIX = lib;
-				GCC_PREPROCESSOR_DEFINITIONS = (
-					"\"ANGLE_DISABLE_TRACE\"",
-					"\"ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0\"",
-				);
-				HEADER_SEARCH_PATHS = (
-					.,
-					../include,
-				);
-				PRODUCT_NAME = translator_glsl;
-			};
-			name = Release;
-		};
-		B096FAF032DB19AB637D38F0 /* Release */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				EXECUTABLE_PREFIX = lib;
-				GCC_PREPROCESSOR_DEFINITIONS = (
-					"\"ANGLE_DISABLE_TRACE\"",
-					"\"ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0\"",
-				);
-				HEADER_SEARCH_PATHS = (
-					.,
-					../include,
-				);
-				PRODUCT_NAME = translator_hlsl;
-			};
-			name = Release;
-		};
-		C4546B14B0EB5EB8C5D39DC2 /* Release */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				INTERMEDIATE_DIR = "$(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION)";
-				SHARED_INTERMEDIATE_DIR = "$(SYMROOT)/DerivedSources/$(CONFIGURATION)";
-			};
-			name = Release;
-		};
-		F029E0D369FAFEA46BDAFCEE /* Debug */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				EXECUTABLE_PREFIX = lib;
-				GCC_PREPROCESSOR_DEFINITIONS = (
-					"\"ANGLE_DISABLE_TRACE\"",
-					"\"ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0\"",
-				);
-				HEADER_SEARCH_PATHS = (
-					.,
-					../include,
-				);
-				PRODUCT_NAME = translator_hlsl;
-			};
-			name = Debug;
-		};
-		FF01CDF4594E0FF9E581B319 /* Debug */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				EXECUTABLE_PREFIX = lib;
-				GCC_PREPROCESSOR_DEFINITIONS = (
-					"\"ANGLE_DISABLE_TRACE\"",
-					"\"ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0\"",
-				);
-				HEADER_SEARCH_PATHS = (
-					.,
-					../include,
-				);
-				PRODUCT_NAME = translator_common;
-			};
-			name = Debug;
-		};
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
-		0E59F8FE4A8099E8DDCA4CE7 /* Build configuration list for PBXProject "build_angle" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				9DC66E1FF9349CDCC8D52C46 /* Debug */,
-				C4546B14B0EB5EB8C5D39DC2 /* Release */,
-			);
-			defaultConfigurationIsVisible = 1;
-			defaultConfigurationName = Debug;
-		};
-		34BB38E3A74418B2A063B49E /* Build configuration list for PBXNativeTarget "translator_common" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				FF01CDF4594E0FF9E581B319 /* Debug */,
-				4DA42A78D3B855C9CD8F658D /* Release */,
-			);
-			defaultConfigurationIsVisible = 1;
-			defaultConfigurationName = Debug;
-		};
-		77CEFB7B40F05B0A804E6B2B /* Build configuration list for PBXAggregateTarget "All" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				322A8C62423B595E11BAD42D /* Debug */,
-				4F851F5BA5FA43E9E0B9CB86 /* Release */,
-			);
-			defaultConfigurationIsVisible = 1;
-			defaultConfigurationName = Debug;
-		};
-		8B8815CA2EFE60FD0C0361BF /* Build configuration list for PBXNativeTarget "translator_glsl" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				88ADC9285519A668808B51EE /* Debug */,
-				AF7C2CD10C6FEA076B141E6E /* Release */,
-			);
-			defaultConfigurationIsVisible = 1;
-			defaultConfigurationName = Debug;
-		};
-		A20107FC159C313C00E57BBE /* Build configuration list for PBXNativeTarget "preprocessor" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				A20107FD159C313C00E57BBE /* Debug */,
-				A20107FE159C313C00E57BBE /* Release */,
-			);
-			defaultConfigurationIsVisible = 1;
-			defaultConfigurationName = Debug;
-		};
-		C71E79C7829FD796CF621B44 /* Build configuration list for PBXNativeTarget "translator_hlsl" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				F029E0D369FAFEA46BDAFCEE /* Debug */,
-				B096FAF032DB19AB637D38F0 /* Release */,
-			);
-			defaultConfigurationIsVisible = 1;
-			defaultConfigurationName = Debug;
-		};
-/* End XCConfigurationList section */
-	};
-	rootObject = DA188D8C6BF8073122539131 /* Project object */;
-}
diff --git a/Source/ThirdParty/ANGLE/src/common/angleutils.h b/Source/ThirdParty/ANGLE/src/common/angleutils.h
index 7d9349a..ff9730c 100644
--- a/Source/ThirdParty/ANGLE/src/common/angleutils.h
+++ b/Source/ThirdParty/ANGLE/src/common/angleutils.h
@@ -19,4 +19,8 @@
 #define snprintf _snprintf
 #endif
 
+#define VENDOR_ID_AMD 0x1002
+#define VENDOR_ID_INTEL 0x8086
+#define VENDOR_ID_NVIDIA 0x10DE
+
 #endif // COMMON_ANGLEUTILS_H_
diff --git a/Source/ThirdParty/ANGLE/src/common/debug.cpp b/Source/ThirdParty/ANGLE/src/common/debug.cpp
index b2238f9..c45b2a1 100644
--- a/Source/ThirdParty/ANGLE/src/common/debug.cpp
+++ b/Source/ThirdParty/ANGLE/src/common/debug.cpp
@@ -84,6 +84,12 @@
 ScopedPerfEventHelper::ScopedPerfEventHelper(const char* format, ...)
 {
 #if !defined(ANGLE_DISABLE_PERF)
+#if defined(ANGLE_DISABLE_TRACE)
+    if (!perfActive())
+    {
+        return;
+    }
+#endif
     va_list vararg;
     va_start(vararg, format);
     output(true, reinterpret_cast<PerfOutputFunction>(D3DPERF_BeginEvent), format, vararg);
diff --git a/Source/ThirdParty/ANGLE/src/common/debug.h b/Source/ThirdParty/ANGLE/src/common/debug.h
index 9828ecf..5f8f60f 100644
--- a/Source/ThirdParty/ANGLE/src/common/debug.h
+++ b/Source/ThirdParty/ANGLE/src/common/debug.h
@@ -42,28 +42,30 @@
 #if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
 #define TRACE(message, ...) (void(0))
 #else
-#define TRACE(message, ...) gl::trace(true, "trace: %s(%d): "message"\n", __FUNCTION__, __LINE__, __VA_ARGS__)
+#define TRACE(message, ...) gl::trace(true, "trace: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
 #endif
 
 // A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing.
 #if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
 #define FIXME(message, ...) (void(0))
 #else
-#define FIXME(message, ...) gl::trace(false, "fixme: %s(%d): "message"\n", __FUNCTION__, __LINE__, __VA_ARGS__)
+#define FIXME(message, ...) gl::trace(false, "fixme: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
 #endif
 
 // A macro to output a function call and its arguments to the debugging log, in case of error.
 #if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
 #define ERR(message, ...) (void(0))
 #else
-#define ERR(message, ...) gl::trace(false, "err: %s(%d): "message"\n", __FUNCTION__, __LINE__, __VA_ARGS__)
+#define ERR(message, ...) gl::trace(false, "err: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
 #endif
 
 // A macro to log a performance event around a scope.
 #if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
 #define EVENT(message, ...) (void(0))
-#else
+#elif defined(_MSC_VER)
 #define EVENT(message, ...) gl::ScopedPerfEventHelper scopedPerfEventHelper ## __LINE__(__FUNCTION__ message "\n", __VA_ARGS__);
+#else
+#define EVENT(message, ...) gl::ScopedPerfEventHelper scopedPerfEventHelper(message "\n", ##__VA_ARGS__);
 #endif
 
 // A macro asserting a condition and outputting failures to the debug log
diff --git a/Source/ThirdParty/ANGLE/src/common/version.h b/Source/ThirdParty/ANGLE/src/common/version.h
index bdd1624..dbe8ce2 100644
--- a/Source/ThirdParty/ANGLE/src/common/version.h
+++ b/Source/ThirdParty/ANGLE/src/common/version.h
@@ -1,10 +1,12 @@
 #define MAJOR_VERSION 1
 #define MINOR_VERSION 0
 #define BUILD_VERSION 0
-#define BUILD_REVISION 1166
+#define BUILD_REVISION 1641
 
 #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)
+
+#define VERSION_DWORD ((MAJOR_VERSION << 24) | (MINOR_VERSION << 16) | BUILD_REVISION)
diff --git a/Source/ThirdParty/ANGLE/src/compiler/Compiler.cpp b/Source/ThirdParty/ANGLE/src/compiler/Compiler.cpp
index db5f7290..dce8c68 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/Compiler.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/Compiler.cpp
@@ -15,6 +15,7 @@
 #include "compiler/RenameFunction.h"
 #include "compiler/ShHandle.h"
 #include "compiler/ValidateLimitations.h"
+#include "compiler/VariablePacker.h"
 #include "compiler/depgraph/DependencyGraph.h"
 #include "compiler/depgraph/DependencyGraphOutput.h"
 #include "compiler/timing/RestrictFragmentShaderTiming.h"
@@ -114,6 +115,9 @@
 
 bool TCompiler::Init(const ShBuiltInResources& resources)
 {
+    maxUniformVectors = (shaderType == SH_VERTEX_SHADER) ?
+        resources.MaxVertexUniformVectors :
+        resources.MaxFragmentUniformVectors;
     TScopedPoolAllocator scopedAlloc(&allocator, false);
 
     // Generate built-in symbol table.
@@ -121,6 +125,8 @@
         return false;
     InitExtensionBehavior(resources, extensionBehavior);
 
+    hashFunction = resources.HashFunction;
+
     return true;
 }
 
@@ -194,11 +200,19 @@
         // Call mapLongVariableNames() before collectAttribsUniforms() so in
         // collectAttribsUniforms() we already have the mapped symbol names and
         // we could composite mapped and original variable names.
-        if (success && (compileOptions & SH_MAP_LONG_VARIABLE_NAMES))
+        // Also, if we hash all the names, then no need to do this for long names.
+        if (success && (compileOptions & SH_MAP_LONG_VARIABLE_NAMES) && hashFunction == NULL)
             mapLongVariableNames(root);
 
-        if (success && (compileOptions & SH_ATTRIBUTES_UNIFORMS))
+        if (success && (compileOptions & SH_ATTRIBUTES_UNIFORMS)) {
             collectAttribsUniforms(root);
+            if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS) {
+                success = enforcePackingRestrictions();
+                if (!success) {
+                    infoSink.info.message(EPrefixError, "too many uniforms");
+                }
+            }
+        }
 
         if (success && (compileOptions & SH_INTERMEDIATE_TREE))
             intermediate.outputTree(root);
@@ -228,6 +242,7 @@
 
 void TCompiler::clearResults()
 {
+    arrayBoundsClamper.Cleanup();
     infoSink.info.erase();
     infoSink.obj.erase();
     infoSink.debug.erase();
@@ -236,7 +251,8 @@
     uniforms.clear();
 
     builtInFunctionEmulator.Cleanup();
-    arrayBoundsClamper.Cleanup();
+
+    nameMap.clear();
 }
 
 bool TCompiler::detectRecursion(TIntermNode* root)
@@ -312,10 +328,16 @@
 
 void TCompiler::collectAttribsUniforms(TIntermNode* root)
 {
-    CollectAttribsUniforms collect(attribs, uniforms);
+    CollectAttribsUniforms collect(attribs, uniforms, hashFunction);
     root->traverse(&collect);
 }
 
+bool TCompiler::enforcePackingRestrictions()
+{
+    VariablePacker packer;
+    return packer.CheckVariablesWithinPackingLimits(maxUniformVectors, uniforms);
+}
+
 void TCompiler::mapLongVariableNames(TIntermNode* root)
 {
     ASSERT(longNameMap);
diff --git a/Source/ThirdParty/ANGLE/src/compiler/Diagnostics.cpp b/Source/ThirdParty/ANGLE/src/compiler/Diagnostics.cpp
index 5f93a034..06f370d 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/Diagnostics.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/Diagnostics.cpp
@@ -6,10 +6,14 @@
 
 #include "compiler/Diagnostics.h"
 
+#include "compiler/debug.h"
 #include "compiler/InfoSink.h"
-#include "compiler/preprocessor/new/SourceLocation.h"
+#include "compiler/preprocessor/SourceLocation.h"
 
-TDiagnostics::TDiagnostics(TInfoSink& infoSink) : mInfoSink(infoSink)
+TDiagnostics::TDiagnostics(TInfoSink& infoSink) :
+    mInfoSink(infoSink),
+    mNumErrors(0),
+    mNumWarnings(0)
 {
 }
 
@@ -23,9 +27,23 @@
                              const std::string& token,
                              const std::string& extra)
 {
-    TInfoSinkBase& sink = mInfoSink.info;
-    TPrefixType prefix = severity == ERROR ? EPrefixError : EPrefixWarning;
+    TPrefixType prefix = EPrefixNone;
+    switch (severity)
+    {
+      case ERROR:
+        ++mNumErrors;
+        prefix = EPrefixError;
+        break;
+      case WARNING:
+        ++mNumWarnings;
+        prefix = EPrefixWarning;
+        break;
+      default:
+        UNREACHABLE();
+        break;
+    }
 
+    TInfoSinkBase& sink = mInfoSink.info;
     /* VC++ format: file(linenum) : error #: 'token' : extrainfo */
     sink.prefix(prefix);
     sink.location(EncodeSourceLoc(loc.file, loc.line));
@@ -41,4 +59,5 @@
                          const pp::SourceLocation& loc,
                          const std::string& text)
 {
+    writeInfo(severity(id), loc, message(id), text, "");
 }
diff --git a/Source/ThirdParty/ANGLE/src/compiler/Diagnostics.h b/Source/ThirdParty/ANGLE/src/compiler/Diagnostics.h
index 43a1306..cb71bb1 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/Diagnostics.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/Diagnostics.h
@@ -7,7 +7,7 @@
 #ifndef COMPILER_DIAGNOSTICS_H_
 #define COMPILER_DIAGNOSTICS_H_
 
-#include "compiler/preprocessor/new/Diagnostics.h"
+#include "compiler/preprocessor/DiagnosticsBase.h"
 
 class TInfoSink;
 
@@ -19,6 +19,9 @@
 
     TInfoSink& infoSink() { return mInfoSink; }
 
+    int numErrors() const { return mNumErrors; }
+    int numWarnings() const { return mNumWarnings; }
+
     void writeInfo(Severity severity,
                    const pp::SourceLocation& loc,
                    const std::string& reason,
@@ -34,6 +37,8 @@
 
   private:
     TInfoSink& mInfoSink;
+    int mNumErrors;
+    int mNumWarnings;
 };
 
 #endif  // COMPILER_DIAGNOSTICS_H_
diff --git a/Source/ThirdParty/ANGLE/src/compiler/DirectiveHandler.h b/Source/ThirdParty/ANGLE/src/compiler/DirectiveHandler.h
index 21d3dfc..95ca59d 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/DirectiveHandler.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/DirectiveHandler.h
@@ -9,7 +9,7 @@
 
 #include "compiler/ExtensionBehavior.h"
 #include "compiler/Pragma.h"
-#include "compiler/preprocessor/new/DirectiveHandler.h"
+#include "compiler/preprocessor/DirectiveHandlerBase.h"
 
 class TDiagnostics;
 
diff --git a/Source/ThirdParty/ANGLE/src/compiler/HashNames.h b/Source/ThirdParty/ANGLE/src/compiler/HashNames.h
new file mode 100644
index 0000000..d2141e2
--- /dev/null
+++ b/Source/ThirdParty/ANGLE/src/compiler/HashNames.h
@@ -0,0 +1,19 @@
+//
+// 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_HASH_NAMES_H_
+#define COMPILER_HASH_NAMES_H_
+
+#include <map>
+
+#include "compiler/intermediate.h"
+#include "GLSLANG/ShaderLang.h"
+
+#define HASHED_NAME_PREFIX "webgl_"
+
+typedef std::map<TPersistString, TPersistString> NameMap;
+
+#endif  // COMPILER_HASH_NAMES_H_
diff --git a/Source/ThirdParty/ANGLE/src/compiler/Intermediate.cpp b/Source/ThirdParty/ANGLE/src/compiler/Intermediate.cpp
index 92c4505..9032b3a 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/Intermediate.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/Intermediate.cpp
@@ -12,6 +12,7 @@
 #include <limits.h>
 #include <algorithm>
 
+#include "compiler/HashNames.h"
 #include "compiler/localintermediate.h"
 #include "compiler/QualifierAlive.h"
 #include "compiler/RemoveTree.h"
@@ -1445,3 +1446,14 @@
     return addConstantUnion(leftUnionArray, TType(promoteTo, t.getPrecision(), t.getQualifier(), t.getNominalSize(), t.isMatrix(), t.isArray()), node->getLine());
 }
 
+// static
+TString TIntermTraverser::hash(const TString& name, ShHashFunction64 hashFunction)
+{
+    if (hashFunction == NULL || name.empty())
+        return name;
+    khronos_uint64_t number = (*hashFunction)(name.c_str(), name.length());
+    TStringStream stream;
+    stream << HASHED_NAME_PREFIX << std::hex << number;
+    TString hashedName = stream.str();
+    return hashedName;
+}
diff --git a/Source/ThirdParty/ANGLE/src/compiler/OutputESSL.cpp b/Source/ThirdParty/ANGLE/src/compiler/OutputESSL.cpp
index 64ee92d..0331752 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/OutputESSL.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/OutputESSL.cpp
@@ -6,8 +6,11 @@
 
 #include "compiler/OutputESSL.h"
 
-TOutputESSL::TOutputESSL(TInfoSinkBase& objSink)
-    : TOutputGLSLBase(objSink)
+TOutputESSL::TOutputESSL(TInfoSinkBase& objSink,
+                         ShHashFunction64 hashFunction,
+                         NameMap& nameMap,
+                         TSymbolTable& symbolTable)
+    : TOutputGLSLBase(objSink, hashFunction, nameMap, symbolTable)
 {
 }
 
diff --git a/Source/ThirdParty/ANGLE/src/compiler/OutputESSL.h b/Source/ThirdParty/ANGLE/src/compiler/OutputESSL.h
index 4fa73c8..dd8c5ab 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/OutputESSL.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/OutputESSL.h
@@ -12,7 +12,10 @@
 class TOutputESSL : public TOutputGLSLBase
 {
 public:
-    TOutputESSL(TInfoSinkBase& objSink);
+    TOutputESSL(TInfoSinkBase& objSink,
+                ShHashFunction64 hashFunction,
+                NameMap& nameMap,
+                TSymbolTable& symbolTable);
 
 protected:
     virtual bool writeVariablePrecision(TPrecision precision);
diff --git a/Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.cpp b/Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.cpp
index dd31b4b..5873042 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.cpp
@@ -6,8 +6,11 @@
 
 #include "compiler/OutputGLSL.h"
 
-TOutputGLSL::TOutputGLSL(TInfoSinkBase& objSink)
-    : TOutputGLSLBase(objSink)
+TOutputGLSL::TOutputGLSL(TInfoSinkBase& objSink,
+                         ShHashFunction64 hashFunction,
+                         NameMap& nameMap,
+                         TSymbolTable& symbolTable)
+    : TOutputGLSLBase(objSink, hashFunction, nameMap, symbolTable)
 {
 }
 
diff --git a/Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.h b/Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.h
index 0fe2356..9030212 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/OutputGLSL.h
@@ -12,7 +12,10 @@
 class TOutputGLSL : public TOutputGLSLBase
 {
 public:
-    TOutputGLSL(TInfoSinkBase& objSink);
+    TOutputGLSL(TInfoSinkBase& objSink,
+                ShHashFunction64 hashFunction,
+                NameMap& nameMap,
+                TSymbolTable& symbolTable);
 
 protected:
     virtual bool writeVariablePrecision(TPrecision);
diff --git a/Source/ThirdParty/ANGLE/src/compiler/OutputGLSLBase.cpp b/Source/ThirdParty/ANGLE/src/compiler/OutputGLSLBase.cpp
index 2100eaa..3c3c9de 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/OutputGLSLBase.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/OutputGLSLBase.cpp
@@ -9,35 +9,6 @@
 
 namespace
 {
-TString getTypeName(const TType& type)
-{
-    TInfoSinkBase out;
-    if (type.isMatrix())
-    {
-        out << "mat";
-        out << type.getNominalSize();
-    }
-    else if (type.isVector())
-    {
-        switch (type.getBasicType())
-        {
-            case EbtFloat: out << "vec"; break;
-            case EbtInt: out << "ivec"; break;
-            case EbtBool: out << "bvec"; break;
-            default: UNREACHABLE(); break;
-        }
-        out << type.getNominalSize();
-    }
-    else
-    {
-        if (type.getBasicType() == EbtStruct)
-            out << type.getTypeName();
-        else
-            out << type.getBasicString();
-    }
-    return TString(out.c_str());
-}
-
 TString arrayBrackets(const TType& type)
 {
     ASSERT(type.isArray());
@@ -66,10 +37,16 @@
 }
 }  // namespace
 
-TOutputGLSLBase::TOutputGLSLBase(TInfoSinkBase& objSink)
+TOutputGLSLBase::TOutputGLSLBase(TInfoSinkBase& objSink,
+                                 ShHashFunction64 hashFunction,
+                                 NameMap& nameMap,
+                                 TSymbolTable& symbolTable)
     : TIntermTraverser(true, true, true),
       mObjSink(objSink),
-      mDeclaringVariables(false)
+      mDeclaringVariables(false),
+      mHashFunction(hashFunction),
+      mNameMap(nameMap),
+      mSymbolTable(symbolTable)
 {
 }
 
@@ -101,7 +78,7 @@
     if ((type.getBasicType() == EbtStruct) &&
         (mDeclaredStructs.find(type.getTypeName()) == mDeclaredStructs.end()))
     {
-        out << "struct " << type.getTypeName() << "{\n";
+        out << "struct " << hashName(type.getTypeName()) << "{\n";
         const TTypeList* structure = type.getStruct();
         ASSERT(structure != NULL);
         for (size_t i = 0; i < structure->size(); ++i)
@@ -110,7 +87,7 @@
             ASSERT(fieldType != NULL);
             if (writeVariablePrecision(fieldType->getPrecision()))
                 out << " ";
-            out << getTypeName(*fieldType) << " " << fieldType->getFieldName();
+            out << getTypeName(*fieldType) << " " << hashName(fieldType->getFieldName());
             if (fieldType->isArray())
                 out << arrayBrackets(*fieldType);
             out << ";\n";
@@ -140,7 +117,7 @@
 
         const TString& name = arg->getSymbol();
         if (!name.empty())
-            out << " " << name;
+            out << " " << hashName(name);
         if (type.isArray())
             out << arrayBrackets(type);
 
@@ -157,7 +134,7 @@
 
     if (type.getBasicType() == EbtStruct)
     {
-        out << type.getTypeName() << "(";
+        out << hashName(type.getTypeName()) << "(";
         const TTypeList* structure = type.getStruct();
         ASSERT(structure != NULL);
         for (size_t i = 0; i < structure->size(); ++i)
@@ -196,7 +173,7 @@
     if (mLoopUnroll.NeedsToReplaceSymbolWithValue(node))
         out << mLoopUnroll.GetLoopIndexValue(node);
     else
-        out << node->getSymbol();
+        out << hashVariableName(node->getSymbol());
 
     if (mDeclaringVariables && node->getType().isArray())
         out << arrayBrackets(node->getType());
@@ -272,7 +249,7 @@
             {
                 out << ".";
                 // TODO(alokp): ASSERT
-                out << node->getType().getFieldName();
+                out << hashName(node->getType().getFieldName());
                 visitChildren = false;
             }
             break;
@@ -496,7 +473,7 @@
             // Function declaration.
             ASSERT(visit == PreVisit);
             writeVariableType(node->getType());
-            out << " " << node->getName();
+            out << " " << hashName(node->getName());
 
             out << "(";
             writeFunctionParameters(node->getSequence());
@@ -509,7 +486,7 @@
             // Function definition.
             ASSERT(visit == PreVisit);
             writeVariableType(node->getType());
-            out << " " << TFunction::unmangleName(node->getName());
+            out << " " << hashFunctionName(node->getName());
 
             incrementDepth();
             // Function definition node contains one or two children nodes
@@ -539,8 +516,7 @@
             // Function call.
             if (visit == PreVisit)
             {
-                TString functionName = TFunction::unmangleName(node->getName());
-                out << functionName << "(";
+                out << hashFunctionName(node->getName()) << "(";
             }
             else if (visit == InVisit)
             {
@@ -601,7 +577,7 @@
             {
                 const TType& type = node->getType();
                 ASSERT(type.getBasicType() == EbtStruct);
-                out << type.getTypeName() << "(";
+                out << hashName(type.getTypeName()) << "(";
             }
             else if (visit == InVisit)
             {
@@ -747,3 +723,59 @@
         out << "{\n}\n";  // Empty code block.
     }
 }
+
+TString TOutputGLSLBase::getTypeName(const TType& type)
+{
+    TInfoSinkBase out;
+    if (type.isMatrix())
+    {
+        out << "mat";
+        out << type.getNominalSize();
+    }
+    else if (type.isVector())
+    {
+        switch (type.getBasicType())
+        {
+            case EbtFloat: out << "vec"; break;
+            case EbtInt: out << "ivec"; break;
+            case EbtBool: out << "bvec"; break;
+            default: UNREACHABLE(); break;
+        }
+        out << type.getNominalSize();
+    }
+    else
+    {
+        if (type.getBasicType() == EbtStruct)
+            out << hashName(type.getTypeName());
+        else
+            out << type.getBasicString();
+    }
+    return TString(out.c_str());
+}
+
+TString TOutputGLSLBase::hashName(const TString& name)
+{
+    if (mHashFunction == NULL || name.empty())
+        return name;
+    NameMap::const_iterator it = mNameMap.find(name.c_str());
+    if (it != mNameMap.end())
+        return it->second.c_str();
+    TString hashedName = TIntermTraverser::hash(name, mHashFunction);
+    mNameMap[name.c_str()] = hashedName.c_str();
+    return hashedName;
+}
+
+TString TOutputGLSLBase::hashVariableName(const TString& name)
+{
+    if (mSymbolTable.findBuiltIn(name) != NULL)
+        return name;
+    return hashName(name);
+}
+
+TString TOutputGLSLBase::hashFunctionName(const TString& mangled_name)
+{
+    TString name = TFunction::unmangleName(mangled_name);
+    if (mSymbolTable.findBuiltIn(mangled_name) != NULL || name == "main")
+        return name;
+    return hashName(name);
+}
diff --git a/Source/ThirdParty/ANGLE/src/compiler/OutputGLSLBase.h b/Source/ThirdParty/ANGLE/src/compiler/OutputGLSLBase.h
index efd0b5f..01e9d4a 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/OutputGLSLBase.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/OutputGLSLBase.h
@@ -16,7 +16,10 @@
 class TOutputGLSLBase : public TIntermTraverser
 {
 public:
-    TOutputGLSLBase(TInfoSinkBase& objSink);
+    TOutputGLSLBase(TInfoSinkBase& objSink,
+                    ShHashFunction64 hashFunction,
+                    NameMap& nameMap,
+                    TSymbolTable& symbolTable);
 
 protected:
     TInfoSinkBase& objSink() { return mObjSink; }
@@ -25,6 +28,7 @@
     virtual bool writeVariablePrecision(TPrecision precision) = 0;
     void writeFunctionParameters(const TIntermSequence& args);
     const ConstantUnion* writeConstantUnion(const TType& type, const ConstantUnion* pConstUnion);
+    TString getTypeName(const TType& type);
 
     virtual void visitSymbol(TIntermSymbol* node);
     virtual void visitConstantUnion(TIntermConstantUnion* node);
@@ -37,6 +41,15 @@
 
     void visitCodeBlock(TIntermNode* node);
 
+
+    // Return the original name if hash function pointer is NULL;
+    // otherwise return the hashed name.
+    TString hashName(const TString& name);
+    // Same as hashName(), but without hashing built-in variables.
+    TString hashVariableName(const TString& name);
+    // Same as hashName(), but without hashing built-in functions.
+    TString hashFunctionName(const TString& mangled_name);
+
 private:
     TInfoSinkBase& mObjSink;
     bool mDeclaringVariables;
@@ -48,6 +61,12 @@
     DeclaredStructs mDeclaredStructs;
 
     ForLoopUnroll mLoopUnroll;
+
+    // name hashing.
+    ShHashFunction64 mHashFunction;
+    NameMap& mNameMap;
+
+    TSymbolTable& mSymbolTable;
 };
 
 #endif  // CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
diff --git a/Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.cpp b/Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.cpp
index d7e69d3..a430695 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.cpp
@@ -87,6 +87,8 @@
     mContainsLoopDiscontinuity = false;
     mOutputLod0Function = false;
     mInsideDiscontinuousLoop = false;
+
+    mExcessiveLoopIndex = NULL;
 }
 
 OutputHLSL::~OutputHLSL()
@@ -420,26 +422,12 @@
                "\n";
         out <<  uniforms;
         out << "\n";
-
-        // The texture fetch functions "flip" the Y coordinate in one way or another. This is because textures are stored
-        // according to the OpenGL convention, i.e. (0, 0) is "bottom left", rather than the D3D convention where (0, 0)
-        // is "top left". Since the HLSL texture fetch functions expect textures to be stored according to the D3D
-        // convention, the Y coordinate passed to these functions is adjusted to compensate.
-        //
-        // The simplest case is texture2D where the mapping is Y -> 1-Y, which maps [0, 1] -> [1, 0].
-        //
-        // The texture2DProj functions are more complicated because the projection divides by either Z or W. For the vec3
-        // case, the mapping is Y -> Z-Y or Y/Z -> 1-Y/Z, which again maps [0, 1] -> [1, 0].
-        //
-        // For cube textures the mapping is Y -> -Y, which maps [-1, 1] -> [1, -1]. This is not sufficient on its own for the
-        // +Y and -Y faces, which are now on the "wrong sides" of the cube. This is compensated for by exchanging the
-        // +Y and -Y faces everywhere else throughout the code.
         
         if (mUsesTexture2D)
         {
             out << "float4 gl_texture2D(sampler2D s, float2 t)\n"
                    "{\n"
-                   "    return tex2Dlod(s, float4(t.x, 1 - t.y, 0, 0));\n"
+                   "    return tex2Dlod(s, float4(t.x, t.y, 0, 0));\n"
                    "}\n"
                    "\n";
         }
@@ -448,7 +436,7 @@
         {
             out << "float4 gl_texture2DLod(sampler2D s, float2 t, float lod)\n"
                    "{\n"
-                   "    return tex2Dlod(s, float4(t.x, 1 - t.y, 0, lod));\n"
+                   "    return tex2Dlod(s, float4(t.x, t.y, 0, lod));\n"
                    "}\n"
                    "\n";
         }
@@ -457,12 +445,12 @@
         {
             out << "float4 gl_texture2DProj(sampler2D s, float3 t)\n"
                    "{\n"
-                   "    return tex2Dlod(s, float4(t.x / t.z, 1 - t.y / t.z, 0, 0));\n"
+                   "    return tex2Dlod(s, float4(t.x / t.z, t.y / t.z, 0, 0));\n"
                    "}\n"
                    "\n"
                    "float4 gl_texture2DProj(sampler2D s, float4 t)\n"
                    "{\n"
-                   "    return tex2Dlod(s, float4(t.x / t.w, 1 - t.y / t.w, 0, 0));\n"
+                   "    return tex2Dlod(s, float4(t.x / t.w, t.y / t.w, 0, 0));\n"
                    "}\n"
                    "\n";
         }
@@ -471,12 +459,12 @@
         {
             out << "float4 gl_texture2DProjLod(sampler2D s, float3 t, float lod)\n"
                    "{\n"
-                   "    return tex2Dlod(s, float4(t.x / t.z, 1 - t.y / t.z, 0, lod));\n"
+                   "    return tex2Dlod(s, float4(t.x / t.z, t.y / t.z, 0, lod));\n"
                    "}\n"
                    "\n"
                    "float4 gl_texture2DProjLod(sampler2D s, float4 t, float lod)\n"
                    "{\n"
-                   "    return tex2Dlod(s, float4(t.x / t.w, 1 - t.y / t.w, 0, lod));\n"
+                   "    return tex2Dlod(s, float4(t.x / t.w, t.y / t.w, 0, lod));\n"
                    "}\n"
                    "\n";
         }
@@ -485,7 +473,7 @@
         {
             out << "float4 gl_textureCube(samplerCUBE s, float3 t)\n"
                    "{\n"
-                   "    return texCUBElod(s, float4(t.x, -t.y, t.z, 0));\n"
+                   "    return texCUBElod(s, float4(t.x, t.y, t.z, 0));\n"
                    "}\n"
                    "\n";
         }
@@ -494,7 +482,7 @@
         {
             out << "float4 gl_textureCubeLod(samplerCUBE s, float3 t, float lod)\n"
                    "{\n"
-                   "    return texCUBElod(s, float4(t.x, -t.y, t.z, lod));\n"
+                   "    return texCUBElod(s, float4(t.x, t.y, t.z, lod));\n"
                    "}\n"
                    "\n";
         }
@@ -1352,7 +1340,7 @@
       case EOpPrototype:
         if (visit == PreVisit)
         {
-            out << typeString(node->getType()) << " " << decorate(node->getName()) << "(";
+            out << typeString(node->getType()) << " " << decorate(node->getName()) << (mOutputLod0Function ? "Lod0(" : "(");
 
             TIntermSequence &arguments = node->getSequence();
 
@@ -1374,6 +1362,14 @@
 
             out << ");\n";
 
+            // Also prototype the Lod0 variant if needed
+            if (mContainsLoopDiscontinuity && !mOutputLod0Function)
+            {
+                mOutputLod0Function = true;
+                node->traverse(this);
+                mOutputLod0Function = false;
+            }
+
             return false;
         }
         break;
@@ -1862,7 +1858,21 @@
     switch (node->getFlowOp())
     {
       case EOpKill:     outputTriplet(visit, "discard;\n", "", "");  break;
-      case EOpBreak:    outputTriplet(visit, "break;\n", "", "");    break;
+      case EOpBreak:
+        if (visit == PreVisit)
+        {
+            if (mExcessiveLoopIndex)
+            {
+                out << "{Break";
+                mExcessiveLoopIndex->traverse(this);
+                out << " = true; break;}\n";
+            }
+            else
+            {
+                out << "break;\n";
+            }
+        }
+        break;
       case EOpContinue: outputTriplet(visit, "continue;\n", "", ""); break;
       case EOpReturn:
         if (visit == PreVisit)
@@ -2052,13 +2062,37 @@
                 return false;   // Not an excessive loop
             }
 
+            TIntermSymbol *restoreIndex = mExcessiveLoopIndex;
+            mExcessiveLoopIndex = index;
+
+            out << "{int ";
+            index->traverse(this);
+            out << ";\n"
+                   "bool Break";
+            index->traverse(this);
+            out << " = false;\n";
+
+            bool firstLoopFragment = true;
+
             while (iterations > 0)
             {
                 int clampedLimit = initial + increment * std::min(MAX_LOOP_ITERATIONS, iterations);
 
+                if (!firstLoopFragment)
+                {
+                    out << "if(!Break";
+                    index->traverse(this);
+                    out << ") {\n";
+                }
+
+                if (iterations <= MAX_LOOP_ITERATIONS)   // Last loop fragment
+                {
+                    mExcessiveLoopIndex = NULL;   // Stops setting the Break flag
+                }
+                
                 // for(int index = initial; index < clampedLimit; index += increment)
 
-                out << "for(int ";
+                out << "for(";
                 index->traverse(this);
                 out << " = ";
                 out << initial;
@@ -2085,9 +2119,20 @@
                 outputLineDirective(node->getLine());
                 out << ";}\n";
 
+                if (!firstLoopFragment)
+                {
+                    out << "}\n";
+                }
+
+                firstLoopFragment = false;
+
                 initial += MAX_LOOP_ITERATIONS * increment;
                 iterations -= MAX_LOOP_ITERATIONS;
             }
+            
+            out << "}";
+
+            mExcessiveLoopIndex = restoreIndex;
 
             return true;
         }
diff --git a/Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.h b/Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.h
index ea28a3c..dc843fb 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/OutputHLSL.h
@@ -144,6 +144,8 @@
     bool mContainsLoopDiscontinuity;
     bool mOutputLod0Function;
     bool mInsideDiscontinuousLoop;
+
+    TIntermSymbol *mExcessiveLoopIndex;
 };
 }
 
diff --git a/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.cpp b/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.cpp
index b311526..7e5fcec 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.cpp
@@ -10,7 +10,7 @@
 #include <stdio.h>
 
 #include "compiler/glslang.h"
-#include "compiler/preprocessor/new/SourceLocation.h"
+#include "compiler/preprocessor/SourceLocation.h"
 
 ///////////////////////////////////////////////////////////////////////
 //
@@ -184,7 +184,6 @@
     diagnostics.writeInfo(pp::Diagnostics::ERROR,
                           srcLoc, reason, token, extraInfo);
 
-    ++numErrors;
 }
 
 void TParseContext::warning(TSourceLoc loc,
@@ -847,14 +846,26 @@
 //
 // Returns true if there was an error.
 //
-bool TParseContext::nonInitConstErrorCheck(int line, TString& identifier, TPublicType& type)
+bool TParseContext::nonInitConstErrorCheck(int line, TString& identifier, TPublicType& type, bool array)
 {
-    //
-    // Make the qualifier make sense.
-    //
-    if (type.qualifier == EvqConst) {
+    if (type.qualifier == EvqConst)
+    {
+        // Make the qualifier make sense.
         type.qualifier = EvqTemporary;
-        error(line, "variables with qualifier 'const' must be initialized", identifier.c_str());
+        
+        if (array)
+        {
+            error(line, "arrays may not be declared constant since they cannot be initialized", identifier.c_str());
+        }
+        else if (type.isStructureContainingArrays())
+        {
+            error(line, "structures containing arrays may not be declared constant since they cannot be initialized", identifier.c_str());
+        }
+        else
+        {
+            error(line, "variables with qualifier 'const' must be initialized", identifier.c_str());
+        }
+
         return true;
     }
 
@@ -1510,7 +1521,7 @@
 
     glslang_finalize(context);
 
-    return (error == 0) && (context->numErrors == 0) ? 0 : 1;
+    return (error == 0) && (context->numErrors() == 0) ? 0 : 1;
 }
 
 
diff --git a/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.h b/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.h
index 8dee8fd..668e52a 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.h
@@ -1,5 +1,5 @@
 //
-// 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.
 //
@@ -9,7 +9,7 @@
 #include "compiler/Diagnostics.h"
 #include "compiler/DirectiveHandler.h"
 #include "compiler/localintermediate.h"
-#include "compiler/preprocessor/new/Preprocessor.h"
+#include "compiler/preprocessor/Preprocessor.h"
 #include "compiler/ShHandle.h"
 #include "compiler/SymbolTable.h"
 
@@ -33,7 +33,6 @@
             compileOptions(options),
             sourcePath(sourcePath),
             treeRoot(0),
-            numErrors(0),
             lexAfterType(false),
             loopNestingLevel(0),
             structNestingLevel(0),
@@ -52,7 +51,6 @@
     int compileOptions;
     const char* sourcePath;      // Path of source file or NULL.
     TIntermNode* treeRoot;       // root of parse tree being created
-    int numErrors;
     bool lexAfterType;           // true if we've recognized a type, so can only be looking for an identifier
     int loopNestingLevel;        // 0 if outside all loops
     int structNestingLevel;      // incremented while parsing a struct declaration
@@ -67,6 +65,7 @@
     pp::Preprocessor preprocessor;
     void* scanner;
 
+    int numErrors() const { return diagnostics.numErrors(); }
     TInfoSink& infoSink() { return diagnostics.infoSink(); }
     void error(TSourceLoc loc, const char *reason, const char* token,
                const char* extraInfo="");
@@ -98,7 +97,7 @@
     bool samplerErrorCheck(int line, const TPublicType& pType, const char* reason);
     bool structQualifierErrorCheck(int line, const TPublicType& pType);
     bool parameterSamplerErrorCheck(int line, TQualifier qualifier, const TType& type);
-    bool nonInitConstErrorCheck(int line, TString& identifier, TPublicType& type);
+    bool nonInitConstErrorCheck(int line, TString& identifier, TPublicType& type, bool array);
     bool nonInitErrorCheck(int line, TString& identifier, TPublicType& type, TVariable*& variable);
     bool paramErrorCheck(int line, TQualifier qualifier, TQualifier paramQualifier, TType* type);
     bool extensionErrorCheck(int line, const TString&);
diff --git a/Source/ThirdParty/ANGLE/src/compiler/RenameFunction.h b/Source/ThirdParty/ANGLE/src/compiler/RenameFunction.h
index 9cd6e5e..3908bfd 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/RenameFunction.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/RenameFunction.h
@@ -20,7 +20,7 @@
     , mOldFunctionName(oldFunctionName)
     , mNewFunctionName(newFunctionName) {}
 
-    virtual bool visitAggregate(Visit, TIntermAggregate* node)
+    virtual bool visitAggregate(Visit visit, TIntermAggregate* node)
     {
         TOperator op = node->getOp();
         if ((op == EOpFunction || op == EOpFunctionCall) && node->getName() == mOldFunctionName)
diff --git a/Source/ThirdParty/ANGLE/src/compiler/ShHandle.h b/Source/ThirdParty/ANGLE/src/compiler/ShHandle.h
index 3eaf19f..a2c5ffd 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/ShHandle.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/ShHandle.h
@@ -19,6 +19,7 @@
 #include "compiler/ArrayBoundsClamper.h"
 #include "compiler/BuiltInFunctionEmulator.h"
 #include "compiler/ExtensionBehavior.h"
+#include "compiler/HashNames.h"
 #include "compiler/InfoSink.h"
 #include "compiler/SymbolTable.h"
 #include "compiler/VariableInfo.h"
@@ -69,6 +70,10 @@
     const TVariableInfoList& getUniforms() const { return uniforms; }
     int getMappedNameMaxLength() const;
 
+    ShHashFunction64 getHashFunction() const { return hashFunction; }
+    NameMap& getNameMap() { return nameMap; }
+    TSymbolTable& getSymbolTable() { return symbolTable; }
+
 protected:
     ShShaderType getShaderType() const { return shaderType; }
     ShShaderSpec getShaderSpec() const { return shaderSpec; }
@@ -89,6 +94,9 @@
     void mapLongVariableNames(TIntermNode* root);
     // Translate to object code.
     virtual void translate(TIntermNode* root) = 0;
+    // Returns true if, after applying the packing rules in the GLSL 1.017 spec
+    // Appendix A, section 7, the shader does not use too many uniforms.
+    bool enforcePackingRestrictions();
     // Returns true if the shader passes the restrictions that aim to prevent timing attacks.
     bool enforceTimingRestrictions(TIntermNode* root, bool outputGraph);
     // Returns true if the shader does not use samplers.
@@ -106,6 +114,8 @@
     ShShaderType shaderType;
     ShShaderSpec shaderSpec;
 
+    int maxUniformVectors;
+
     // Built-in symbol table for the given language, spec, and resources.
     // It is preserved from compile-to-compile.
     TSymbolTable symbolTable;
@@ -122,6 +132,10 @@
 
     // Cached copy of the ref-counted singleton.
     LongNameMap* longNameMap;
+
+    // name hashing.
+    ShHashFunction64 hashFunction;
+    NameMap nameMap;
 };
 
 //
diff --git a/Source/ThirdParty/ANGLE/src/compiler/ShaderLang.cpp b/Source/ThirdParty/ANGLE/src/compiler/ShaderLang.cpp
index 56f5c7f..ab56538 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/ShaderLang.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/ShaderLang.cpp
@@ -125,6 +125,9 @@
     resources->OES_standard_derivatives = 0;
     resources->OES_EGL_image_external = 0;
     resources->ARB_texture_rectangle = 0;
+
+    // Disable name hashing by default.
+    resources->HashFunction = NULL;
 }
 
 //
@@ -224,6 +227,22 @@
         // handle array and struct dereferences.
         *params = 1 + MAX_SYMBOL_NAME_LEN;
         break;
+    case SH_NAME_MAX_LENGTH:
+        *params = 1 + MAX_SYMBOL_NAME_LEN;
+        break;
+    case SH_HASHED_NAME_MAX_LENGTH:
+        if (compiler->getHashFunction() == NULL) {
+            *params = 0;
+        } else {
+            // 64 bits hashing output requires 16 bytes for hex 
+            // representation.
+            const char HashedNamePrefix[] = HASHED_NAME_PREFIX;
+            *params = 16 + sizeof(HashedNamePrefix);
+        }
+        break;
+    case SH_HASHED_NAMES_COUNT:
+        *params = compiler->getNameMap().size();
+        break;
     default: UNREACHABLE();
     }
 }
@@ -283,3 +302,46 @@
     getVariableInfo(SH_ACTIVE_UNIFORMS,
                     handle, index, length, size, type, name, mappedName);
 }
+
+void ShGetNameHashingEntry(const ShHandle handle,
+                           int index,
+                           char* name,
+                           char* hashedName)
+{
+    if (!handle || !name || !hashedName || index < 0)
+        return;
+
+    TShHandleBase* base = static_cast<TShHandleBase*>(handle);
+    TCompiler* compiler = base->getAsCompiler();
+    if (!compiler) return;
+
+    const NameMap& nameMap = compiler->getNameMap();
+    if (index >= static_cast<int>(nameMap.size()))
+        return;
+
+    NameMap::const_iterator it = nameMap.begin();
+    for (int i = 0; i < index; ++i)
+        ++it;
+
+    size_t len = it->first.length() + 1;
+    int max_len = 0;
+    ShGetInfo(handle, SH_NAME_MAX_LENGTH, &max_len);
+    if (static_cast<int>(len) > max_len) {
+        ASSERT(false);
+        len = max_len;
+    }
+    strncpy(name, it->first.c_str(), len);
+    // To be on the safe side in case the source is longer than expected.
+    name[len] = '\0';
+
+    len = it->second.length() + 1;
+    max_len = 0;
+    ShGetInfo(handle, SH_HASHED_NAME_MAX_LENGTH, &max_len);
+    if (static_cast<int>(len) > max_len) {
+        ASSERT(false);
+        len = max_len;
+    }
+    strncpy(hashedName, it->second.c_str(), len);
+    // To be on the safe side in case the source is longer than expected.
+    hashedName[len] = '\0';
+}
diff --git a/Source/ThirdParty/ANGLE/src/compiler/SymbolTable.cpp b/Source/ThirdParty/ANGLE/src/compiler/SymbolTable.cpp
index 68f029d..847c1e4 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/SymbolTable.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/SymbolTable.cpp
@@ -1,5 +1,5 @@
 //
-// 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.
 //
@@ -20,9 +20,16 @@
 
 #include "common/angleutils.h"
 
-//
-// TType helper function needs a place to live.
-//
+TType::TType(const TPublicType &p) :
+            type(p.type), precision(p.precision), qualifier(p.qualifier), size(p.size), matrix(p.matrix), array(p.array), arraySize(p.arraySize),
+            maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0), typeName(0)
+{
+    if (p.userDef) {
+        structure = p.userDef->getStruct();
+        typeName = NewPoolTString(p.userDef->getTypeName().c_str());
+        computeDeepestStructNesting();
+    }
+}
 
 //
 // Recursively generate mangled names.
@@ -92,6 +99,25 @@
     deepestStructNesting = 1 + maxNesting;
 }
 
+bool TType::isStructureContainingArrays() const
+{
+    if (!structure)
+    {
+        return false;
+    }
+
+    for (TTypeList::const_iterator member = structure->begin(); member != structure->end(); member++)
+    {
+        if (member->type->isArray() ||
+            member->type->isStructureContainingArrays())
+        {
+            return true;
+        }
+    }
+
+    return false;
+}
+
 //
 // Dump functions.
 //
diff --git a/Source/ThirdParty/ANGLE/src/compiler/SymbolTable.h b/Source/ThirdParty/ANGLE/src/compiler/SymbolTable.h
index 33616dc..a89499e 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/SymbolTable.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/SymbolTable.h
@@ -298,6 +298,11 @@
         return symbol;
     }
 
+    TSymbol *findBuiltIn(const TString &name)
+    {
+        return table[0]->find(name);
+    }
+
     TSymbolTableLevel* getGlobalLevel() {
         assert(table.size() >= 2);
         return table[1];
diff --git a/Source/ThirdParty/ANGLE/src/compiler/TranslatorESSL.cpp b/Source/ThirdParty/ANGLE/src/compiler/TranslatorESSL.cpp
index d90c70c..a4f047a 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/TranslatorESSL.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/TranslatorESSL.cpp
@@ -26,7 +26,7 @@
     getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
 
     // Write translated shader.
-    TOutputESSL outputESSL(sink);
+    TOutputESSL outputESSL(sink, getHashFunction(), getNameMap(), getSymbolTable());
     root->traverse(&outputESSL);
 }
 
diff --git a/Source/ThirdParty/ANGLE/src/compiler/TranslatorGLSL.cpp b/Source/ThirdParty/ANGLE/src/compiler/TranslatorGLSL.cpp
index ba38112..5f3dbcc 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/TranslatorGLSL.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/TranslatorGLSL.cpp
@@ -39,6 +39,6 @@
     getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
 
     // Write translated shader.
-    TOutputGLSL outputGLSL(sink);
+    TOutputGLSL outputGLSL(sink, getHashFunction(), getNameMap(), getSymbolTable());
     root->traverse(&outputGLSL);
 }
diff --git a/Source/ThirdParty/ANGLE/src/compiler/Types.h b/Source/ThirdParty/ANGLE/src/compiler/Types.h
index e1a18fd..d457667 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/Types.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/Types.h
@@ -1,5 +1,5 @@
 //
-// 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.
 //
@@ -11,10 +11,12 @@
 #include "compiler/Common.h"
 #include "compiler/debug.h"
 
+class TType;
+struct TPublicType;
+
 //
 // Need to have association of line numbers to types in a list for building structs.
 //
-class TType;
 struct TTypeLine {
     TType* type;
     int line;
@@ -27,59 +29,14 @@
     return new(memory) TTypeList;
 }
 
-//
-// This is a workaround for a problem with the yacc stack,  It can't have
-// types that it thinks have non-trivial constructors.  It should
-// just be used while recognizing the grammar, not anything else.  Pointers
-// could be used, but also trying to avoid lots of memory management overhead.
-//
-// Not as bad as it looks, there is no actual assumption that the fields
-// match up or are name the same or anything like that.
-//
-class TPublicType {
-public:
-    TBasicType type;
-    TQualifier qualifier;
-    TPrecision precision;
-    int size;          // size of vector or matrix, not size of array
-    bool matrix;
-    bool array;
-    int arraySize;
-    TType* userDef;
-    int line;
-
-    void setBasic(TBasicType bt, TQualifier q, int ln = 0)
-    {
-        type = bt;
-        qualifier = q;
-        precision = EbpUndefined;
-        size = 1;
-        matrix = false;
-        array = false;
-        arraySize = 0;
-        userDef = 0;
-        line = ln;
-    }
-
-    void setAggregate(int s, bool m = false)
-    {
-        size = s;
-        matrix = m;
-    }
-
-    void setArray(bool a, int s = 0)
-    {
-        array = a;
-        arraySize = s;
-    }
-};
-
 typedef TMap<TTypeList*, TTypeList*> TStructureMap;
 typedef TMap<TTypeList*, TTypeList*>::iterator TStructureMapIterator;
+
 //
 // Base class for things that have a type.
 //
-class TType {
+class TType
+{
 public:
     POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
     TType() {}
@@ -88,16 +45,7 @@
             maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0), typeName(0)
     {
     }
-    explicit TType(const TPublicType &p) :
-            type(p.type), precision(p.precision), qualifier(p.qualifier), size(p.size), matrix(p.matrix), array(p.array), arraySize(p.arraySize),
-            maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0), typeName(0)
-    {
-        if (p.userDef) {
-            structure = p.userDef->getStruct();
-            typeName = NewPoolTString(p.userDef->getTypeName().c_str());
-            computeDeepestStructNesting();
-        }
-    }
+    explicit TType(const TPublicType &p);
     TType(TTypeList* userDef, const TString& n, TPrecision p = EbpUndefined) :
             type(EbtStruct), precision(p), qualifier(EvqTemporary), size(1), matrix(false), array(false), arraySize(0),
             maxArraySize(0), arrayInformationType(0), structure(userDef), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0)
@@ -284,6 +232,8 @@
     // deepest field (nesting2.field1.position).
     int getDeepestStructNesting() const { return deepestStructNesting; }
 
+    bool isStructureContainingArrays() const;
+
 protected:
     void buildMangledName(TString&);
     int getStructSize() const;
@@ -308,4 +258,61 @@
     TString *typeName;          // for structure field type name
 };
 
+//
+// This is a workaround for a problem with the yacc stack,  It can't have
+// types that it thinks have non-trivial constructors.  It should
+// just be used while recognizing the grammar, not anything else.  Pointers
+// could be used, but also trying to avoid lots of memory management overhead.
+//
+// Not as bad as it looks, there is no actual assumption that the fields
+// match up or are name the same or anything like that.
+//
+struct TPublicType
+{
+    TBasicType type;
+    TQualifier qualifier;
+    TPrecision precision;
+    int size;          // size of vector or matrix, not size of array
+    bool matrix;
+    bool array;
+    int arraySize;
+    TType* userDef;
+    int line;
+
+    void setBasic(TBasicType bt, TQualifier q, int ln = 0)
+    {
+        type = bt;
+        qualifier = q;
+        precision = EbpUndefined;
+        size = 1;
+        matrix = false;
+        array = false;
+        arraySize = 0;
+        userDef = 0;
+        line = ln;
+    }
+
+    void setAggregate(int s, bool m = false)
+    {
+        size = s;
+        matrix = m;
+    }
+
+    void setArray(bool a, int s = 0)
+    {
+        array = a;
+        arraySize = s;
+    }
+
+    bool isStructureContainingArrays() const
+    {
+        if (!userDef)
+        {
+            return false;
+        }
+
+        return userDef->isStructureContainingArrays();
+    }
+};
+
 #endif // _TYPES_INCLUDED_
diff --git a/Source/ThirdParty/ANGLE/src/compiler/UnfoldShortCircuit.cpp b/Source/ThirdParty/ANGLE/src/compiler/UnfoldShortCircuit.cpp
index 1782ebc..e22a75f 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/UnfoldShortCircuit.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/UnfoldShortCircuit.cpp
@@ -95,9 +95,9 @@
             mTemporaryIndex = i + 1;
         }
         return false;
+      default:
+        return true;
     }
-
-    return true;
 }
 
 bool UnfoldShortCircuit::visitSelection(Visit visit, TIntermSelection *node)
diff --git a/Source/ThirdParty/ANGLE/src/compiler/VariableInfo.cpp b/Source/ThirdParty/ANGLE/src/compiler/VariableInfo.cpp
index 1e9486f..eb6bea9 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/VariableInfo.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/VariableInfo.cpp
@@ -77,23 +77,25 @@
 static void getUserDefinedVariableInfo(const TType& type,
                                        const TString& name,
                                        const TString& mappedName,
-                                       TVariableInfoList& infoList);
+                                       TVariableInfoList& infoList,
+                                       ShHashFunction64 hashFunction);
 
 // Returns info for an attribute or uniform.
 static void getVariableInfo(const TType& type,
                             const TString& name,
                             const TString& mappedName,
-                            TVariableInfoList& infoList)
+                            TVariableInfoList& infoList,
+                            ShHashFunction64 hashFunction)
 {
     if (type.getBasicType() == EbtStruct) {
         if (type.isArray()) {
             for (int i = 0; i < type.getArraySize(); ++i) {
                 TString lname = name + arrayBrackets(i);
                 TString lmappedName = mappedName + arrayBrackets(i);
-                getUserDefinedVariableInfo(type, lname, lmappedName, infoList);
+                getUserDefinedVariableInfo(type, lname, lmappedName, infoList, hashFunction);
             }
         } else {
-            getUserDefinedVariableInfo(type, name, mappedName, infoList);
+            getUserDefinedVariableInfo(type, name, mappedName, infoList, hashFunction);
         }
     } else {
         getBuiltInVariableInfo(type, name, mappedName, infoList);
@@ -124,7 +126,8 @@
 void getUserDefinedVariableInfo(const TType& type,
                                 const TString& name,
                                 const TString& mappedName,
-                                TVariableInfoList& infoList)
+                                TVariableInfoList& infoList,
+                                ShHashFunction64 hashFunction)
 {
     ASSERT(type.getBasicType() == EbtStruct);
 
@@ -133,15 +136,28 @@
         const TType* fieldType = (*structure)[i].type;
         getVariableInfo(*fieldType,
                         name + "." + fieldType->getFieldName(),
-                        mappedName + "." + fieldType->getFieldName(),
-                        infoList);
+                        mappedName + "." + TIntermTraverser::hash(fieldType->getFieldName(), hashFunction),
+                        infoList,
+                        hashFunction);
     }
 }
 
+TVariableInfo::TVariableInfo()
+{
+}
+
+TVariableInfo::TVariableInfo(ShDataType type, int size)
+    : type(type),
+      size(size)
+{
+}
+
 CollectAttribsUniforms::CollectAttribsUniforms(TVariableInfoList& attribs,
-                                               TVariableInfoList& uniforms)
+                                               TVariableInfoList& uniforms,
+                                               ShHashFunction64 hashFunction)
     : mAttribs(attribs),
-      mUniforms(uniforms)
+      mUniforms(uniforms),
+      mHashFunction(hashFunction)
 {
 }
 
@@ -196,10 +212,16 @@
                 // cannot be initialized in a shader, we must have only
                 // TIntermSymbol nodes in the sequence.
                 ASSERT(variable != NULL);
+                TString processedSymbol;
+                if (mHashFunction == NULL)
+                    processedSymbol = variable->getSymbol();
+                else
+                    processedSymbol = TIntermTraverser::hash(variable->getOriginalSymbol(), mHashFunction);
                 getVariableInfo(variable->getType(),
                                 variable->getOriginalSymbol(),
-                                variable->getSymbol(),
-                                infoList);
+                                processedSymbol,
+                                infoList,
+                                mHashFunction);
             }
         }
         break;
diff --git a/Source/ThirdParty/ANGLE/src/compiler/VariableInfo.h b/Source/ThirdParty/ANGLE/src/compiler/VariableInfo.h
index 667acaf..4130a58 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/VariableInfo.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/VariableInfo.h
@@ -13,6 +13,9 @@
 // Provides information about a variable.
 // It is currently being used to store info about active attribs and uniforms.
 struct TVariableInfo {
+    TVariableInfo(ShDataType type, int size);
+    TVariableInfo();
+
     TPersistString name;
     TPersistString mappedName;
     ShDataType type;
@@ -24,7 +27,8 @@
 class CollectAttribsUniforms : public TIntermTraverser {
 public:
     CollectAttribsUniforms(TVariableInfoList& attribs,
-                           TVariableInfoList& uniforms);
+                           TVariableInfoList& uniforms,
+                           ShHashFunction64 hashFunction);
 
     virtual void visitSymbol(TIntermSymbol*);
     virtual void visitConstantUnion(TIntermConstantUnion*);
@@ -38,6 +42,8 @@
 private:
     TVariableInfoList& mAttribs;
     TVariableInfoList& mUniforms;
+
+    ShHashFunction64 mHashFunction;
 };
 
 #endif  // COMPILER_VARIABLE_INFO_H_
diff --git a/Source/ThirdParty/ANGLE/src/compiler/VariablePacker.cpp b/Source/ThirdParty/ANGLE/src/compiler/VariablePacker.cpp
new file mode 100644
index 0000000..2f0c4bc
--- /dev/null
+++ b/Source/ThirdParty/ANGLE/src/compiler/VariablePacker.cpp
@@ -0,0 +1,297 @@
+//
+// 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/VariablePacker.h"
+
+#include <algorithm>
+#include "compiler/ShHandle.h"
+
+namespace {
+int GetSortOrder(ShDataType type)
+{
+    switch (type) {
+        case SH_FLOAT_MAT4:
+            return 0;
+        case SH_FLOAT_MAT2:
+            return 1;
+        case SH_FLOAT_VEC4:
+        case SH_INT_VEC4:
+        case SH_BOOL_VEC4:
+            return 2;
+        case SH_FLOAT_MAT3:
+            return 3;
+        case SH_FLOAT_VEC3:
+        case SH_INT_VEC3:
+        case SH_BOOL_VEC3:
+            return 4;
+        case SH_FLOAT_VEC2:
+        case SH_INT_VEC2:
+        case SH_BOOL_VEC2:
+            return 5;
+        case SH_FLOAT:
+        case SH_INT:
+        case SH_BOOL:
+        case SH_SAMPLER_2D:
+        case SH_SAMPLER_CUBE:
+        case SH_SAMPLER_EXTERNAL_OES:
+        case SH_SAMPLER_2D_RECT_ARB:
+            return 6;
+        default:
+            ASSERT(false);
+            return 7;
+    }
+}
+}    // namespace
+
+int VariablePacker::GetNumComponentsPerRow(ShDataType type)
+{
+    switch (type) {
+        case SH_FLOAT_MAT4:
+        case SH_FLOAT_MAT2:
+        case SH_FLOAT_VEC4:
+        case SH_INT_VEC4:
+        case SH_BOOL_VEC4:
+            return 4;
+        case SH_FLOAT_MAT3:
+        case SH_FLOAT_VEC3:
+        case SH_INT_VEC3:
+        case SH_BOOL_VEC3:
+            return 3;
+        case SH_FLOAT_VEC2:
+        case SH_INT_VEC2:
+        case SH_BOOL_VEC2:
+            return 2;
+        case SH_FLOAT:
+        case SH_INT:
+        case SH_BOOL:
+        case SH_SAMPLER_2D:
+        case SH_SAMPLER_CUBE:
+        case SH_SAMPLER_EXTERNAL_OES:
+        case SH_SAMPLER_2D_RECT_ARB:
+            return 1;
+        default:
+            ASSERT(false);
+            return 5;
+    }
+}
+
+int VariablePacker::GetNumRows(ShDataType type)
+{
+    switch (type) {
+        case SH_FLOAT_MAT4:
+            return 4;
+        case SH_FLOAT_MAT3:
+            return 3;
+        case SH_FLOAT_MAT2:
+            return 1;
+        case SH_FLOAT_VEC4:
+        case SH_INT_VEC4:
+        case SH_BOOL_VEC4:
+        case SH_FLOAT_VEC3:
+        case SH_INT_VEC3:
+        case SH_BOOL_VEC3:
+        case SH_FLOAT_VEC2:
+        case SH_INT_VEC2:
+        case SH_BOOL_VEC2:
+        case SH_FLOAT:
+        case SH_INT:
+        case SH_BOOL:
+        case SH_SAMPLER_2D:
+        case SH_SAMPLER_CUBE:
+        case SH_SAMPLER_EXTERNAL_OES:
+        case SH_SAMPLER_2D_RECT_ARB:
+            return 1;
+        default:
+            ASSERT(false);
+            return 100000;
+    }
+}
+
+struct TVariableInfoComparer {
+    bool operator()(const TVariableInfo& lhs, const TVariableInfo& rhs) const
+    {
+        int lhsSortOrder = GetSortOrder(lhs.type);
+        int rhsSortOrder = GetSortOrder(rhs.type);
+        if (lhsSortOrder != rhsSortOrder) {
+            return lhsSortOrder < rhsSortOrder;
+        }
+        // Sort by largest first.
+        return lhs.size > rhs.size;
+    }
+};
+
+unsigned VariablePacker::makeColumnFlags(int column, int numComponentsPerRow)
+{
+    return ((kColumnMask << (kNumColumns - numComponentsPerRow)) &
+                    kColumnMask) >> column;
+}
+
+void VariablePacker::fillColumns(int topRow, int numRows, int column, int numComponentsPerRow)
+{
+    unsigned columnFlags = makeColumnFlags(column, numComponentsPerRow);
+    for (int r = 0; r < numRows; ++r) {
+        int row = topRow + r;
+        ASSERT((rows_[row] & columnFlags) == 0);
+        rows_[row] |= columnFlags;
+    }
+}
+
+bool VariablePacker::searchColumn(int column, int numRows, int* destRow, int* destSize)
+{
+    ASSERT(destRow);
+
+    for (; topNonFullRow_ < maxRows_ && rows_[topNonFullRow_] == kColumnMask;
+         ++topNonFullRow_) {
+    }
+
+    for (; bottomNonFullRow_ >= 0 && rows_[bottomNonFullRow_] == kColumnMask;
+         --bottomNonFullRow_) {
+    }
+
+    if (bottomNonFullRow_ - topNonFullRow_ + 1 < numRows) {
+        return false;
+    }
+
+    unsigned columnFlags = makeColumnFlags(column, 1);
+    int topGoodRow = 0;
+    int smallestGoodTop = -1;
+    int smallestGoodSize = maxRows_ + 1;
+    int bottomRow = bottomNonFullRow_ + 1;
+    bool found = false;
+    for (int row = topNonFullRow_; row <= bottomRow; ++row) {
+        bool rowEmpty = row < bottomRow ? ((rows_[row] & columnFlags) == 0) : false;
+        if (rowEmpty) {
+            if (!found) {
+                topGoodRow = row;
+                found = true;
+            }
+        } else {
+            if (found) {
+                int size = row - topGoodRow;
+                if (size >= numRows && size < smallestGoodSize) {
+                    smallestGoodSize = size;
+                    smallestGoodTop = topGoodRow;
+                }
+            }
+            found = false;
+        }
+    }
+    if (smallestGoodTop < 0) {
+        return false;
+    }
+
+    *destRow = smallestGoodTop;
+    if (destSize) {
+        *destSize = smallestGoodSize;
+    }
+    return true;
+}
+
+bool VariablePacker::CheckVariablesWithinPackingLimits(int maxVectors, const TVariableInfoList& in_variables)
+{
+    ASSERT(maxVectors > 0);
+    maxRows_ = maxVectors;
+    topNonFullRow_ = 0;
+    bottomNonFullRow_ = maxRows_ - 1;
+    TVariableInfoList variables(in_variables);
+
+    // As per GLSL 1.017 Appendix A, Section 7 variables are packed in specific
+    // order by type, then by size of array, largest first.
+    std::sort(variables.begin(), variables.end(), TVariableInfoComparer());
+    rows_.clear();
+    rows_.resize(maxVectors, 0);
+
+    // Packs the 4 column variables.
+    size_t ii = 0;
+    for (; ii < variables.size(); ++ii) {
+        const TVariableInfo& variable = variables[ii];
+        if (GetNumComponentsPerRow(variable.type) != 4) {
+            break;
+        }
+        topNonFullRow_ += GetNumRows(variable.type) * variable.size;
+    }
+
+    if (topNonFullRow_ > maxRows_) {
+        return false;
+    }
+
+    // Packs the 3 column variables.
+    int num3ColumnRows = 0;
+    for (; ii < variables.size(); ++ii) {
+        const TVariableInfo& variable = variables[ii];
+        if (GetNumComponentsPerRow(variable.type) != 3) {
+            break;
+        }
+        num3ColumnRows += GetNumRows(variable.type) * variable.size;
+    }
+
+    if (topNonFullRow_ + num3ColumnRows > maxRows_) {
+        return false;
+    }
+
+    fillColumns(topNonFullRow_, num3ColumnRows, 0, 3);
+
+    // Packs the 2 column variables.
+    int top2ColumnRow = topNonFullRow_ + num3ColumnRows;
+    int twoColumnRowsAvailable = maxRows_ - top2ColumnRow;
+    int rowsAvailableInColumns01 = twoColumnRowsAvailable;
+    int rowsAvailableInColumns23 = twoColumnRowsAvailable;
+    for (; ii < variables.size(); ++ii) {
+        const TVariableInfo& variable = variables[ii];
+        if (GetNumComponentsPerRow(variable.type) != 2) {
+            break;
+        }
+        int numRows = GetNumRows(variable.type) * variable.size;
+        if (numRows <= rowsAvailableInColumns01) {
+            rowsAvailableInColumns01 -= numRows;
+        } else if (numRows <= rowsAvailableInColumns23) {
+            rowsAvailableInColumns23 -= numRows;
+        } else {
+            return false;
+        }
+    }
+
+    int numRowsUsedInColumns01 =
+        twoColumnRowsAvailable - rowsAvailableInColumns01;
+    int numRowsUsedInColumns23 =
+        twoColumnRowsAvailable - rowsAvailableInColumns23;
+    fillColumns(top2ColumnRow, numRowsUsedInColumns01, 0, 2);
+    fillColumns(maxRows_ - numRowsUsedInColumns23, numRowsUsedInColumns23,
+                2, 2);
+
+    // Packs the 1 column variables.
+    for (; ii < variables.size(); ++ii) {
+        const TVariableInfo& variable = variables[ii];
+        ASSERT(1 == GetNumComponentsPerRow(variable.type));
+        int numRows = GetNumRows(variable.type) * variable.size;
+        int smallestColumn = -1;
+        int smallestSize = maxRows_ + 1;
+        int topRow = -1;
+        for (int column = 0; column < kNumColumns; ++column) {
+            int row = 0;
+            int size = 0;
+            if (searchColumn(column, numRows, &row, &size)) {
+                if (size < smallestSize) {
+                    smallestSize = size;
+                    smallestColumn = column;
+                    topRow = row;
+                }
+            }
+        }
+
+        if (smallestColumn < 0) {
+            return false;
+        }
+
+        fillColumns(topRow, numRows, smallestColumn, 1);
+    }
+
+    ASSERT(variables.size() == ii);
+
+    return true;
+}
+
+
+
diff --git a/Source/ThirdParty/ANGLE/src/compiler/VariablePacker.h b/Source/ThirdParty/ANGLE/src/compiler/VariablePacker.h
new file mode 100644
index 0000000..8987066
--- /dev/null
+++ b/Source/ThirdParty/ANGLE/src/compiler/VariablePacker.h
@@ -0,0 +1,41 @@
+//
+// 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 _VARIABLEPACKER_INCLUDED_
+#define _VARIABLEPACKER_INCLUDED_
+
+#include <vector>
+#include "compiler/ShHandle.h"
+
+class VariablePacker {
+ public:
+    // Returns true if the passed in variables pack in maxVectors following
+    // the packing rules from the GLSL 1.017 spec, Appendix A, section 7.
+    bool CheckVariablesWithinPackingLimits(
+        int maxVectors,
+        const TVariableInfoList& in_variables);
+
+    // Gets how many components in a row a data type takes.
+    static int GetNumComponentsPerRow(ShDataType type);
+
+    // Gets how many rows a data type takes.
+    static int GetNumRows(ShDataType type);
+
+ private:
+    static const int kNumColumns = 4;
+    static const unsigned kColumnMask = (1 << kNumColumns) - 1;
+
+    unsigned makeColumnFlags(int column, int numComponentsPerRow);
+    void fillColumns(int topRow, int numRows, int column, int numComponentsPerRow);
+    bool searchColumn(int column, int numRows, int* destRow, int* destSize);
+
+    int topNonFullRow_;
+    int bottomNonFullRow_;
+    int maxRows_;
+    std::vector<unsigned> rows_;
+};
+
+#endif // _VARIABLEPACKER_INCLUDED_
diff --git a/Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.cpp b/Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.cpp
index 26cee05..7a82bb4 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.cpp
@@ -1,5 +1,5 @@
 //
-// 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.
 //
@@ -9,17 +9,22 @@
 static const int GLSL_VERSION_110 = 110;
 static const int GLSL_VERSION_120 = 120;
 
-// We need to scan for three things:
+// We need to scan for the following:
 // 1. "invariant" keyword: This can occur in both - vertex and fragment shaders
 //    but only at the global scope.
 // 2. "gl_PointCoord" built-in variable: This can only occur in fragment shader
 //    but inside any scope.
 // 3. Call to a matrix constructor with another matrix as argument.
 //    (These constructors were reserved in GLSL version 1.10.)
-//
-// If it weren't for (3) then we would only need to scan the global
-// scope of the vertex shader. However, we need to scan the entire
-// shader in both cases.
+// 4. Arrays as "out" function parameters.
+//    GLSL spec section 6.1.1: "When calling a function, expressions that do
+//    not evaluate to l-values cannot be passed to parameters declared as
+//    out or inout."
+//    GLSL 1.1 section 5.8: "Other binary or unary expressions,
+//    non-dereferenced arrays, function names, swizzles with repeated fields,
+//    and constants cannot be l-values."
+//    GLSL 1.2 relaxed the restriction on arrays, section 5.8: "Variables that
+//    are built-in types, entire structures or arrays... are all l-values."
 //
 // TODO(alokp): The following two cases of invariant decalaration get lost
 // during parsing - they do not get carried over to the intermediate tree.
@@ -79,6 +84,26 @@
         }
         break;
       }
+      case EOpParameters: {
+        const TIntermSequence& params = node->getSequence();
+        for (TIntermSequence::const_iterator iter = params.begin();
+             iter != params.end(); ++iter)
+        {
+            const TIntermTyped* param = (*iter)->getAsTyped();
+            if (param->isArray())
+            {
+                TQualifier qualifier = param->getQualifier();
+                if ((qualifier == EvqOut) || (qualifier ==  EvqInOut))
+                {
+                    updateVersion(GLSL_VERSION_120);
+                    break;
+                }
+            }
+        }
+        // Fully processed. No need to visit children.
+        visitChildren = false;
+        break;
+      }
       case EOpConstructMat2:
       case EOpConstructMat3:
       case EOpConstructMat4: {
diff --git a/Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.h b/Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.h
index 376fcb8..1c1cb1a 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/VersionGLSL.h
@@ -22,14 +22,18 @@
 //   - c++ style name hiding rules.
 //   - built-in variable gl_PointCoord for fragment shaders.
 //   - matrix constructors taking matrix as argument.
+//   - array as "out" function parameters
 //
 class TVersionGLSL : public TIntermTraverser {
 public:
     TVersionGLSL(ShShaderType type);
 
-    // Returns 120 if "invariant" keyword, "gl_PointCoord", or
-    // matrix/matrix constructors are used in the shader. Else 110 is
-    // returned.
+    // Returns 120 if the following is used the shader:
+    // - "invariant",
+    // - "gl_PointCoord",
+    // - matrix/matrix constructors
+    // - array "out" parameters
+    // Else 110 is returned.
     int getVersion() { return mVersion; }
 
     virtual void visitSymbol(TIntermSymbol*);
diff --git a/Source/ThirdParty/ANGLE/src/compiler/glslang.l b/Source/ThirdParty/ANGLE/src/compiler/glslang.l
index b9a302d..8300ff6 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/glslang.l
+++ b/Source/ThirdParty/ANGLE/src/compiler/glslang.l
@@ -38,7 +38,7 @@
 %{
 #include "compiler/glslang.h"
 #include "compiler/ParseHelper.h"
-#include "compiler/preprocessor/new/Token.h"
+#include "compiler/preprocessor/Token.h"
 #include "compiler/util.h"
 #include "glslang_tab.h"
 
@@ -272,148 +272,13 @@
 
 %%
 
-#if !ANGLE_USE_NEW_PREPROCESSOR
-extern "C" {
-// Preprocessor interface.
-#include "compiler/preprocessor/preprocess.h"
-
-extern int InitPreprocessor();
-extern int FinalizePreprocessor();
-extern void PredefineIntMacro(const char *name, int value);
-
-#define SETUP_CONTEXT(pp) \
-    TParseContext* context = (TParseContext*) pp->pC; \
-    struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
-
-// Preprocessor callbacks.
-void CPPDebugLogMsg(const char *msg)
-{
-    SETUP_CONTEXT(cpp);
-    context->trace(msg);
-}
-
-void CPPWarningToInfoLog(const char *msg)
-{
-    SETUP_CONTEXT(cpp);
-    context->warning(yylineno, msg, "");
-}
-
-void CPPShInfoLogMsg(const char *msg)
-{
-    SETUP_CONTEXT(cpp);
-    context->error(yylineno, msg, "");
-    context->recover();
-}
-
-void CPPErrorToInfoLog(const char *msg)
-{
-    SETUP_CONTEXT(cpp);
-    context->error(yylineno, msg, "");
-    context->recover();
-}
-
-void SetLineNumber(int line)
-{
-    SETUP_CONTEXT(cpp);
-    int string = 0;
-    DecodeSourceLoc(yylineno, &string, NULL);
-    yylineno = EncodeSourceLoc(string, line);
-}
-
-void SetStringNumber(int string)
-{
-    SETUP_CONTEXT(cpp);
-    int line = 0;
-    DecodeSourceLoc(yylineno, NULL, &line);
-    yylineno = EncodeSourceLoc(string, line);
-}
-
-int GetStringNumber()
-{
-    SETUP_CONTEXT(cpp);
-    int string = 0;
-    DecodeSourceLoc(yylineno, &string, NULL);
-    return string;
-}
-
-int GetLineNumber()
-{
-    SETUP_CONTEXT(cpp);
-    int line = 0;
-    DecodeSourceLoc(yylineno, NULL, &line);
-    return line;
-}
-
-void IncLineNumber()
-{
-    SETUP_CONTEXT(cpp);
-    int string = 0, line = 0;
-    DecodeSourceLoc(yylineno, &string, &line);
-    yylineno = EncodeSourceLoc(string, ++line);
-}
-
-void DecLineNumber()
-{
-    SETUP_CONTEXT(cpp);
-    int string = 0, line = 0;
-    DecodeSourceLoc(yylineno, &string, &line);
-    yylineno = EncodeSourceLoc(string, --line);
-}
-
-void HandlePragma(const char **tokens, int numTokens)
-{
-    SETUP_CONTEXT(cpp);
-
-    if (numTokens != 4) return;
-    if (strcmp(tokens[1], "(") != 0) return;
-    if (strcmp(tokens[3], ")") != 0) return;
-
-    context->handlePragmaDirective(yylineno, tokens[0], tokens[2]);
-}
-
-void StoreStr(const char *string)
-{
-    SETUP_CONTEXT(cpp);
-    TString strSrc;
-    strSrc = TString(string);
-
-    context->HashErrMsg = context->HashErrMsg + " " + strSrc;
-}
-
-const char* GetStrfromTStr(void)
-{
-    SETUP_CONTEXT(cpp);
-    cpp->ErrMsg = context->HashErrMsg.c_str();
-    return cpp->ErrMsg;
-}
-
-void ResetTString(void)
-{
-    SETUP_CONTEXT(cpp);
-    context->HashErrMsg = "";
-}
-
-void updateExtensionBehavior(const char* extName, const char* behavior)
-{
-    SETUP_CONTEXT(cpp);
-    context->handleExtensionDirective(yylineno, extName, behavior);
-}
-}  // extern "C"
-#endif  // !ANGLE_USE_NEW_PREPROCESSOR
-
 int string_input(char* buf, int max_size, yyscan_t yyscanner) {
-    int len = 0;
-
-#if ANGLE_USE_NEW_PREPROCESSOR
     pp::Token token;
     yyget_extra(yyscanner)->preprocessor.lex(&token);
-    len = token.type == pp::Token::LAST ? 0 : token.value.size();
+    int len = token.type == pp::Token::LAST ? 0 : token.text.size();
     if ((len > 0) && (len < max_size))
-        memcpy(buf, token.value.c_str(), len);
+        memcpy(buf, token.text.c_str(), len);
     yyset_lineno(EncodeSourceLoc(token.location.file, token.location.line), yyscanner);
-#else
-    len = yylex_CPP(buf, max_size);
-#endif  // ANGLE_USE_NEW_PREPROCESSOR
 
     if (len >= max_size)
         YY_FATAL_ERROR("Input buffer overflow");
@@ -473,9 +338,6 @@
     context->scanner = NULL;
     yylex_destroy(scanner);
 
-#if !ANGLE_USE_NEW_PREPROCESSOR
-    FinalizePreprocessor();
-#endif
     return 0;
 }
 
@@ -486,27 +348,14 @@
     context->AfterEOF = false;
 
     // Initialize preprocessor.
-#if ANGLE_USE_NEW_PREPROCESSOR
     if (!context->preprocessor.init(count, string, length))
         return 1;
-#else
-    if (InitPreprocessor())
-        return 1;
-    cpp->pC = context;
-    cpp->pastFirstStatement = 0;
-    if (InitScannerInput(cpp, count, string, length))
-        return 1;
-#endif  // ANGLE_USE_NEW_PREPROCESSOR
 
     // Define extension macros.
     const TExtensionBehavior& extBehavior = context->extensionBehavior();
     for (TExtensionBehavior::const_iterator iter = extBehavior.begin();
          iter != extBehavior.end(); ++iter) {
-#if ANGLE_USE_NEW_PREPROCESSOR
         context->preprocessor.predefineMacro(iter->first.c_str(), 1);
-#else
-        PredefineIntMacro(iter->first.c_str(), 1);
-#endif
     }
     return 0;
 }
diff --git a/Source/ThirdParty/ANGLE/src/compiler/glslang.y b/Source/ThirdParty/ANGLE/src/compiler/glslang.y
index 3cad335..7cd4977 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/glslang.y
+++ b/Source/ThirdParty/ANGLE/src/compiler/glslang.y
@@ -340,18 +340,10 @@
                 else
                     $$->setType(TType($1->getBasicType(), $1->getPrecision(), EvqConst, (int) (*$3.string).size()));
             } else {
-                if (fields.num == 1) {
-                    ConstantUnion *unionArray = new ConstantUnion[1];
-                    unionArray->setIConst(fields.offsets[0]);
-                    TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), $3.line);
-                    $$ = context->intermediate.addIndex(EOpIndexDirect, $1, index, $2.line);
-                    $$->setType(TType($1->getBasicType(), $1->getPrecision()));
-                } else {
-                    TString vectorString = *$3.string;
-                    TIntermTyped* index = context->intermediate.addSwizzle(fields, $3.line);
-                    $$ = context->intermediate.addIndex(EOpVectorSwizzle, $1, index, $2.line);
-                    $$->setType(TType($1->getBasicType(), $1->getPrecision(), EvqTemporary, (int) vectorString.size()));
-                }
+                TString vectorString = *$3.string;
+                TIntermTyped* index = context->intermediate.addSwizzle(fields, $3.line);
+                $$ = context->intermediate.addIndex(EOpVectorSwizzle, $1, index, $2.line);
+                $$->setType(TType($1->getBasicType(), $1->getPrecision(), EvqTemporary, (int) vectorString.size()));
             }
         } else if ($1->isMatrix()) {
             TMatrixFields fields;
@@ -1211,7 +1203,7 @@
         if (context->structQualifierErrorCheck($3.line, $$.type))
             context->recover();
 
-        if (context->nonInitConstErrorCheck($3.line, *$3.string, $$.type))
+        if (context->nonInitConstErrorCheck($3.line, *$3.string, $$.type, false))
             context->recover();
 
         TVariable* variable = 0;
@@ -1224,7 +1216,7 @@
         if (context->structQualifierErrorCheck($3.line, $1.type))
             context->recover();
 
-        if (context->nonInitConstErrorCheck($3.line, *$3.string, $1.type))
+        if (context->nonInitConstErrorCheck($3.line, *$3.string, $1.type, true))
             context->recover();
 
         $$ = $1;
@@ -1242,7 +1234,7 @@
         if (context->structQualifierErrorCheck($3.line, $1.type))
             context->recover();
 
-        if (context->nonInitConstErrorCheck($3.line, *$3.string, $1.type))
+        if (context->nonInitConstErrorCheck($3.line, *$3.string, $1.type, true))
             context->recover();
 
         $$ = $1;
@@ -1296,7 +1288,7 @@
         if (context->structQualifierErrorCheck($2.line, $$.type))
             context->recover();
 
-        if (context->nonInitConstErrorCheck($2.line, *$2.string, $$.type))
+        if (context->nonInitConstErrorCheck($2.line, *$2.string, $$.type, false))
             context->recover();
             
             $$.type = $1;
@@ -1327,7 +1319,7 @@
         if (context->structQualifierErrorCheck($2.line, $1))
             context->recover();
 
-        if (context->nonInitConstErrorCheck($2.line, *$2.string, $1))
+        if (context->nonInitConstErrorCheck($2.line, *$2.string, $1, true))
             context->recover();
 
         $$.type = $1;
@@ -2037,6 +2029,15 @@
 function_definition
     : function_prototype {
         TFunction* function = $1.function;
+        
+        const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName());
+        
+        if (builtIn)
+        {
+            context->error($1.line, "built-in functions cannot be redefined", function->getName().c_str());
+            context->recover();
+        }
+        
         TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
         //
         // Note:  'prevDec' could be 'function' if this is the first time we've seen function
diff --git a/Source/ThirdParty/ANGLE/src/compiler/glslang_lex.cpp b/Source/ThirdParty/ANGLE/src/compiler/glslang_lex.cpp
index a3bfa13..f651df1 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/glslang_lex.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/glslang_lex.cpp
@@ -68,6 +68,7 @@
 typedef uint16_t flex_uint16_t;
 typedef int32_t flex_int32_t;
 typedef uint32_t flex_uint32_t;
+typedef uint64_t flex_uint64_t;
 #else
 typedef signed char flex_int8_t;
 typedef short int flex_int16_t;
@@ -378,7 +379,7 @@
  */
 #define YY_DO_BEFORE_ACTION \
 	yyg->yytext_ptr = yy_bp; \
-	yyleng = (size_t) (yy_cp - yy_bp); \
+	yyleng = (yy_size_t) (yy_cp - yy_bp); \
 	yyg->yy_hold_char = *yy_cp; \
 	*yy_cp = '\0'; \
 	yyg->yy_c_buf_p = yy_cp;
@@ -807,7 +808,7 @@
 
 #include "compiler/glslang.h"
 #include "compiler/ParseHelper.h"
-#include "compiler/preprocessor/new/Token.h"
+#include "compiler/preprocessor/Token.h"
 #include "compiler/util.h"
 #include "glslang_tab.h"
 
@@ -2947,148 +2948,13 @@
 
 #define YYTABLES_NAME "yytables"
 
-#if !ANGLE_USE_NEW_PREPROCESSOR
-extern "C" {
-// Preprocessor interface.
-#include "compiler/preprocessor/preprocess.h"
-
-extern int InitPreprocessor();
-extern int FinalizePreprocessor();
-extern void PredefineIntMacro(const char *name, int value);
-
-#define SETUP_CONTEXT(pp) \
-    TParseContext* context = (TParseContext*) pp->pC; \
-    struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
-
-// Preprocessor callbacks.
-void CPPDebugLogMsg(const char *msg)
-{
-    SETUP_CONTEXT(cpp);
-    context->trace(msg);
-}
-
-void CPPWarningToInfoLog(const char *msg)
-{
-    SETUP_CONTEXT(cpp);
-    context->warning(yylineno, msg, "");
-}
-
-void CPPShInfoLogMsg(const char *msg)
-{
-    SETUP_CONTEXT(cpp);
-    context->error(yylineno, msg, "");
-    context->recover();
-}
-
-void CPPErrorToInfoLog(const char *msg)
-{
-    SETUP_CONTEXT(cpp);
-    context->error(yylineno, msg, "");
-    context->recover();
-}
-
-void SetLineNumber(int line)
-{
-    SETUP_CONTEXT(cpp);
-    int string = 0;
-    DecodeSourceLoc(yylineno, &string, NULL);
-    yylineno = EncodeSourceLoc(string, line);
-}
-
-void SetStringNumber(int string)
-{
-    SETUP_CONTEXT(cpp);
-    int line = 0;
-    DecodeSourceLoc(yylineno, NULL, &line);
-    yylineno = EncodeSourceLoc(string, line);
-}
-
-int GetStringNumber()
-{
-    SETUP_CONTEXT(cpp);
-    int string = 0;
-    DecodeSourceLoc(yylineno, &string, NULL);
-    return string;
-}
-
-int GetLineNumber()
-{
-    SETUP_CONTEXT(cpp);
-    int line = 0;
-    DecodeSourceLoc(yylineno, NULL, &line);
-    return line;
-}
-
-void IncLineNumber()
-{
-    SETUP_CONTEXT(cpp);
-    int string = 0, line = 0;
-    DecodeSourceLoc(yylineno, &string, &line);
-    yylineno = EncodeSourceLoc(string, ++line);
-}
-
-void DecLineNumber()
-{
-    SETUP_CONTEXT(cpp);
-    int string = 0, line = 0;
-    DecodeSourceLoc(yylineno, &string, &line);
-    yylineno = EncodeSourceLoc(string, --line);
-}
-
-void HandlePragma(const char **tokens, int numTokens)
-{
-    SETUP_CONTEXT(cpp);
-
-    if (numTokens != 4) return;
-    if (strcmp(tokens[1], "(") != 0) return;
-    if (strcmp(tokens[3], ")") != 0) return;
-
-    context->handlePragmaDirective(yylineno, tokens[0], tokens[2]);
-}
-
-void StoreStr(const char *string)
-{
-    SETUP_CONTEXT(cpp);
-    TString strSrc;
-    strSrc = TString(string);
-
-    context->HashErrMsg = context->HashErrMsg + " " + strSrc;
-}
-
-const char* GetStrfromTStr(void)
-{
-    SETUP_CONTEXT(cpp);
-    cpp->ErrMsg = context->HashErrMsg.c_str();
-    return cpp->ErrMsg;
-}
-
-void ResetTString(void)
-{
-    SETUP_CONTEXT(cpp);
-    context->HashErrMsg = "";
-}
-
-void updateExtensionBehavior(const char* extName, const char* behavior)
-{
-    SETUP_CONTEXT(cpp);
-    context->handleExtensionDirective(yylineno, extName, behavior);
-}
-}  // extern "C"
-#endif  // !ANGLE_USE_NEW_PREPROCESSOR
-
 int string_input(char* buf, int max_size, yyscan_t yyscanner) {
-    int len = 0;
-
-#if ANGLE_USE_NEW_PREPROCESSOR
     pp::Token token;
     yyget_extra(yyscanner)->preprocessor.lex(&token);
-    len = token.type == pp::Token::LAST ? 0 : token.value.size();
+    int len = token.type == pp::Token::LAST ? 0 : token.text.size();
     if ((len > 0) && (len < max_size))
-        memcpy(buf, token.value.c_str(), len);
+        memcpy(buf, token.text.c_str(), len);
     yyset_lineno(EncodeSourceLoc(token.location.file, token.location.line),yyscanner);
-#else
-    len = yylex_CPP(buf, max_size);
-#endif  // ANGLE_USE_NEW_PREPROCESSOR
 
     if (len >= max_size)
         YY_FATAL_ERROR("Input buffer overflow");
@@ -3148,9 +3014,6 @@
     context->scanner = NULL;
     yylex_destroy(scanner);
 
-#if !ANGLE_USE_NEW_PREPROCESSOR
-    FinalizePreprocessor();
-#endif
     return 0;
 }
 
@@ -3161,27 +3024,14 @@
     context->AfterEOF = false;
 
     // Initialize preprocessor.
-#if ANGLE_USE_NEW_PREPROCESSOR
     if (!context->preprocessor.init(count, string, length))
         return 1;
-#else
-    if (InitPreprocessor())
-        return 1;
-    cpp->pC = context;
-    cpp->pastFirstStatement = 0;
-    if (InitScannerInput(cpp, count, string, length))
-        return 1;
-#endif  // ANGLE_USE_NEW_PREPROCESSOR
 
     // Define extension macros.
     const TExtensionBehavior& extBehavior = context->extensionBehavior();
     for (TExtensionBehavior::const_iterator iter = extBehavior.begin();
          iter != extBehavior.end(); ++iter) {
-#if ANGLE_USE_NEW_PREPROCESSOR
         context->preprocessor.predefineMacro(iter->first.c_str(), 1);
-#else
-        PredefineIntMacro(iter->first.c_str(), 1);
-#endif
     }
     return 0;
 }
diff --git a/Source/ThirdParty/ANGLE/src/compiler/glslang_tab.cpp b/Source/ThirdParty/ANGLE/src/compiler/glslang_tab.cpp
index 46b514a..72cc849 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/glslang_tab.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/glslang_tab.cpp
@@ -752,26 +752,26 @@
 static const yytype_uint16 yyrline[] =
 {
        0,   168,   168,   203,   206,   219,   224,   229,   235,   238,
-     317,   320,   429,   439,   452,   460,   560,   563,   571,   575,
-     582,   586,   593,   599,   608,   616,   671,   678,   688,   691,
-     701,   711,   732,   733,   734,   739,   740,   749,   761,   762,
-     770,   781,   785,   786,   796,   806,   816,   829,   830,   840,
-     853,   857,   861,   865,   866,   879,   880,   893,   894,   907,
-     908,   925,   926,   939,   940,   941,   942,   943,   947,   950,
-     961,   969,   996,  1001,  1008,  1046,  1049,  1056,  1064,  1085,
-    1106,  1117,  1146,  1151,  1161,  1166,  1176,  1179,  1182,  1185,
-    1191,  1198,  1201,  1223,  1241,  1265,  1288,  1292,  1310,  1318,
-    1350,  1370,  1459,  1468,  1491,  1494,  1500,  1508,  1516,  1524,
-    1534,  1541,  1544,  1547,  1553,  1556,  1571,  1575,  1579,  1583,
-    1592,  1597,  1602,  1607,  1612,  1617,  1622,  1627,  1632,  1637,
-    1643,  1649,  1655,  1660,  1665,  1674,  1683,  1688,  1701,  1701,
-    1715,  1715,  1724,  1727,  1742,  1778,  1782,  1788,  1796,  1812,
-    1816,  1820,  1821,  1827,  1828,  1829,  1830,  1831,  1835,  1836,
-    1836,  1836,  1846,  1847,  1851,  1851,  1852,  1852,  1857,  1860,
-    1870,  1873,  1879,  1880,  1884,  1892,  1896,  1906,  1911,  1928,
-    1928,  1933,  1933,  1940,  1940,  1948,  1951,  1957,  1960,  1966,
-    1970,  1977,  1984,  1991,  1998,  2009,  2018,  2022,  2029,  2032,
-    2038,  2038
+     317,   320,   421,   431,   444,   452,   552,   555,   563,   567,
+     574,   578,   585,   591,   600,   608,   663,   670,   680,   683,
+     693,   703,   724,   725,   726,   731,   732,   741,   753,   754,
+     762,   773,   777,   778,   788,   798,   808,   821,   822,   832,
+     845,   849,   853,   857,   858,   871,   872,   885,   886,   899,
+     900,   917,   918,   931,   932,   933,   934,   935,   939,   942,
+     953,   961,   988,   993,  1000,  1038,  1041,  1048,  1056,  1077,
+    1098,  1109,  1138,  1143,  1153,  1158,  1168,  1171,  1174,  1177,
+    1183,  1190,  1193,  1215,  1233,  1257,  1280,  1284,  1302,  1310,
+    1342,  1362,  1451,  1460,  1483,  1486,  1492,  1500,  1508,  1516,
+    1526,  1533,  1536,  1539,  1545,  1548,  1563,  1567,  1571,  1575,
+    1584,  1589,  1594,  1599,  1604,  1609,  1614,  1619,  1624,  1629,
+    1635,  1641,  1647,  1652,  1657,  1666,  1675,  1680,  1693,  1693,
+    1707,  1707,  1716,  1719,  1734,  1770,  1774,  1780,  1788,  1804,
+    1808,  1812,  1813,  1819,  1820,  1821,  1822,  1823,  1827,  1828,
+    1828,  1828,  1838,  1839,  1843,  1843,  1844,  1844,  1849,  1852,
+    1862,  1865,  1871,  1872,  1876,  1884,  1888,  1898,  1903,  1920,
+    1920,  1925,  1925,  1932,  1932,  1940,  1943,  1949,  1952,  1958,
+    1962,  1969,  1976,  1983,  1990,  2001,  2010,  2014,  2021,  2024,
+    2030,  2030
 };
 #endif
 
@@ -2360,18 +2360,10 @@
                 else
                     (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqConst, (int) (*(yyvsp[(3) - (3)].lex).string).size()));
             } else {
-                if (fields.num == 1) {
-                    ConstantUnion *unionArray = new ConstantUnion[1];
-                    unionArray->setIConst(fields.offsets[0]);
-                    TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
-                    (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
-                    (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
-                } else {
-                    TString vectorString = *(yyvsp[(3) - (3)].lex).string;
-                    TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
-                    (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
-                    (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
-                }
+                TString vectorString = *(yyvsp[(3) - (3)].lex).string;
+                TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
+                (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
+                (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
             }
         } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
             TMatrixFields fields;
@@ -3430,7 +3422,7 @@
         if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
             context->recover();
 
-        if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type))
+        if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, false))
             context->recover();
 
         TVariable* variable = 0;
@@ -3447,7 +3439,7 @@
         if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
             context->recover();
 
-        if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type))
+        if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, true))
             context->recover();
 
         (yyval.interm) = (yyvsp[(1) - (5)].interm);
@@ -3469,7 +3461,7 @@
         if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
             context->recover();
 
-        if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type))
+        if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, true))
             context->recover();
 
         (yyval.interm) = (yyvsp[(1) - (6)].interm);
@@ -3532,7 +3524,7 @@
         if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
             context->recover();
 
-        if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type))
+        if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, false))
             context->recover();
             
             (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
@@ -3571,7 +3563,7 @@
         if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
             context->recover();
 
-        if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type)))
+        if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), true))
             context->recover();
 
         (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
@@ -4517,6 +4509,15 @@
 
     {
         TFunction* function = (yyvsp[(1) - (1)].interm).function;
+        
+        const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName());
+        
+        if (builtIn)
+        {
+            context->error((yyvsp[(1) - (1)].interm).line, "built-in functions cannot be redefined", function->getName().c_str());
+            context->recover();
+        }
+        
         TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
         //
         // Note:  'prevDec' could be 'function' if this is the first time we've seen function
diff --git a/Source/ThirdParty/ANGLE/src/compiler/intermediate.h b/Source/ThirdParty/ANGLE/src/compiler/intermediate.h
index e63d425..75812a8 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/intermediate.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/intermediate.h
@@ -16,6 +16,8 @@
 #ifndef __INTERMEDIATE_H
 #define __INTERMEDIATE_H
 
+#include "GLSLANG/ShaderLang.h"
+
 #include "compiler/Common.h"
 #include "compiler/Types.h"
 #include "compiler/ConstantUnion.h"
@@ -551,6 +553,10 @@
     void incrementDepth() {depth++;}
     void decrementDepth() {depth--;}
 
+    // Return the original name if hash function pointer is NULL;
+    // otherwise return the hashed name.
+    static TString hash(const TString& name, ShHashFunction64 hashFunction);
+
     const bool preVisit;
     const bool inVisit;
     const bool postVisit;
diff --git a/Source/ThirdParty/ANGLE/src/compiler/osinclude.h b/Source/ThirdParty/ANGLE/src/compiler/osinclude.h
index 1d95907..adf1a3e 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/osinclude.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/osinclude.h
@@ -24,9 +24,7 @@
 #error Unsupported platform.
 #endif
 
-#if defined(ANGLE_USE_NSPR)
-#include "prthread.h"
-#elif defined(ANGLE_OS_WIN)
+#if defined(ANGLE_OS_WIN)
 #define STRICT
 #define VC_EXTRALEAN 1
 #include <windows.h>
@@ -34,7 +32,7 @@
 #include <pthread.h>
 #include <semaphore.h>
 #include <errno.h>
-#endif  // ANGLE_USE_NSPR
+#endif  // ANGLE_OS_WIN
 
 
 #include "compiler/debug.h"
@@ -42,16 +40,13 @@
 //
 // Thread Local Storage Operations
 //
-#if defined(ANGLE_USE_NSPR)
-typedef PRUintn OS_TLSIndex;
-#define OS_INVALID_TLS_INDEX 0xFFFFFFFF
-#elif defined(ANGLE_OS_WIN)
+#if defined(ANGLE_OS_WIN)
 typedef DWORD OS_TLSIndex;
 #define OS_INVALID_TLS_INDEX (TLS_OUT_OF_INDEXES)
 #elif defined(ANGLE_OS_POSIX)
 typedef unsigned int OS_TLSIndex;
 #define OS_INVALID_TLS_INDEX 0xFFFFFFFF
-#endif  // ANGLE_USE_NSPR
+#endif  // ANGLE_OS_WIN
 
 OS_TLSIndex OS_AllocTLSIndex();
 bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue);
@@ -60,9 +55,7 @@
 inline void* OS_GetTLSValue(OS_TLSIndex nIndex)
 {
     ASSERT(nIndex != OS_INVALID_TLS_INDEX);
-#if defined(ANGLE_USE_NSPR)
-    return PR_GetThreadPrivate(nIndex);
-#elif defined(ANGLE_OS_WIN)
+#if defined(ANGLE_OS_WIN)
     return TlsGetValue(nIndex);
 #elif defined(ANGLE_OS_POSIX)
     return pthread_getspecific(nIndex);
diff --git a/Source/ThirdParty/ANGLE/src/compiler/ossource_nspr.cpp b/Source/ThirdParty/ANGLE/src/compiler/ossource_nspr.cpp
deleted file mode 100644
index f63d81e..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/ossource_nspr.cpp
+++ /dev/null
@@ -1,43 +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.
-//
-
-//
-// This file contains the nspr specific functions
-//
-#include "compiler/osinclude.h"
-
-//
-// Thread Local Storage Operations
-//
-OS_TLSIndex OS_AllocTLSIndex()
-{
-    PRUintn index;
-    PRStatus status = PR_NewThreadPrivateIndex(&index, NULL);
-
-    if (status) {
-        assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage");
-        return OS_INVALID_TLS_INDEX;
-    }
-
-    return index;
-}
-
-bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue)
-{
-    if (nIndex == OS_INVALID_TLS_INDEX) {
-        assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
-        return false;
-    }
-
-    return PR_SetThreadPrivate(nIndex, lpvValue) == 0;
-}
-
-bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
-{
-    // Can't delete TLS keys with nspr
-    return true;
-}
-
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.cpp b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.cpp
new file mode 100644
index 0000000..3e22e1f
--- /dev/null
+++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.cpp
@@ -0,0 +1,127 @@
+//
+// 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.
+//
+
+#include "DiagnosticsBase.h"
+
+#include <cassert>
+
+namespace pp
+{
+
+Diagnostics::~Diagnostics()
+{
+}
+
+void Diagnostics::report(ID id,
+                         const SourceLocation& loc,
+                         const std::string& text)
+{
+    // TODO(alokp): Keep a count of errors and warnings.
+    print(id, loc, text);
+}
+
+Diagnostics::Severity Diagnostics::severity(ID id)
+{
+    if ((id > ERROR_BEGIN) && (id < ERROR_END))
+        return ERROR;
+
+    if ((id > WARNING_BEGIN) && (id < WARNING_END))
+        return WARNING;
+
+    assert(false);
+    return ERROR;
+}
+
+std::string Diagnostics::message(ID id)
+{
+    switch (id)
+    {
+      // Errors begin.
+      case INTERNAL_ERROR:
+          return "internal error";
+      case OUT_OF_MEMORY:
+          return "out of memory";
+      case INVALID_CHARACTER:
+          return "invalid character";
+      case INVALID_NUMBER:
+          return "invalid number";
+      case INTEGER_OVERFLOW:
+          return "integer overflow";
+      case FLOAT_OVERFLOW:
+          return "float overflow";
+      case TOKEN_TOO_LONG:
+          return "token too long";
+      case INVALID_EXPRESSION:
+          return "invalid expression";
+      case DIVISION_BY_ZERO:
+          return "division by zero";
+      case EOF_IN_COMMENT:
+          return "unexpected end of file found in comment";
+      case UNEXPECTED_TOKEN:
+          return "unexpected token";
+      case DIRECTIVE_INVALID_NAME:
+          return "invalid directive name";
+      case MACRO_NAME_RESERVED:
+          return "macro name is reserved";
+      case MACRO_REDEFINED:
+          return "macro redefined";
+      case MACRO_PREDEFINED_REDEFINED:
+          return "predefined macro redefined";
+      case MACRO_PREDEFINED_UNDEFINED:
+          return "predefined macro undefined";
+      case MACRO_UNTERMINATED_INVOCATION:
+          return "unterminated macro invocation";
+      case MACRO_TOO_FEW_ARGS:
+          return "Not enough arguments for macro";
+      case MACRO_TOO_MANY_ARGS:
+          return "Too many arguments for macro";
+      case CONDITIONAL_ENDIF_WITHOUT_IF:
+          return "unexpected #endif found without a matching #if";
+      case CONDITIONAL_ELSE_WITHOUT_IF:
+          return "unexpected #else found without a matching #if";
+      case CONDITIONAL_ELSE_AFTER_ELSE:
+          return "unexpected #else found after another #else";
+      case CONDITIONAL_ELIF_WITHOUT_IF:
+          return "unexpected #elif found without a matching #if";
+      case CONDITIONAL_ELIF_AFTER_ELSE:
+          return "unexpected #elif found after #else";
+      case CONDITIONAL_UNTERMINATED:
+          return "unexpected end of file found in conditional block";
+      case INVALID_EXTENSION_NAME:
+          return "invalid extension name";
+      case INVALID_EXTENSION_BEHAVIOR:
+          return "invalid extension behavior";
+      case INVALID_EXTENSION_DIRECTIVE:
+          return "invalid extension directive";
+      case INVALID_VERSION_NUMBER:
+          return "invalid version number";
+      case INVALID_VERSION_DIRECTIVE:
+          return "invalid version directive";
+      case VERSION_NOT_FIRST_STATEMENT:
+        return "#version directive must occur before anything else, "
+               "except for comments and white space";
+      case INVALID_LINE_NUMBER:
+          return "invalid line number";
+      case INVALID_FILE_NUMBER:
+          return "invalid file number";
+      case INVALID_LINE_DIRECTIVE:
+          return "invalid line directive";
+      // Errors end.
+      // Warnings begin.
+      case EOF_IN_DIRECTIVE:
+          return "unexpected end of file found in directive";
+      case CONDITIONAL_UNEXPECTED_TOKEN:
+          return "unexpected token after conditional expression";
+      case UNRECOGNIZED_PRAGMA:
+          return "unrecognized pragma";
+      // Warnings end.
+      default:
+          assert(false);
+          return "";
+    }
+}
+
+}  // namespace pp
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Diagnostics.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.h
similarity index 92%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Diagnostics.h
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.h
index 1a75a9c..07bc411 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Diagnostics.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.h
@@ -31,10 +31,12 @@
         OUT_OF_MEMORY,
         INVALID_CHARACTER,
         INVALID_NUMBER,
+        INTEGER_OVERFLOW,
+        FLOAT_OVERFLOW,
+        TOKEN_TOO_LONG,
         INVALID_EXPRESSION,
         DIVISION_BY_ZERO,
         EOF_IN_COMMENT,
-        EOF_IN_DIRECTIVE,
         UNEXPECTED_TOKEN,
         DIRECTIVE_INVALID_NAME,
         MACRO_NAME_RESERVED,
@@ -55,12 +57,14 @@
         INVALID_EXTENSION_DIRECTIVE,
         INVALID_VERSION_NUMBER,
         INVALID_VERSION_DIRECTIVE,
+        VERSION_NOT_FIRST_STATEMENT,
         INVALID_LINE_NUMBER,
         INVALID_FILE_NUMBER,
         INVALID_LINE_DIRECTIVE,
         ERROR_END,
 
         WARNING_BEGIN,
+        EOF_IN_DIRECTIVE,
         CONDITIONAL_UNEXPECTED_TOKEN,
         UNRECOGNIZED_PRAGMA,
         WARNING_END
@@ -72,6 +76,7 @@
 
   protected:
     Severity severity(ID id);
+    std::string message(ID id);
 
     virtual void print(ID id,
                        const SourceLocation& loc,
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveHandlerBase.cpp b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveHandlerBase.cpp
similarity index 88%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveHandlerBase.cpp
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveHandlerBase.cpp
index ca91e1c..ef35c6e 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveHandlerBase.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveHandlerBase.cpp
@@ -4,7 +4,7 @@
 // found in the LICENSE file.
 //
 
-#include "DirectiveHandler.h"
+#include "DirectiveHandlerBase.h"
 
 namespace pp
 {
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveHandler.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveHandlerBase.h
similarity index 100%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveHandler.h
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveHandlerBase.h
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveParser.cpp b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.cpp
similarity index 82%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveParser.cpp
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.cpp
index 585a90e..94dfdf5 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveParser.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.cpp
@@ -10,8 +10,8 @@
 #include <cstdlib>
 #include <sstream>
 
-#include "Diagnostics.h"
-#include "DirectiveHandler.h"
+#include "DiagnosticsBase.h"
+#include "DirectiveHandlerBase.h"
 #include "ExpressionParser.h"
 #include "MacroExpander.h"
 #include "Token.h"
@@ -56,31 +56,31 @@
     if (token->type != pp::Token::IDENTIFIER)
         return DIRECTIVE_NONE;
 
-    if (token->value == kDirectiveDefine)
+    if (token->text == kDirectiveDefine)
         return DIRECTIVE_DEFINE;
-    else if (token->value == kDirectiveUndef)
+    else if (token->text == kDirectiveUndef)
         return DIRECTIVE_UNDEF;
-    else if (token->value == kDirectiveIf)
+    else if (token->text == kDirectiveIf)
         return DIRECTIVE_IF;
-    else if (token->value == kDirectiveIfdef)
+    else if (token->text == kDirectiveIfdef)
         return DIRECTIVE_IFDEF;
-    else if (token->value == kDirectiveIfndef)
+    else if (token->text == kDirectiveIfndef)
         return DIRECTIVE_IFNDEF;
-    else if (token->value == kDirectiveElse)
+    else if (token->text == kDirectiveElse)
         return DIRECTIVE_ELSE;
-    else if (token->value == kDirectiveElif)
+    else if (token->text == kDirectiveElif)
         return DIRECTIVE_ELIF;
-    else if (token->value == kDirectiveEndif)
+    else if (token->text == kDirectiveEndif)
         return DIRECTIVE_ENDIF;
-    else if (token->value == kDirectiveError)
+    else if (token->text == kDirectiveError)
         return DIRECTIVE_ERROR;
-    else if (token->value == kDirectivePragma)
+    else if (token->text == kDirectivePragma)
         return DIRECTIVE_PRAGMA;
-    else if (token->value == kDirectiveExtension)
+    else if (token->text == kDirectiveExtension)
         return DIRECTIVE_EXTENSION;
-    else if (token->value == kDirectiveVersion)
+    else if (token->text == kDirectiveVersion)
         return DIRECTIVE_VERSION;
-    else if (token->value == kDirectiveLine)
+    else if (token->text == kDirectiveLine)
         return DIRECTIVE_LINE;
 
     return DIRECTIVE_NONE;
@@ -159,7 +159,7 @@
         mLexer->lex(token);
         if (token->type != Token::IDENTIFIER)
             return;
-        if (token->value != kDefined)
+        if (token->text != kDefined)
             return;
 
         bool paren = false;
@@ -173,11 +173,11 @@
         if (token->type != Token::IDENTIFIER)
         {
             mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
-                                 token->location, token->value);
+                                 token->location, token->text);
             skipUntilEOD(mLexer, token);
             return;
         }
-        MacroSet::const_iterator iter = mMacroSet->find(token->value);
+        MacroSet::const_iterator iter = mMacroSet->find(token->text);
         std::string expression = iter != mMacroSet->end() ? "1" : "0";
 
         if (paren)
@@ -186,7 +186,7 @@
             if (token->type != ')')
             {
                 mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
-                                     token->location, token->value);
+                                     token->location, token->text);
                 skipUntilEOD(mLexer, token);
                 return;
             }
@@ -195,7 +195,7 @@
         // We have a valid defined operator.
         // Convert the current token into a CONST_INT token.
         token->type = Token::CONST_INT;
-        token->value = expression;
+        token->text = expression;
     }
 
   private:
@@ -208,6 +208,7 @@
                                  MacroSet* macroSet,
                                  Diagnostics* diagnostics,
                                  DirectiveHandler* directiveHandler) :
+    mPastFirstStatement(false),
     mTokenizer(tokenizer),
     mMacroSet(macroSet),
     mDiagnostics(diagnostics),
@@ -224,6 +225,7 @@
         if (token->type == Token::PP_HASH)
         {
             parseDirective(token);
+            mPastFirstStatement = true;
         }
 
         if (token->type == Token::LAST)
@@ -238,6 +240,8 @@
         }
 
     } while (skipping() || (token->type == '\n'));
+
+    mPastFirstStatement = true;
 }
 
 void DirectiveParser::parseDirective(Token* token)
@@ -245,6 +249,12 @@
     assert(token->type == Token::PP_HASH);
 
     mTokenizer->lex(token);
+    if (isEOD(token))
+    {
+        // Empty Directive.
+        return;
+    }
+
     DirectiveType directive = getDirective(token);
 
     // While in an excluded conditional block/group,
@@ -259,7 +269,7 @@
     {
       case DIRECTIVE_NONE:
         mDiagnostics->report(Diagnostics::DIRECTIVE_INVALID_NAME,
-                             token->location, token->value);
+                             token->location, token->text);
         skipUntilEOD(mTokenizer, token);
         break;
       case DIRECTIVE_DEFINE:
@@ -310,7 +320,7 @@
     if (token->type == Token::LAST)
     {
         mDiagnostics->report(Diagnostics::EOF_IN_DIRECTIVE,
-                             token->location, token->value);
+                             token->location, token->text);
     }
 }
 
@@ -322,25 +332,25 @@
     if (token->type != Token::IDENTIFIER)
     {
         mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
-                             token->location, token->value);
+                             token->location, token->text);
         return;
     }
-    if (isMacroPredefined(token->value, *mMacroSet))
+    if (isMacroPredefined(token->text, *mMacroSet))
     {
         mDiagnostics->report(Diagnostics::MACRO_PREDEFINED_REDEFINED,
-                             token->location, token->value);
+                             token->location, token->text);
         return;
     }
-    if (isMacroNameReserved(token->value))
+    if (isMacroNameReserved(token->text))
     {
         mDiagnostics->report(Diagnostics::MACRO_NAME_RESERVED,
-                             token->location, token->value);
+                             token->location, token->text);
         return;
     }
 
     Macro macro;
     macro.type = Macro::kTypeObj;
-    macro.name = token->value;
+    macro.name = token->text;
 
     mTokenizer->lex(token);
     if (token->type == '(' && !token->hasLeadingSpace())
@@ -351,7 +361,7 @@
             mTokenizer->lex(token);
             if (token->type != Token::IDENTIFIER)
                 break;
-            macro.parameters.push_back(token->value);
+            macro.parameters.push_back(token->text);
 
             mTokenizer->lex(token);  // Get ','.
         } while (token->type == ',');
@@ -360,7 +370,7 @@
         {
             mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
                                  token->location,
-                                 token->value);
+                                 token->text);
             return;
         }
         mTokenizer->lex(token);  // Get ')'.
@@ -402,17 +412,17 @@
     if (token->type != Token::IDENTIFIER)
     {
         mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
-                             token->location, token->value);
+                             token->location, token->text);
         return;
     }
 
-    MacroSet::iterator iter = mMacroSet->find(token->value);
+    MacroSet::iterator iter = mMacroSet->find(token->text);
     if (iter != mMacroSet->end())
     {
         if (iter->second.predefined)
         {
             mDiagnostics->report(Diagnostics::MACRO_PREDEFINED_UNDEFINED,
-                                 token->location, token->value);
+                                 token->location, token->text);
         }
         else
         {
@@ -448,7 +458,7 @@
     if (mConditionalStack.empty())
     {
         mDiagnostics->report(Diagnostics::CONDITIONAL_ELSE_WITHOUT_IF,
-                             token->location, token->value);
+                             token->location, token->text);
         skipUntilEOD(mTokenizer, token);
         return;
     }
@@ -463,7 +473,7 @@
     if (block.foundElseGroup)
     {
         mDiagnostics->report(Diagnostics::CONDITIONAL_ELSE_AFTER_ELSE,
-                             token->location, token->value);
+                             token->location, token->text);
         skipUntilEOD(mTokenizer, token);
         return;
     }
@@ -477,7 +487,7 @@
     if (!isEOD(token))
     {
         mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
-                             token->location, token->value);
+                             token->location, token->text);
         skipUntilEOD(mTokenizer, token);
     }
 }
@@ -489,7 +499,7 @@
     if (mConditionalStack.empty())
     {
         mDiagnostics->report(Diagnostics::CONDITIONAL_ELIF_WITHOUT_IF,
-                             token->location, token->value);
+                             token->location, token->text);
         skipUntilEOD(mTokenizer, token);
         return;
     }
@@ -504,7 +514,7 @@
     if (block.foundElseGroup)
     {
         mDiagnostics->report(Diagnostics::CONDITIONAL_ELIF_AFTER_ELSE,
-                             token->location, token->value);
+                             token->location, token->text);
         skipUntilEOD(mTokenizer, token);
         return;
     }
@@ -529,7 +539,7 @@
     if (mConditionalStack.empty())
     {
         mDiagnostics->report(Diagnostics::CONDITIONAL_ENDIF_WITHOUT_IF,
-                             token->location, token->value);
+                             token->location, token->text);
         skipUntilEOD(mTokenizer, token);
         return;
     }
@@ -541,7 +551,7 @@
     if (!isEOD(token))
     {
         mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
-                             token->location, token->value);
+                             token->location, token->text);
         skipUntilEOD(mTokenizer, token);
     }
 }
@@ -550,7 +560,7 @@
 {
     assert(getDirective(token) == DIRECTIVE_ERROR);
 
-    std::stringstream stream;
+    std::ostringstream stream;
     mTokenizer->lex(token);
     while ((token->type != '\n') && (token->type != Token::LAST))
     {
@@ -583,14 +593,14 @@
         switch(state++)
         {
           case PRAGMA_NAME:
-            name = token->value;
+            name = token->text;
             valid = valid && (token->type == Token::IDENTIFIER);
             break;
           case LEFT_PAREN:
             valid = valid && (token->type == '(');
             break;
           case PRAGMA_VALUE:
-            value = token->value;
+            value = token->text;
             valid = valid && (token->type == Token::IDENTIFIER);
             break;
           case RIGHT_PAREN:
@@ -641,16 +651,16 @@
             if (valid && (token->type != Token::IDENTIFIER))
             {
                 mDiagnostics->report(Diagnostics::INVALID_EXTENSION_NAME,
-                                     token->location, token->value);
+                                     token->location, token->text);
                 valid = false;
             }
-            if (valid) name = token->value;
+            if (valid) name = token->text;
             break;
           case COLON:
             if (valid && (token->type != ':'))
             {
                 mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
-                                     token->location, token->value);
+                                     token->location, token->text);
                 valid = false;
             }
             break;
@@ -658,16 +668,16 @@
             if (valid && (token->type != Token::IDENTIFIER))
             {
                 mDiagnostics->report(Diagnostics::INVALID_EXTENSION_BEHAVIOR,
-                                     token->location, token->value);
+                                     token->location, token->text);
                 valid = false;
             }
-            if (valid) behavior = token->value;
+            if (valid) behavior = token->text;
             break;
           default:
             if (valid)
             {
                 mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
-                                     token->location, token->value);
+                                     token->location, token->text);
                 valid = false;
             }
             break;
@@ -677,7 +687,7 @@
     if (valid && (state != EXT_BEHAVIOR + 1))
     {
         mDiagnostics->report(Diagnostics::INVALID_EXTENSION_DIRECTIVE,
-                             token->location, token->value);
+                             token->location, token->text);
         valid = false;
     }
     if (valid)
@@ -688,6 +698,14 @@
 {
     assert(getDirective(token) == DIRECTIVE_VERSION);
 
+    if (mPastFirstStatement)
+    {
+        mDiagnostics->report(Diagnostics::VERSION_NOT_FIRST_STATEMENT,
+                             token->location, token->text);
+        skipUntilEOD(mTokenizer, token);
+        return;
+    }
+
     enum State
     {
         VERSION_NUMBER
@@ -706,16 +724,21 @@
             if (valid && (token->type != Token::CONST_INT))
             {
                 mDiagnostics->report(Diagnostics::INVALID_VERSION_NUMBER,
-                                     token->location, token->value);
+                                     token->location, token->text);
                 valid = false;
             }
-            if (valid) version = atoi(token->value.c_str());
+            if (valid && !token->iValue(&version))
+            {
+                mDiagnostics->report(Diagnostics::INTEGER_OVERFLOW,
+                                     token->location, token->text);
+                valid = false;
+            }
             break;
           default:
             if (valid)
             {
                 mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
-                                     token->location, token->value);
+                                     token->location, token->text);
                 valid = false;
             }
             break;
@@ -725,7 +748,7 @@
     if (valid && (state != VERSION_NUMBER + 1))
     {
         mDiagnostics->report(Diagnostics::INVALID_VERSION_DIRECTIVE,
-                             token->location, token->value);
+                             token->location, token->text);
         valid = false;
     }
     if (valid)
@@ -756,25 +779,35 @@
             if (valid && (token->type != Token::CONST_INT))
             {
                 mDiagnostics->report(Diagnostics::INVALID_LINE_NUMBER,
-                                     token->location, token->value);
+                                     token->location, token->text);
                 valid = false;
             }
-            if (valid) line = atoi(token->value.c_str());
+            if (valid && !token->iValue(&line))
+            {
+                mDiagnostics->report(Diagnostics::INTEGER_OVERFLOW,
+                                     token->location, token->text);
+                valid = false;
+            }
             break;
           case FILE_NUMBER:
             if (valid && (token->type != Token::CONST_INT))
             {
                 mDiagnostics->report(Diagnostics::INVALID_FILE_NUMBER,
-                                     token->location, token->value);
+                                     token->location, token->text);
                 valid = false;
             }
-            if (valid) file = atoi(token->value.c_str());
+            if (valid && !token->iValue(&file))
+            {
+                mDiagnostics->report(Diagnostics::INTEGER_OVERFLOW,
+                                     token->location, token->text);
+                valid = false;
+            }
             break;
           default:
             if (valid)
             {
                 mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
-                                     token->location, token->value);
+                                     token->location, token->text);
                 valid = false;
             }
             break;
@@ -785,7 +818,7 @@
     if (valid && (state != FILE_NUMBER) && (state != FILE_NUMBER + 1))
     {
         mDiagnostics->report(Diagnostics::INVALID_LINE_DIRECTIVE,
-                             token->location, token->value);
+                             token->location, token->text);
         valid = false;
     }
     if (valid)
@@ -806,7 +839,7 @@
 void DirectiveParser::parseConditionalIf(Token* token)
 {
     ConditionalBlock block;
-    block.type = token->value;
+    block.type = token->text;
     block.location = token->location;
 
     if (skipping())
@@ -861,7 +894,7 @@
     if (!isEOD(token))
     {
         mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
-                             token->location, token->value);
+                             token->location, token->text);
         skipUntilEOD(mTokenizer, token);
     }
 
@@ -877,12 +910,12 @@
     if (token->type != Token::IDENTIFIER)
     {
         mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
-                             token->location, token->value);
+                             token->location, token->text);
         skipUntilEOD(mTokenizer, token);
         return 0;
     }
 
-    MacroSet::const_iterator iter = mMacroSet->find(token->value);
+    MacroSet::const_iterator iter = mMacroSet->find(token->text);
     int expression = iter != mMacroSet->end() ? 1 : 0;
 
     // Warn if there are tokens after #ifdef expression.
@@ -890,7 +923,7 @@
     if (!isEOD(token))
     {
         mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
-                             token->location, token->value);
+                             token->location, token->text);
         skipUntilEOD(mTokenizer, token);
     }
     return expression;
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveParser.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.h
similarity index 98%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveParser.h
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.h
index 115a01e..8a7f007 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveParser.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.h
@@ -69,6 +69,7 @@
         {
         }
     };
+    bool mPastFirstStatement;
     std::vector<ConditionalBlock> mConditionalStack;
     Tokenizer* mTokenizer;
     MacroSet* mMacroSet;
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/ExpressionParser.cpp b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp
similarity index 97%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/ExpressionParser.cpp
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp
index b3a9ce9..02a49b8 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/ExpressionParser.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp
@@ -112,9 +112,18 @@
 
 // This file is auto-generated by generate_parser.sh. DO NOT EDIT!
 
+// If clang or gcc.
 #if defined(__GNUC__)
-// Triggered by the auto-generated pplval variable.
+
+// Turn off uninitialized variable warnings triggered by the auto-generated pplval variable.
+// On gcc 4.7+, The flag is called "-Wmaybe-uninitialized".
+// On clang and gcc < 4.7, the flag is called "-Wuninitialized".
+#if !defined(__clang__) && ((__GNUC__ == 4 && __GNU_C_MINOR__ >= 7) || __GNUC__ >= 5)
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#else
 #pragma GCC diagnostic ignored "-Wuninitialized"
+#endif
+
 #elif defined(_MSC_VER)
 #pragma warning(disable: 4065 4701)
 #endif
@@ -122,16 +131,14 @@
 #include "ExpressionParser.h"
 
 #include <cassert>
-#include <cstdlib>
 #include <sstream>
 
-#include "Diagnostics.h"
+#include "DiagnosticsBase.h"
 #include "Lexer.h"
 #include "Token.h"
 
 #if defined(_MSC_VER)
 typedef __int64 YYSTYPE;
-#define strtoll _strtoi64
 #else
 #include <stdint.h>
 typedef intmax_t YYSTYPE;
@@ -480,9 +487,9 @@
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint8 yyrline[] =
 {
-       0,    89,    89,    96,    97,   100,   103,   106,   109,   112,
-     115,   118,   121,   124,   127,   130,   133,   136,   139,   142,
-     155,   168,   171,   174,   177,   180,   183
+       0,    96,    96,   103,   104,   107,   110,   113,   116,   119,
+     122,   125,   128,   131,   134,   137,   140,   143,   146,   149,
+     162,   175,   178,   181,   184,   187,   190
 };
 #endif
 
@@ -1559,7 +1566,7 @@
 
     {
         if ((yyvsp[(3) - (3)]) == 0) {
-            std::stringstream stream;
+            std::ostringstream stream;
             stream << (yyvsp[(1) - (3)]) << " % " << (yyvsp[(3) - (3)]);
             std::string text = stream.str();
             context->diagnostics->report(pp::Diagnostics::DIVISION_BY_ZERO,
@@ -1576,7 +1583,7 @@
 
     {
         if ((yyvsp[(3) - (3)]) == 0) {
-            std::stringstream stream;
+            std::ostringstream stream;
             stream << (yyvsp[(1) - (3)]) << " / " << (yyvsp[(3) - (3)]);
             std::string text = stream.str();
             context->diagnostics->report(pp::Diagnostics::DIVISION_BY_ZERO,
@@ -1858,10 +1865,17 @@
     switch (token->type)
     {
       case pp::Token::CONST_INT:
-        *lvalp = strtoll(token->value.c_str(), NULL, 0);
+      {
+        unsigned int val = 0;
+        if (!token->uValue(&val))
+        {
+            context->diagnostics->report(pp::Diagnostics::INTEGER_OVERFLOW,
+                                         token->location, token->text);
+        }
+        *lvalp = static_cast<YYSTYPE>(val);
         type = TOK_CONST_INT;
         break;
-
+      }
       case pp::Token::OP_OR: type = TOK_OP_OR; break;
       case pp::Token::OP_AND: type = TOK_OP_AND; break;
       case pp::Token::OP_NE: type = TOK_OP_NE; break;
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/ExpressionParser.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.h
similarity index 100%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/ExpressionParser.h
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.h
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/ExpressionParser.y b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.y
similarity index 89%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/ExpressionParser.y
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.y
index 17c9f05..9d4dd16 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/ExpressionParser.y
+++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.y
@@ -20,14 +20,18 @@
 
 // This file is auto-generated by generate_parser.sh. DO NOT EDIT!
 
+// If clang or gcc.
 #if defined(__GNUC__)
-// Toggle the warning for -Wpragmas to ensure we do not break the build
-// with earlier compiler versions because of unknown pragma options.
-#pragma GCC diagnostic ignored "-Wpragmas"
-// Triggered by the auto-generated pplval variable.
-#pragma GCC diagnostic ignored "-Wuninitialized"
+
+// Turn off uninitialized variable warnings triggered by the auto-generated pplval variable.
+// On gcc 4.7+, The flag is called "-Wmaybe-uninitialized".
+// On clang and gcc < 4.7, the flag is called "-Wuninitialized".
+#if !defined(__clang__) && ((__GNUC__ == 4 && __GNU_C_MINOR__ >= 7) || __GNUC__ >= 5)
 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
-#pragma GCC diagnostic warning "-Wpragmas"
+#else
+#pragma GCC diagnostic ignored "-Wuninitialized"
+#endif
+
 #elif defined(_MSC_VER)
 #pragma warning(disable: 4065 4701)
 #endif
@@ -35,16 +39,14 @@
 #include "ExpressionParser.h"
 
 #include <cassert>
-#include <cstdlib>
 #include <sstream>
 
-#include "Diagnostics.h"
+#include "DiagnosticsBase.h"
 #include "Lexer.h"
 #include "Token.h"
 
 #if defined(_MSC_VER)
 typedef __int64 YYSTYPE;
-#define strtoll _strtoi64
 #else
 #include <stdint.h>
 typedef intmax_t YYSTYPE;
@@ -146,7 +148,7 @@
     }
     | expression '%' expression {
         if ($3 == 0) {
-            std::stringstream stream;
+            std::ostringstream stream;
             stream << $1 << " % " << $3;
             std::string text = stream.str();
             context->diagnostics->report(pp::Diagnostics::DIVISION_BY_ZERO,
@@ -159,7 +161,7 @@
     }
     | expression '/' expression {
         if ($3 == 0) {
-            std::stringstream stream;
+            std::ostringstream stream;
             stream << $1 << " / " << $3;
             std::string text = stream.str();
             context->diagnostics->report(pp::Diagnostics::DIVISION_BY_ZERO,
@@ -200,10 +202,17 @@
     switch (token->type)
     {
       case pp::Token::CONST_INT:
-        *lvalp = strtoll(token->value.c_str(), NULL, 0);
+      {
+        unsigned int val = 0;
+        if (!token->uValue(&val))
+        {
+            context->diagnostics->report(pp::Diagnostics::INTEGER_OVERFLOW,
+                                         token->location, token->text);
+        }
+        *lvalp = static_cast<YYSTYPE>(val);
         type = TOK_CONST_INT;
         break;
-
+      }
       case pp::Token::OP_OR: type = TOK_OP_OR; break;
       case pp::Token::OP_AND: type = TOK_OP_AND; break;
       case pp::Token::OP_NE: type = TOK_OP_NE; break;
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Input.cpp b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Input.cpp
similarity index 87%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Input.cpp
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/Input.cpp
index c3de95f..11868c1 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Input.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Input.cpp
@@ -26,7 +26,7 @@
     for (int i = 0; i < mCount; ++i)
     {
         int len = length ? length[i] : -1;
-        mLength.push_back(len < 0 ? strlen(mString[i]) : len);
+        mLength.push_back(len < 0 ? std::strlen(mString[i]) : len);
     }
 }
 
@@ -37,7 +37,7 @@
     {
         int size = mLength[mReadLoc.sIndex] - mReadLoc.cIndex;
         size = std::min(size, maxSize);
-        memcpy(buf + nRead, mString[mReadLoc.sIndex] + mReadLoc.cIndex, size);
+        std::memcpy(buf + nRead, mString[mReadLoc.sIndex] + mReadLoc.cIndex, size);
         nRead += size;
         mReadLoc.cIndex += size;
 
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Input.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Input.h
similarity index 100%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Input.h
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/Input.h
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Lexer.cpp b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Lexer.cpp
similarity index 100%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Lexer.cpp
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/Lexer.cpp
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Lexer.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Lexer.h
similarity index 100%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Lexer.h
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/Lexer.h
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Macro.cpp b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Macro.cpp
similarity index 100%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Macro.cpp
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/Macro.cpp
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Macro.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Macro.h
similarity index 100%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Macro.h
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/Macro.h
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/MacroExpander.cpp b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/MacroExpander.cpp
similarity index 92%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/MacroExpander.cpp
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/MacroExpander.cpp
index fe5a7ae..1116c51 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/MacroExpander.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/MacroExpander.cpp
@@ -7,10 +7,9 @@
 #include "MacroExpander.h"
 
 #include <algorithm>
-#include <cassert>
 #include <sstream>
 
-#include "Diagnostics.h"
+#include "DiagnosticsBase.h"
 #include "Token.h"
 
 namespace pp
@@ -58,7 +57,10 @@
 
 MacroExpander::~MacroExpander()
 {
-    while (!mContextStack.empty()) popMacro();
+    for (std::size_t i = 0; i < mContextStack.size(); ++i)
+    {
+        delete mContextStack[i];
+    }
 }
 
 void MacroExpander::lex(Token* token)
@@ -73,7 +75,7 @@
         if (token->expansionDisabled())
             break;
 
-        MacroSet::const_iterator iter = mMacroSet->find(token->value);
+        MacroSet::const_iterator iter = mMacroSet->find(token->text);
         if (iter == mMacroSet->end())
             break;
 
@@ -151,7 +153,7 @@
     assert(!macro.disabled);
     assert(!identifier.expansionDisabled());
     assert(identifier.type == Token::IDENTIFIER);
-    assert(identifier.value == macro.name);
+    assert(identifier.text == macro.name);
 
     std::vector<Token> replacements;
     if (!expandMacro(macro, identifier, &replacements))
@@ -199,15 +201,15 @@
             Token& repl = replacements->front();
             if (macro.name == kLine)
             {
-                std::stringstream stream;
+                std::ostringstream stream;
                 stream << identifier.location.line;
-                repl.value = stream.str();
+                repl.text = stream.str();
             }
             else if (macro.name == kFile)
             {
-                std::stringstream stream;
+                std::ostringstream stream;
                 stream << identifier.location.file;
-                repl.value = stream.str();
+                repl.text = stream.str();
             }
         }
     }
@@ -222,7 +224,7 @@
         replaceMacroParams(macro, args, replacements);
     }
 
-    for (size_t i = 0; i < replacements->size(); ++i)
+    for (std::size_t i = 0; i < replacements->size(); ++i)
     {
         Token& repl = replacements->at(i);
         if (i == 0)
@@ -253,7 +255,7 @@
         if (token.type == Token::LAST)
         {
             mDiagnostics->report(Diagnostics::MACRO_UNTERMINATED_INVOCATION,
-                                 identifier.location, identifier.value);
+                                 identifier.location, identifier.text);
             // Do not lose EOF token.
             ungetToken(token);
             return false;
@@ -302,14 +304,14 @@
         Diagnostics::ID id = args->size() < macro.parameters.size() ?
             Diagnostics::MACRO_TOO_FEW_ARGS :
             Diagnostics::MACRO_TOO_MANY_ARGS;
-        mDiagnostics->report(id, identifier.location, identifier.value);
+        mDiagnostics->report(id, identifier.location, identifier.text);
         return false;
     }
 
     // Pre-expand each argument before substitution.
     // This step expands each argument individually before they are
     // inserted into the macro body.
-    for (size_t i = 0; i < args->size(); ++i)
+    for (std::size_t i = 0; i < args->size(); ++i)
     {
         MacroArg& arg = args->at(i);
         TokenLexer lexer(&arg);
@@ -330,7 +332,7 @@
                                        const std::vector<MacroArg>& args,
                                        std::vector<Token>* replacements)
 {
-    for (size_t i = 0; i < macro.replacements.size(); ++i)
+    for (std::size_t i = 0; i < macro.replacements.size(); ++i)
     {
         const Token& repl = macro.replacements[i];
         if (repl.type != Token::IDENTIFIER)
@@ -343,20 +345,20 @@
         // There is no need to search for macro params every time.
         // The param index can be cached with the replacement token.
         Macro::Parameters::const_iterator iter = std::find(
-            macro.parameters.begin(), macro.parameters.end(), repl.value);
+            macro.parameters.begin(), macro.parameters.end(), repl.text);
         if (iter == macro.parameters.end())
         {
             replacements->push_back(repl);
             continue;
         }
 
-        size_t iArg = std::distance(macro.parameters.begin(), iter);
+        std::size_t iArg = std::distance(macro.parameters.begin(), iter);
         const MacroArg& arg = args[iArg];
         if (arg.empty())
         {
             continue;
         }
-        size_t iRepl = replacements->size();
+        std::size_t iRepl = replacements->size();
         replacements->insert(replacements->end(), arg.begin(), arg.end());
         // The replacement token inherits padding properties from
         // macro replacement token.
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/MacroExpander.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/MacroExpander.h
similarity index 94%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/MacroExpander.h
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/MacroExpander.h
index 4504eba..21b6757 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/MacroExpander.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/MacroExpander.h
@@ -7,6 +7,7 @@
 #ifndef COMPILER_PREPROCESSOR_MACRO_EXPANDER_H_
 #define COMPILER_PREPROCESSOR_MACRO_EXPANDER_H_
 
+#include <cassert>
 #include <memory>
 #include <vector>
 
@@ -52,13 +53,13 @@
     struct MacroContext
     {
         const Macro* macro;
-        size_t index;
+        std::size_t index;
         std::vector<Token> replacements;
 
         MacroContext() : macro(0), index(0) { }
         bool empty() const { return index == replacements.size(); }
         const Token& get() { return replacements[index++]; }
-        void unget() { --index; }
+        void unget() { assert(index > 0); --index; }
     };
 
     Lexer* mLexer;
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Preprocessor.cpp b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.cpp
similarity index 67%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Preprocessor.cpp
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.cpp
index 21901fa..de024fe 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Preprocessor.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.cpp
@@ -9,7 +9,7 @@
 #include <cassert>
 #include <sstream>
 
-#include "Diagnostics.h"
+#include "DiagnosticsBase.h"
 #include "DirectiveParser.h"
 #include "Macro.h"
 #include "MacroExpander.h"
@@ -65,12 +65,12 @@
 
 void Preprocessor::predefineMacro(const char* name, int value)
 {
-    std::stringstream stream;
+    std::ostringstream stream;
     stream << value;
 
     Token token;
     token.type = Token::CONST_INT;
-    token.value = stream.str();
+    token.text = stream.str();
 
     Macro macro;
     macro.predefined = true;
@@ -95,13 +95,41 @@
           case Token::PP_HASH:
             assert(false);
             break;
+          case Token::CONST_INT:
+          {
+            int val = 0;
+            if (!token->iValue(&val))
+            {
+                // Do not mark the token as invalid.
+                // Just emit the diagnostic and reset value to 0.
+                mImpl->diagnostics->report(Diagnostics::INTEGER_OVERFLOW,
+                                           token->location, token->text);
+                token->text.assign("0");
+            }
+            validToken = true;
+            break;
+          }
+          case Token::CONST_FLOAT:
+          {
+            float val = 0;
+            if (!token->fValue(&val))
+            {
+                // Do not mark the token as invalid.
+                // Just emit the diagnostic and reset value to 0.0.
+                mImpl->diagnostics->report(Diagnostics::FLOAT_OVERFLOW,
+                                           token->location, token->text);
+                token->text.assign("0.0");
+            }
+            validToken = true;
+            break;
+          }
           case Token::PP_NUMBER:
             mImpl->diagnostics->report(Diagnostics::INVALID_NUMBER,
-                                       token->location, token->value);
+                                       token->location, token->text);
             break;
           case Token::PP_OTHER:
             mImpl->diagnostics->report(Diagnostics::INVALID_CHARACTER,
-                                       token->location, token->value);
+                                       token->location, token->text);
             break;
           default:
             validToken = true;
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Preprocessor.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.h
similarity index 100%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Preprocessor.h
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.h
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/SourceLocation.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/SourceLocation.h
similarity index 100%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/SourceLocation.h
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/SourceLocation.h
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Token.cpp b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Token.cpp
similarity index 69%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Token.cpp
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/Token.cpp
index 960380c..67f50aa 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Token.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Token.cpp
@@ -6,6 +6,10 @@
 
 #include "Token.h"
 
+#include <cassert>
+
+#include "numeric_lex.h"
+
 namespace pp
 {
 
@@ -14,7 +18,7 @@
     type = 0;
     flags = 0;
     location = SourceLocation();
-    value.clear();
+    text.clear();
 }
 
 bool Token::equals(const Token& other) const
@@ -22,7 +26,7 @@
     return (type == other.type) &&
            (flags == other.flags) &&
            (location == other.location) &&
-           (value == other.value);
+           (text == other.text);
 }
 
 void Token::setAtStartOfLine(bool start)
@@ -49,12 +53,30 @@
         flags &= ~EXPANSION_DISABLED;
 }
 
+bool Token::iValue(int* value) const
+{
+    assert(type == CONST_INT);
+    return numeric_lex_int(text, value);
+}
+
+bool Token::uValue(unsigned int* value) const
+{
+    assert(type == CONST_INT);
+    return numeric_lex_int(text, value);
+}
+
+bool Token::fValue(float* value) const
+{
+    assert(type == CONST_FLOAT);
+    return numeric_lex_float(text, value);
+}
+
 std::ostream& operator<<(std::ostream& out, const Token& token)
 {
     if (token.hasLeadingSpace())
         out << " ";
 
-    out << token.value;
+    out << token.text;
     return out;
 }
 
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Token.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Token.h
similarity index 88%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Token.h
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/Token.h
index 5231021..8b553ae 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Token.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Token.h
@@ -78,10 +78,16 @@
     bool expansionDisabled() const { return (flags & EXPANSION_DISABLED) != 0; }
     void setExpansionDisabled(bool disable);
 
+    // Converts text into numeric value for CONST_INT and CONST_FLOAT token.
+    // Returns false if the parsed value cannot fit into an int or float.
+    bool iValue(int* value) const;
+    bool uValue(unsigned int* value) const;
+    bool fValue(float* value) const;
+
     int type;
     unsigned int flags;
     SourceLocation location;
-    std::string value;
+    std::string text;
 };
 
 inline bool operator==(const Token& lhs, const Token& rhs)
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Tokenizer.cpp b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.cpp
similarity index 98%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Tokenizer.cpp
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.cpp
index 3bc3d1c..4a57647 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Tokenizer.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.cpp
@@ -1,4 +1,4 @@
-#line 16 "./preprocessor/new/Tokenizer.l"
+#line 16 "./Tokenizer.l"
 //
 // Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
@@ -9,7 +9,7 @@
 
 
 
-#line 13 "./preprocessor/new/Tokenizer.cpp"
+#line 13 "./Tokenizer.cpp"
 
 #define  YY_INT_ALIGNED short int
 
@@ -56,6 +56,7 @@
 typedef uint16_t flex_uint16_t;
 typedef int32_t flex_int32_t;
 typedef uint32_t flex_uint32_t;
+typedef uint64_t flex_uint64_t;
 #else
 typedef signed char flex_int8_t;
 typedef short int flex_int16_t;
@@ -353,7 +354,7 @@
  */
 #define YY_DO_BEFORE_ACTION \
 	yyg->yytext_ptr = yy_bp; \
-	yyleng = (size_t) (yy_cp - yy_bp); \
+	yyleng = (yy_size_t) (yy_cp - yy_bp); \
 	yyg->yy_hold_char = *yy_cp; \
 	*yy_cp = '\0'; \
 	yyg->yy_c_buf_p = yy_cp;
@@ -516,7 +517,7 @@
 
 #include "Tokenizer.h"
 
-#include "Diagnostics.h"
+#include "DiagnosticsBase.h"
 #include "Token.h"
 
 #if defined(__GNUC__)
@@ -2279,6 +2280,10 @@
 
 namespace pp {
 
+// TODO(alokp): Maximum token length should ideally be specified by
+// the preprocessor client, i.e., the compiler.
+const size_t Tokenizer::kMaxTokenLength = 256;
+
 Tokenizer::Tokenizer(Diagnostics* diagnostics) : mHandle(0)
 {
     mContext.diagnostics = diagnostics;
@@ -2312,7 +2317,14 @@
 
 void Tokenizer::lex(Token* token)
 {
-    token->type = pplex(&token->value,&token->location,mHandle);
+    token->type = pplex(&token->text,&token->location,mHandle);
+    if (token->text.size() > kMaxTokenLength)
+    {
+        mContext.diagnostics->report(Diagnostics::TOKEN_TOO_LONG,
+                                     token->location, token->text);
+        token->text.erase(kMaxTokenLength);
+    }
+
     token->flags = 0;
 
     token->setAtStartOfLine(mContext.lineStart);
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Tokenizer.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.h
similarity index 96%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Tokenizer.h
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.h
index b64a288..c603135 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Tokenizer.h
+++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.h
@@ -32,6 +32,7 @@
         bool leadingSpace;
         bool lineStart;
     };
+    static const std::size_t kMaxTokenLength;
 
     Tokenizer(Diagnostics* diagnostics);
     ~Tokenizer();
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Tokenizer.l b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.l
similarity index 93%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Tokenizer.l
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.l
index 401c732..689ae64b 100644
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Tokenizer.l
+++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.l
@@ -25,7 +25,7 @@
 %{
 #include "Tokenizer.h"
 
-#include "Diagnostics.h"
+#include "DiagnosticsBase.h"
 #include "Token.h"
 
 #if defined(__GNUC__)
@@ -264,6 +264,10 @@
 
 namespace pp {
 
+// TODO(alokp): Maximum token length should ideally be specified by
+// the preprocessor client, i.e., the compiler.
+const size_t Tokenizer::kMaxTokenLength = 256;
+
 Tokenizer::Tokenizer(Diagnostics* diagnostics) : mHandle(0)
 {
     mContext.diagnostics = diagnostics;
@@ -297,7 +301,14 @@
 
 void Tokenizer::lex(Token* token)
 {
-    token->type = yylex(&token->value, &token->location, mHandle);
+    token->type = yylex(&token->text, &token->location, mHandle);
+    if (token->text.size() > kMaxTokenLength)
+    {
+        mContext.diagnostics->report(Diagnostics::TOKEN_TOO_LONG,
+                                     token->location, token->text);
+        token->text.erase(kMaxTokenLength);
+    }
+
     token->flags = 0;
 
     token->setAtStartOfLine(mContext.lineStart);
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/atom.c b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/atom.c
deleted file mode 100644
index 39158d2..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/atom.c
+++ /dev/null
@@ -1,737 +0,0 @@
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms.  If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder. 
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-
-//
-// atom.c
-//
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "common/angleutils.h"
-#include "compiler/debug.h"
-#include "compiler/preprocessor/slglobals.h"
-
-#undef malloc
-#undef realloc
-#undef free
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////// String table: //////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-static const struct {
-    int val;
-    const char *str;
-} tokens[] = {
-    { CPP_AND_OP,         "&&" },
-    { CPP_AND_ASSIGN,     "&=" },
-    { CPP_SUB_ASSIGN,     "-=" },
-    { CPP_MOD_ASSIGN,     "%=" },
-    { CPP_ADD_ASSIGN,     "+=" },
-    { CPP_DIV_ASSIGN,     "/=" },
-    { CPP_MUL_ASSIGN,     "*=" },
-    { CPP_RIGHT_BRACKET,  ":>" },
-    { CPP_EQ_OP,          "==" },
-    { CPP_XOR_OP,         "^^" }, 
-    { CPP_XOR_ASSIGN,     "^=" }, 
-    { CPP_FLOATCONSTANT,  "<float-const>" },
-    { CPP_GE_OP,          ">=" },
-    { CPP_RIGHT_OP,       ">>" },
-    { CPP_RIGHT_ASSIGN,   ">>=" }, 
-    { CPP_IDENTIFIER,     "<ident>" },
-    { CPP_INTCONSTANT,    "<int-const>" },
-    { CPP_LE_OP,          "<=" },
-    { CPP_LEFT_OP,        "<<" },
-    { CPP_LEFT_ASSIGN,    "<<=" },
-    { CPP_LEFT_BRACKET,   "<:" },
-    { CPP_LEFT_BRACE,     "<%" }, 
-    { CPP_DEC_OP,         "--" },
-    { CPP_RIGHT_BRACE,    "%>" }, 
-    { CPP_NE_OP,          "!=" },
-    { CPP_OR_OP,          "||" },
-    { CPP_OR_ASSIGN,      "|=" }, 
-    { CPP_INC_OP,         "++" },
-    { CPP_STRCONSTANT,    "<string-const>" },
-    { CPP_TYPEIDENTIFIER, "<type-ident>" },
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////// String table: //////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-#define INIT_STRING_TABLE_SIZE 16384
-
-typedef struct StringTable_Rec {
-    char *strings;
-    int nextFree;
-    int size;
-} StringTable;
-
-/*
- * InitStringTable() - Initialize the string table.
- *
- */
-
-static int InitStringTable(StringTable *stable)
-{
-    stable->strings = (char *) malloc(INIT_STRING_TABLE_SIZE);
-    if (!stable->strings)
-        return 0;
-    // Zero-th offset means "empty" so don't use it.
-    stable->nextFree = 1;
-    stable->size = INIT_STRING_TABLE_SIZE;
-    return 1;
-} // InitStringTable
-
-/*
- * FreeStringTable() - Free the string table.
- *
- */
-
-static void FreeStringTable(StringTable *stable)
-{
-    if (stable->strings)
-        free(stable->strings);
-    stable->strings = NULL;
-    stable->nextFree = 0;
-    stable->size = 0;
-} // FreeStringTable
-
-/*
- * HashString() - Hash a string with the base hash function.
- *
- */
-
-static int HashString(const char *s)
-{
-    int hval = 0;
-
-    while (*s) {
-        hval = (hval*13507 + *s*197) ^ (hval >> 2);
-        s++;
-    }
-    return hval & 0x7fffffff;
-} // HashString
-
-/*
- * HashString2() - Hash a string with the incrimenting hash function.
- *
- */
-
-static int HashString2(const char *s)
-{
-    int hval = 0;
-
-    while (*s) {
-        hval = (hval*729 + *s*37) ^ (hval >> 1);
-        s++;
-    }
-    return hval;
-} // HashString2
-
-/*
- * AddString() - Add a string to a string table.  Return it's offset.
- *
- */
-
-static int AddString(StringTable *stable, const char *s)
-{
-    int len, loc;
-    char *str;
-
-    len = (int) strlen(s);
-    while (stable->nextFree + len + 1 >= stable->size) {
-        assert(stable->size < 1000000);
-        str = (char *) malloc(stable->size*2);
-        memcpy(str, stable->strings, stable->size);
-        free(stable->strings);
-        stable->strings = str;
-        stable->size = stable->size*2;
-    }
-    loc = stable->nextFree;
-    strcpy(&stable->strings[loc], s);
-    stable->nextFree += len + 1;
-    return loc;
-} // AddString
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////// Hash table: ///////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-#define INIT_HASH_TABLE_SIZE 2047
-#define HASH_TABLE_MAX_COLLISIONS 3
-
-typedef struct HashEntry_Rec {
-    int index;      // String table offset of string representation
-    int value;      // Atom (symbol) value
-} HashEntry;
-
-typedef struct HashTable_Rec {
-    HashEntry *entry;
-    int size;
-    int entries;
-    int counts[HASH_TABLE_MAX_COLLISIONS + 1];
-} HashTable;
-
-/*
- * InitHashTable() - Initialize the hash table.
- *
- */
-
-static int InitHashTable(HashTable *htable, int fsize)
-{
-    int ii;
-
-    htable->entry = (HashEntry *) malloc(sizeof(HashEntry)*fsize);
-    if (!htable->entry)
-        return 0;
-    htable->size = fsize;
-    for (ii = 0; ii < fsize; ii++) {
-        htable->entry[ii].index = 0;
-        htable->entry[ii].value = 0;
-    }
-    htable->entries = 0;
-    for (ii = 0; ii <= HASH_TABLE_MAX_COLLISIONS; ii++)
-        htable->counts[ii] = 0;
-    return 1;
-} // InitHashTable
-
-/*
- * FreeHashTable() - Free the hash table.
- *
- */
-
-static void FreeHashTable(HashTable *htable)
-{
-    if (htable->entry)
-        free(htable->entry);
-    htable->entry = NULL;
-    htable->size = 0;
-    htable->entries = 0;
-} // FreeHashTable
-
-/*
- * Empty() - See if a hash table entry is empty.
- *
- */
-
-static int Empty(HashTable *htable, int hashloc)
-{
-    assert(hashloc >= 0 && hashloc < htable->size);
-    if (htable->entry[hashloc].index == 0) {
-        return 1;
-    } else {
-        return 0;
-    }
-} // Empty
-
-/*
- * Match() - See if a hash table entry is matches a string.
- *
- */
-
-static int Match(HashTable *htable, StringTable *stable, const char *s, int hashloc)
-{
-    int strloc;
-
-    strloc = htable->entry[hashloc].index;
-    if (!strcmp(s, &stable->strings[strloc])) {
-        return 1;
-    } else {
-        return 0;
-    }
-} // Match
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////// Atom table: ///////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-#define INIT_ATOM_TABLE_SIZE 1024
-
-
-struct AtomTable_Rec {
-    StringTable stable; // String table.
-    HashTable htable;   // Hashes string to atom number and token value.  Multiple strings can
-                        // have the same token value but each unique string is a unique atom.
-    int *amap;          // Maps atom value to offset in string table.  Atoms all map to unique
-                        // strings except for some undefined values in the lower, fixed part
-                        // of the atom table that map to "<undefined>".  The lowest 256 atoms
-                        // correspond to single character ASCII values except for alphanumeric
-                        // characters and '_', which can be other tokens.  Next come the
-                        // language tokens with their atom values equal to the token value.
-                        // Then come predefined atoms, followed by user specified identifiers.
-    int *arev;          // Reversed atom for symbol table use.
-    int nextFree;
-    int size;
-};
-
-static AtomTable latable = { { NULL, 0, 0 }, { NULL, 0, 0, {0} }, NULL, NULL, 0, 0 };
-AtomTable *atable = &latable;
-
-static int AddAtomFixed(AtomTable *atable, const char *s, int atom);
-
-/*
- * GrowAtomTable() - Grow the atom table to at least "size" if it's smaller.
- *
- */
-
-static int GrowAtomTable(AtomTable *atable, int size)
-{
-    int *newmap, *newrev;
-
-    if (atable->size < size) {
-        if (atable->amap) {
-            newmap = realloc(atable->amap, sizeof(int)*size);
-            newrev = realloc(atable->arev, sizeof(int)*size);
-        } else {
-            newmap = malloc(sizeof(int)*size);
-            newrev = malloc(sizeof(int)*size);
-            atable->size = 0;
-        }
-        if (!newmap || !newrev) {
-            /* failed to grow -- error */
-            if (newmap)
-                atable->amap = newmap;
-            if (newrev)
-                atable->arev = newrev;
-            return -1;
-        }
-        memset(&newmap[atable->size], 0, (size - atable->size) * sizeof(int));
-        memset(&newrev[atable->size], 0, (size - atable->size) * sizeof(int));
-        atable->amap = newmap;
-        atable->arev = newrev;
-        atable->size = size;
-    }
-    return 0;
-} // GrowAtomTable
-
-/*
- * lReverse() - Reverse the bottom 20 bits of a 32 bit int.
- *
- */
-
-static int lReverse(int fval)
-{
-    unsigned int in = fval;
-    int result = 0, cnt = 0;
-
-    while(in) {
-        result <<= 1;
-        result |= in&1;
-        in >>= 1;
-        cnt++;
-    }
-
-    // Don't use all 31 bits.  One million atoms is plenty and sometimes the
-    // upper bits are used for other things.
-
-    if (cnt < 20)
-        result <<= 20 - cnt;
-    return result;
-} // lReverse
-
-/*
- * AllocateAtom() - Allocate a new atom.  Associated with the "undefined" value of -1.
- *
- */
-
-static int AllocateAtom(AtomTable *atable)
-{
-    if (atable->nextFree >= atable->size)
-        GrowAtomTable(atable, atable->nextFree*2);
-    atable->amap[atable->nextFree] = -1;
-    atable->arev[atable->nextFree] = lReverse(atable->nextFree);
-    atable->nextFree++;
-    return atable->nextFree - 1;
-} // AllocateAtom
-
-/*
- * SetAtomValue() - Allocate a new atom associated with "hashindex".
- *
- */
-
-static void SetAtomValue(AtomTable *atable, int atomnumber, int hashindex)
-{
-    atable->amap[atomnumber] = atable->htable.entry[hashindex].index;
-    atable->htable.entry[hashindex].value = atomnumber;
-} // SetAtomValue
-
-/*
- * FindHashLoc() - Find the hash location for this string.  Return -1 it hash table is full.
- *
- */
-
-static int FindHashLoc(AtomTable *atable, const char *s)
-{
-    int hashloc, hashdelta, count;
-    int FoundEmptySlot = 0;
-    int collision[HASH_TABLE_MAX_COLLISIONS + 1];
-
-    hashloc = HashString(s) % atable->htable.size;
-    if (!Empty(&atable->htable, hashloc)) {
-        if (Match(&atable->htable, &atable->stable, s, hashloc))
-            return hashloc;
-        collision[0] = hashloc;
-        hashdelta = HashString2(s);
-        count = 0;
-        while (count < HASH_TABLE_MAX_COLLISIONS) {
-            hashloc = ((hashloc + hashdelta) & 0x7fffffff) % atable->htable.size;
-            if (!Empty(&atable->htable, hashloc)) {
-                if (Match(&atable->htable, &atable->stable, s, hashloc)) {
-                    return hashloc;
-                }
-            } else {
-                FoundEmptySlot = 1;
-                break;
-            }
-            count++;
-            collision[count] = hashloc;
-        }
-
-        if (!FoundEmptySlot) {
-            if (cpp->options.DumpAtomTable) {
-                int ii;
-                char str[200];
-                snprintf(str, sizeof(str), "*** Hash failed with more than %d collisions. Must increase hash table size. ***",
-                       HASH_TABLE_MAX_COLLISIONS);
-                CPPShInfoLogMsg(str);
-
-                snprintf(str, sizeof(str), "*** New string \"%s\", hash=%04x, delta=%04x", s, collision[0], hashdelta);
-                CPPShInfoLogMsg(str);
-                for (ii = 0; ii <= HASH_TABLE_MAX_COLLISIONS; ii++) {
-                    snprintf(str, sizeof(str), "*** Collides on try %d at hash entry %04x with \"%s\"",
-                           ii + 1, collision[ii], GetAtomString(atable, atable->htable.entry[collision[ii]].value));
-                    CPPShInfoLogMsg(str);
-                }
-            }
-            return -1;
-        } else {
-            atable->htable.counts[count]++;
-        }
-    }
-    return hashloc;
-} // FindHashLoc
-
-/*
- * IncreaseHashTableSize()
- *
- */
-
-static int IncreaseHashTableSize(AtomTable *atable)
-{
-    int ii, strloc, oldhashloc, value, size;
-    AtomTable oldtable;
-    char *s;
-
-    // Save the old atom table and create a new one:
-
-    oldtable = *atable;
-    size = oldtable.htable.size*2 + 1;
-    if (!InitAtomTable(atable, size))
-        return 0;
-
-    // Add all the existing values to the new atom table preserving their atom values:
-
-    for (ii = atable->nextFree; ii < oldtable.nextFree; ii++) {
-        strloc = oldtable.amap[ii];
-        s = &oldtable.stable.strings[strloc];
-        oldhashloc = FindHashLoc(&oldtable, s);
-        assert(oldhashloc >= 0);
-        value = oldtable.htable.entry[oldhashloc].value;
-        AddAtomFixed(atable, s, value);
-    }
-    FreeAtomTable(&oldtable);
-    return 1;
-} // IncreaseHashTableSize
-
-/*
- * LookUpAddStringHash() - Lookup a string in the hash table.  If it's not there, add it and
- *        initialize the atom value in the hash table to 0.  Return the hash table index.
- */
-
-static int LookUpAddStringHash(AtomTable *atable, const char *s)
-{
-    int hashloc, strloc;
-
-    while(1) {
-        hashloc = FindHashLoc(atable, s);
-        if (hashloc >= 0)
-            break;
-        IncreaseHashTableSize(atable);
-    }
-
-    if (Empty(&atable->htable, hashloc)) {
-        atable->htable.entries++;
-        strloc = AddString(&atable->stable, s);
-        atable->htable.entry[hashloc].index = strloc;
-        atable->htable.entry[hashloc].value = 0;
-    }
-    return hashloc;
-} // LookUpAddStringHash
-
-/*
- * LookUpAddString() - Lookup a string in the hash table.  If it's not there, add it and
- *        initialize the atom value in the hash table to the next atom number.
- *        Return the atom value of string.
- */
-
-int LookUpAddString(AtomTable *atable, const char *s)
-{
-    int hashindex, atom;
-
-    hashindex = LookUpAddStringHash(atable, s);
-    atom = atable->htable.entry[hashindex].value;
-    if (atom == 0) {
-        atom = AllocateAtom(atable);
-        SetAtomValue(atable, atom, hashindex);
-    }
-    return atom;
-} // LookUpAddString
-
-/*
- * GetAtomString()
- *
- */
-
-const  char *GetAtomString(AtomTable *atable, int atom)
-{
-    int soffset;
-
-    if (atom > 0 && atom < atable->nextFree) {
-        soffset = atable->amap[atom];
-        if (soffset > 0 && soffset < atable->stable.nextFree) {
-            return &atable->stable.strings[soffset];
-        } else {
-            return "<internal error: bad soffset>";
-        }
-    } else {
-        if (atom == 0) {
-            return "<null atom>";
-        } else {
-            if (atom == EOF) {
-                return "<EOF>";
-            } else {
-                return "<invalid atom>";
-            }
-        }
-    }
-} // GetAtomString
-
-/*
- * GetReversedAtom()
- *
- */
-
-int GetReversedAtom(AtomTable *atable, int atom)
-{
-    if (atom > 0 && atom < atable->nextFree) {
-        return atable->arev[atom];
-    } else {
-        return 0;
-    }
-} // GetReversedAtom
-
-/*
- * AddAtom() - Add a string to the atom, hash and string tables if it isn't already there.
- *         Return it's atom index.
- */
-
-int AddAtom(AtomTable *atable, const char *s)
-{
-    int atom;
-
-    atom = LookUpAddString(atable, s);
-    return atom;
-} // AddAtom
-
-/*
- * AddAtomFixed() - Add an atom to the hash and string tables if it isn't already there.
- *         Assign it the atom value of "atom".
- */
-
-static int AddAtomFixed(AtomTable *atable, const char *s, int atom)
-{
-    int hashindex, lsize;
-
-    hashindex = LookUpAddStringHash(atable, s);
-    if (atable->nextFree >= atable->size || atom >= atable->size) {
-        lsize = atable->size*2;
-        if (lsize <= atom)
-            lsize = atom + 1;
-        GrowAtomTable(atable, lsize);
-    }
-    atable->amap[atom] = atable->htable.entry[hashindex].index;
-    atable->htable.entry[hashindex].value = atom;
-    //if (atom >= atable->nextFree)
-    //    atable->nextFree = atom + 1;
-    while (atom >= atable->nextFree) {
-        atable->arev[atable->nextFree] = lReverse(atable->nextFree);
-        atable->nextFree++;
-    }
-    return atom;
-} // AddAtomFixed
-
-/*
- * InitAtomTable() - Initialize the atom table.
- *
- */
-
-int InitAtomTable(AtomTable *atable, int htsize)
-{
-    unsigned int ii;
-
-    htsize = htsize <= 0 ? INIT_HASH_TABLE_SIZE : htsize;
-    if (!InitStringTable(&atable->stable))
-        return 0;
-    if (!InitHashTable(&atable->htable, htsize))
-        return 0;
-
-    atable->nextFree = 0;
-    atable->amap = NULL;
-    atable->size = 0;
-    GrowAtomTable(atable, INIT_ATOM_TABLE_SIZE);
-    if (!atable->amap)
-        return 0;
-
-    // Initialize lower part of atom table to "<undefined>" atom:
-
-    AddAtomFixed(atable, "<undefined>", 0);
-    for (ii = 0; ii < FIRST_USER_TOKEN_SY; ii++)
-        atable->amap[ii] = atable->amap[0];
-
-    // Add single character tokens to the atom table:
-
-    {
-		const char *s = "~!%^&*()-+=|,.<>/?;:[]{}#";
-        char t[2];
-
-        t[1] = '\0';
-        while (*s) {
-            t[0] = *s;
-            AddAtomFixed(atable, t, s[0]);
-            s++;
-        }
-    }
-
-    // Add multiple character scanner tokens :
-
-    for (ii = 0; ii < sizeof(tokens)/sizeof(tokens[0]); ii++)
-        AddAtomFixed(atable, tokens[ii].str, tokens[ii].val);
-
-    // Add error symbol if running in error mode:
-
-    if (cpp->options.ErrorMode)
-        AddAtomFixed(atable, "error", ERROR_SY);
-
-    AddAtom(atable, "<*** end fixed atoms ***>");
-
-    return 1;
-} // InitAtomTable
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////// Debug Printing Functions: //////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-/*
- * PrintAtomTable()
- *
- */
-
-void PrintAtomTable(AtomTable *atable)
-{
-    int ii;
-    char str[200];
-
-    for (ii = 0; ii < atable->nextFree; ii++) {
-        snprintf(str, sizeof(str), "%d: \"%s\"", ii, &atable->stable.strings[atable->amap[ii]]);
-        CPPDebugLogMsg(str);
-    }
-    snprintf(str, sizeof(str), "Hash table: size=%d, entries=%d, collisions=",
-           atable->htable.size, atable->htable.entries);
-    CPPDebugLogMsg(str);
-    for (ii = 0; ii < HASH_TABLE_MAX_COLLISIONS; ii++) {
-        snprintf(str, sizeof(str), " %d", atable->htable.counts[ii]);
-        CPPDebugLogMsg(str);
-    }
-
-} // PrintAtomTable
-
-
-/*
- * GetStringOfAtom()
- *
- */
-
-char* GetStringOfAtom(AtomTable *atable, int atom)
-{
-	 char* chr_str;
-	 chr_str=&atable->stable.strings[atable->amap[atom]];
-	 return chr_str;
-} // GetStringOfAtom
-
-/*
- * FreeAtomTable() - Free the atom table and associated memory
- *
- */
-
-void FreeAtomTable(AtomTable *atable)
-{
-    FreeStringTable(&atable->stable);
-    FreeHashTable(&atable->htable);
-    if (atable->amap)
-        free(atable->amap);
-    if (atable->arev)
-        free(atable->arev);
-    atable->amap = NULL;
-    atable->arev = NULL;
-    atable->nextFree = 0;
-    atable->size = 0;
-} // FreeAtomTable
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////// End of atom.c ///////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/atom.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/atom.h
deleted file mode 100644
index 1d84c32..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/atom.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms.  If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder. 
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-//
-// atom.h
-//
-
-#if !defined(__ATOM_H)
-#define __ATOM_H 1
-
-typedef struct AtomTable_Rec AtomTable;
-
-extern AtomTable *atable;
-
-int InitAtomTable(AtomTable *atable, int htsize);
-void FreeAtomTable(AtomTable *atable);
-int AddAtom(AtomTable *atable, const char *s);
-void PrintAtomTable(AtomTable *atable);
-int LookUpAddString(AtomTable *atable, const char *s);
-const char *GetAtomString(AtomTable *atable, int atom);
-int GetReversedAtom(AtomTable *atable, int atom);
-char* GetStringOfAtom(AtomTable *atable, int atom);
-#endif // !defined(__ATOM_H)
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/compile.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/compile.h
deleted file mode 100644
index 1180853..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/compile.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms.  If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder. 
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-//
-// compile.h
-//
-
-#if !defined(__COMPILE_H)
-#define __COMPILE_H 1
-
-int InitCPPStruct(void);
-
-typedef struct Options_Rec{
-    const char *profileString;
-    int ErrorMode;
-    int Quiet;
-	
-    // Debug The Compiler options:
-    int DumpAtomTable;
-} Options;
-
-#define MAX_IF_NESTING  64
-struct CPPStruct_Rec {
-    // Public members
-    SourceLoc *pLastSourceLoc;  // Set at the start of each statement by the tree walkers
-    Options options;            // Compile options and parameters
-
-    // Private members
-    SourceLoc lastSourceLoc;
-
-    // Scanner data:
-
-    SourceLoc *tokenLoc;        // Source location of most recent token seen by the scanner
-    int mostRecentToken;        // Most recent token seen by the scanner
-    InputSrc *currentInput;
-    int previous_token;
-    int pastFirstStatement;     // used to make sure that #version is the first statement seen in the file, if present
-    
-	void *pC;                   // storing the parseContext of the compile object in cpp.  
-     
-    // Private members:
-    SourceLoc ltokenLoc;
-	int ifdepth;                //current #if-#else-#endif nesting in the cpp.c file (pre-processor)    
-    int elsedepth[MAX_IF_NESTING];//Keep a track of #if depth..Max allowed is 64.
-    int elsetracker;            //#if-#else and #endif constructs...Counter.
-    const char *ErrMsg;
-    int CompileError;           //Indicate compile error when #error, #else,#elif mismatch.
-
-    //
-    // Globals used to communicate between PaParseStrings() and yy_input()and 
-    // also across the files.(gen_glslang.cpp and scanner.c)
-    //
-    int PaWhichStr;             // which string we're parsing
-    const int* PaStrLen;        // array of lengths of the PaArgv strings
-    int PaArgc;                 // count of strings in the array
-    const char* const* PaArgv;  // our array of strings to parse    
-    unsigned int tokensBeforeEOF : 1;
-};
-
-#endif // !defined(__COMPILE_H)
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.c b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.c
deleted file mode 100644
index 8a1076b..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.c
+++ /dev/null
@@ -1,1118 +0,0 @@
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms.  If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder. 
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-//
-// cpp.c
-//
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#include "common/angleutils.h"
-#include "compiler/preprocessor/slglobals.h"
-
-#if defined(_MSC_VER)
-#pragma warning(disable: 4054)
-#pragma warning(disable: 4152)
-#pragma warning(disable: 4706)
-#endif
-
-static int CPPif(yystypepp * yylvalpp);
-
-/* Don't use memory.c's replacements, as we clean up properly here */
-#undef malloc
-#undef free
-
-static int bindAtom = 0;
-static int constAtom = 0;
-static int defaultAtom = 0;
-static int defineAtom = 0;
-static int definedAtom = 0;
-static int elseAtom = 0;
-static int elifAtom = 0;
-static int endifAtom = 0;
-static int ifAtom = 0;
-static int ifdefAtom = 0;
-static int ifndefAtom = 0;
-static int includeAtom = 0;
-static int lineAtom = 0;
-static int pragmaAtom = 0;
-static int texunitAtom = 0;
-static int undefAtom = 0;
-static int errorAtom = 0;
-static int __LINE__Atom = 0;
-static int __FILE__Atom = 0;
-static int __VERSION__Atom = 0;
-static int versionAtom = 0;
-static int extensionAtom = 0;
-
-static Scope *macros = 0;
-#define MAX_MACRO_ARGS  64
-
-static SourceLoc ifloc; /* outermost #if */
-
-int InitCPP(void)
-{
-    char        buffer[64], *t;
-    const char  *f;
-
-    // Add various atoms needed by the CPP line scanner:
-    bindAtom = LookUpAddString(atable, "bind");
-    constAtom = LookUpAddString(atable, "const");
-    defaultAtom = LookUpAddString(atable, "default");
-    defineAtom = LookUpAddString(atable, "define");
-    definedAtom = LookUpAddString(atable, "defined");
-    elifAtom = LookUpAddString(atable, "elif");
-    elseAtom = LookUpAddString(atable, "else");
-    endifAtom = LookUpAddString(atable, "endif");
-    ifAtom = LookUpAddString(atable, "if");
-    ifdefAtom = LookUpAddString(atable, "ifdef");
-    ifndefAtom = LookUpAddString(atable, "ifndef");
-    includeAtom = LookUpAddString(atable, "include");
-    lineAtom = LookUpAddString(atable, "line");
-    pragmaAtom = LookUpAddString(atable, "pragma");
-    texunitAtom = LookUpAddString(atable, "texunit");
-    undefAtom = LookUpAddString(atable, "undef");
-	errorAtom = LookUpAddString(atable, "error");
-    __LINE__Atom = LookUpAddString(atable, "__LINE__");
-    __FILE__Atom = LookUpAddString(atable, "__FILE__");
-	__VERSION__Atom = LookUpAddString(atable, "__VERSION__");
-    versionAtom = LookUpAddString(atable, "version");
-    extensionAtom = LookUpAddString(atable, "extension");
-    macros = NewScopeInPool(mem_CreatePool(0, 0));
-    strcpy(buffer, "PROFILE_");
-    t = buffer + strlen(buffer);
-    f = cpp->options.profileString;
-    while ((isalnum(*f) || *f == '_') && t < buffer + sizeof(buffer) - 1)
-        *t++ = toupper(*f++);
-    *t = 0;
-
-    PredefineIntMacro("GL_ES", 1);
-    PredefineIntMacro("GL_FRAGMENT_PRECISION_HIGH", 1);
-
-	return 1;
-} // InitCPP
-
-int FreeCPP(void)
-{
-    if (macros)
-    {
-        mem_FreePool(macros->pool);
-        macros = 0;
-    }
-
-    return 1;
-}
-
-int FinalCPP(void)
-{
-	if (cpp->ifdepth)
-		CPPErrorToInfoLog("#if mismatch");
-    return 1;
-}
-
-static int CPPdefine(yystypepp * yylvalpp)
-{
-    int token, name, args[MAX_MACRO_ARGS], argc;
-    const char *message;
-    MacroSymbol mac;
-    Symbol *symb;
-    SourceLoc dummyLoc;
-    memset(&mac, 0, sizeof(mac));
-    token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-    if (token != CPP_IDENTIFIER) {
-        CPPErrorToInfoLog("#define");
-        return token;
-    }
-    name = yylvalpp->sc_ident;
-    token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-    if (token == '(' && !yylvalpp->sc_int) {
-        // gather arguments
-        argc = 0;
-        do {
-            token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-            if (argc == 0 && token == ')') break;
-            if (token != CPP_IDENTIFIER) {
-				CPPErrorToInfoLog("#define");
-                return token;
-            }
-            if (argc < MAX_MACRO_ARGS)
-                args[argc++] = yylvalpp->sc_ident;
-            token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-        } while (token == ',');
-        if (token != ')') {
-            CPPErrorToInfoLog("#define");
-            return token;
-        }
-        mac.argc = argc;
-        mac.args = mem_Alloc(macros->pool, argc * sizeof(int));
-        memcpy(mac.args, args, argc * sizeof(int));
-        token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-	}
-    mac.body = NewTokenStream(GetAtomString(atable, name), macros->pool);
-    while (token != '\n') {
-        if (token == '\\') {
-            CPPErrorToInfoLog("The line continuation character (\\) is not part of the OpenGL ES Shading Language");
-            return token;
-        } else if (token <= 0) { // EOF or error
-            CPPErrorToInfoLog("unexpected end of input in #define preprocessor directive - expected a newline");
-            return 0;
-        }
-        RecordToken(mac.body, token, yylvalpp);
-        token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-    };
-
-    symb = LookUpSymbol(macros, name);
-    if (symb) {
-        if (!symb->details.mac.undef) {
-            // already defined -- need to make sure they are identical
-            if (symb->details.mac.argc != mac.argc) goto error;
-            for (argc=0; argc < mac.argc; argc++)
-                if (symb->details.mac.args[argc] != mac.args[argc])
-                    goto error;
-            RewindTokenStream(symb->details.mac.body);
-            RewindTokenStream(mac.body);
-            do {
-                int old_lval, old_token;
-                old_token = ReadToken(symb->details.mac.body, yylvalpp);
-                old_lval = yylvalpp->sc_int;
-                token = ReadToken(mac.body, yylvalpp);
-                if (token != old_token || yylvalpp->sc_int != old_lval) { 
-                error:
-                    StoreStr("Macro Redefined");
-                    StoreStr(GetStringOfAtom(atable,name));
-                    message=GetStrfromTStr();
-                    DecLineNumber();
-                    CPPShInfoLogMsg(message);
-                    IncLineNumber();
-                    ResetTString();
-                    break; }
-            } while (token > 0);
-        }
-        //FreeMacro(&symb->details.mac);
-    } else {
-        dummyLoc.file = 0;
-        dummyLoc.line = 0;
-        symb = AddSymbol(&dummyLoc, macros, name, MACRO_S);
-    }
-    symb->details.mac = mac;
-    return '\n';
-} // CPPdefine
-
-static int CPPundef(yystypepp * yylvalpp)
-{
-    int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-    Symbol *symb;
-	if(token == '\n'){
-		CPPErrorToInfoLog("#undef");
-	    return token;
-    }
-    if (token != CPP_IDENTIFIER)
-          goto error;
-    symb = LookUpSymbol(macros, yylvalpp->sc_ident);
-    if (symb) {
-        symb->details.mac.undef = 1;
-    }
-    token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-    if (token != '\n') {
-    error:
-        CPPErrorToInfoLog("#undef");
-    }
-    return token;
-} // CPPundef
-
-/* CPPelse -- skip forward to appropriate spot.  This is actually used
-** to skip to and #endif after seeing an #else, AND to skip to a #else,
-** #elif, or #endif after a #if/#ifdef/#ifndef/#elif test was false
-*/
-
-static int CPPelse(int matchelse, yystypepp * yylvalpp)
-{
-    int atom,depth=0;
-    int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-	
-	while (token > 0) {
-        if (token != '#') {
-            while (token != '\n') {
-                token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-                if (token <= 0) { // EOF or error
-                    CPPErrorToInfoLog("unexpected end of input in #else preprocessor directive - expected a newline");
-                    return 0;
-                }
-            }
-            token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-            continue;
-        }
-		if ((token = cpp->currentInput->scan(cpp->currentInput, yylvalpp)) != CPP_IDENTIFIER)
-			continue;
-        atom = yylvalpp->sc_ident;
-        if (atom == ifAtom || atom == ifdefAtom || atom == ifndefAtom){
-            depth++; cpp->ifdepth++; cpp->elsetracker++;
-            if (cpp->ifdepth > MAX_IF_NESTING) {
-                CPPErrorToInfoLog("max #if nesting depth exceeded");
-                cpp->CompileError = 1;
-                return 0;
-            }
-            // sanity check elsetracker
-            if (cpp->elsetracker < 0 || cpp->elsetracker >= MAX_IF_NESTING) {
-                CPPErrorToInfoLog("mismatched #if/#endif statements");
-                cpp->CompileError = 1;
-                return 0;
-            }
-            cpp->elsedepth[cpp->elsetracker] = 0;
-        }
-        else if (atom == endifAtom) {
-            if(--depth<0){
-                if (cpp->elsetracker)
-                    --cpp->elsetracker;
-                if (cpp->ifdepth) 
-                    --cpp->ifdepth;
-                break;
-            }             
-            --cpp->elsetracker;
-            --cpp->ifdepth;
-        }
-        else if (((int)(matchelse) != 0)&& depth==0) {
-			if (atom == elseAtom ) {
-                token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-                if (token != '\n') {
-                    CPPWarningToInfoLog("unexpected tokens following #else preprocessor directive - expected a newline");
-                    while (token != '\n') {
-                        token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-                        if (token <= 0) { // EOF or error
-                            CPPErrorToInfoLog("unexpected end of input following #else preprocessor directive - expected a newline");
-                            return 0;
-                        }
-                    }
-                } 
-				break;
-			} 
-			else if (atom == elifAtom) {
-                /* we decrement cpp->ifdepth here, because CPPif will increment
-                 * it and we really want to leave it alone */
-				if (cpp->ifdepth){
-					--cpp->ifdepth;
-				    --cpp->elsetracker;
-				}
-                return CPPif(yylvalpp);
-            }
-		}
-        else if((atom==elseAtom) && (!ChkCorrectElseNesting())){
-            CPPErrorToInfoLog("#else after a #else");
-            cpp->CompileError=1;
-            return 0;
-        }
-	};
-    return token;
-}
-
-enum eval_prec {
-    MIN_PREC,
-    COND, LOGOR, LOGAND, OR, XOR, AND, EQUAL, RELATION, SHIFT, ADD, MUL, UNARY,
-    MAX_PREC
-};
-
-static int op_logor(int a, int b) { return a || b; }
-static int op_logand(int a, int b) { return a && b; }
-static int op_or(int a, int b) { return a | b; }
-static int op_xor(int a, int b) { return a ^ b; }
-static int op_and(int a, int b) { return a & b; }
-static int op_eq(int a, int b) { return a == b; }
-static int op_ne(int a, int b) { return a != b; }
-static int op_ge(int a, int b) { return a >= b; }
-static int op_le(int a, int b) { return a <= b; }
-static int op_gt(int a, int b) { return a > b; }
-static int op_lt(int a, int b) { return a < b; }
-static int op_shl(int a, int b) { return a << b; }
-static int op_shr(int a, int b) { return a >> b; }
-static int op_add(int a, int b) { return a + b; }
-static int op_sub(int a, int b) { return a - b; }
-static int op_mul(int a, int b) { return a * b; }
-static int op_div(int a, int b) { return a / b; }
-static int op_mod(int a, int b) { return a % b; }
-static int op_pos(int a) { return a; }
-static int op_neg(int a) { return -a; }
-static int op_cmpl(int a) { return ~a; }
-static int op_not(int a) { return !a; }
-
-struct {
-    int token, prec, (*op)(int, int);
-} binop[] = {
-    { CPP_OR_OP, LOGOR, op_logor },
-    { CPP_AND_OP, LOGAND, op_logand },
-    { '|', OR, op_or },
-    { '^', XOR, op_xor },
-    { '&', AND, op_and },
-    { CPP_EQ_OP, EQUAL, op_eq },
-    { CPP_NE_OP, EQUAL, op_ne },
-    { '>', RELATION, op_gt },
-    { CPP_GE_OP, RELATION, op_ge },
-    { '<', RELATION, op_lt },
-    { CPP_LE_OP, RELATION, op_le },
-    { CPP_LEFT_OP, SHIFT, op_shl },
-    { CPP_RIGHT_OP, SHIFT, op_shr },
-    { '+', ADD, op_add },
-    { '-', ADD, op_sub },
-    { '*', MUL, op_mul },
-    { '/', MUL, op_div },
-    { '%', MUL, op_mod },
-};
-
-struct {
-    int token, (*op)(int);
-} unop[] = {
-    { '+', op_pos },
-    { '-', op_neg },
-    { '~', op_cmpl },
-    { '!', op_not },
-};
-
-#define ALEN(A) (sizeof(A)/sizeof(A[0]))
-
-static int eval(int token, int prec, int *res, int *err, yystypepp * yylvalpp)
-{
-    int         i, val;
-    Symbol      *s;
-    if (token == CPP_IDENTIFIER) {
-        if (yylvalpp->sc_ident == definedAtom) {
-            int needclose = 0;
-            token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-            if (token == '(') {
-                needclose = 1;
-                token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-            }
-            if (token != CPP_IDENTIFIER)
-                goto error;
-            *res = (s = LookUpSymbol(macros, yylvalpp->sc_ident))
-                        ? !s->details.mac.undef : 0;
-            token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-            if (needclose) {
-                if (token != ')')
-                    goto error;
-                token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-            }
-		} else if (MacroExpand(yylvalpp->sc_ident, yylvalpp)) {
-			token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-            return eval(token, prec, res, err, yylvalpp);
-        } else {
-            goto error;
-        }
-	} else if (token == CPP_INTCONSTANT) {
-        *res = yylvalpp->sc_int;
-        token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-    } else if (token == '(') {
-        token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-        token = eval(token, MIN_PREC, res, err, yylvalpp);
-        if (!*err) {
-            if (token != ')')
-                goto error;
-            token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-        }
-    } else {
-        for (i = ALEN(unop) - 1; i >= 0; i--) {
-            if (unop[i].token == token)
-                break;
-        }
-        if (i >= 0) {
-            token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-            token = eval(token, UNARY, res, err, yylvalpp);
-            *res = unop[i].op(*res);
-        } else {
-            goto error;
-        }
-    }
-    while (!*err) {
-        if (token == ')' || token == '\n') break;
-        for (i = ALEN(binop) - 1; i >= 0; i--) {
-            if (binop[i].token == token)
-                break;
-        }
-        if (i < 0 || binop[i].prec <= prec)
-            break;
-        val = *res;
-        token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-        token = eval(token, binop[i].prec, res, err, yylvalpp);
-        
-        if (binop[i].op == op_div || binop[i].op == op_mod)
-        {
-            if (*res == 0)
-            {
-                CPPErrorToInfoLog("preprocessor divide or modulo by zero");
-                *err = 1;
-                return token;
-            }
-        }
-
-        *res = binop[i].op(val, *res);
-    }
-    return token;
-error:
-    CPPErrorToInfoLog("incorrect preprocessor directive");
-    *err = 1;
-    *res = 0;
-    return token;
-} // eval
-
-static int CPPif(yystypepp * yylvalpp) {
-    int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-    int res = 0, err = 0;
-
-    if (!cpp->ifdepth++)
-        ifloc = *cpp->tokenLoc;
-    if(cpp->ifdepth > MAX_IF_NESTING){
-        CPPErrorToInfoLog("max #if nesting depth exceeded");
-        cpp->CompileError = 1;
-        return 0;
-    }
-    cpp->elsetracker++;
-    // sanity check elsetracker
-    if (cpp->elsetracker < 0 || cpp->elsetracker >= MAX_IF_NESTING) {
-        CPPErrorToInfoLog("mismatched #if/#endif statements");
-        cpp->CompileError = 1;
-        return 0;
-    }
-    cpp->elsedepth[cpp->elsetracker] = 0;
-
-    token = eval(token, MIN_PREC, &res, &err, yylvalpp);
-    if (token != '\n') {
-        CPPWarningToInfoLog("unexpected tokens following #if preprocessor directive - expected a newline");
-        while (token != '\n') {
-            token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-            if (token <= 0) { // EOF or error
-                CPPErrorToInfoLog("unexpected end of input in #if preprocessor directive - expected a newline");
-                return 0;
-            }
-        }
-    } 
-    if (!res && !err) {
-        token = CPPelse(1, yylvalpp);
-    }
-
-    return token;
-} // CPPif
-
-static int CPPifdef(int defined, yystypepp * yylvalpp)
-{
-    int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-    int name = yylvalpp->sc_ident;
-    if(++cpp->ifdepth > MAX_IF_NESTING){
-        CPPErrorToInfoLog("max #if nesting depth exceeded");
-        cpp->CompileError = 1;
-        return 0;
-    }
-    cpp->elsetracker++;
-    // sanity check elsetracker
-    if (cpp->elsetracker < 0 || cpp->elsetracker >= MAX_IF_NESTING) {
-        CPPErrorToInfoLog("mismatched #if/#endif statements");
-        cpp->CompileError = 1;
-        return 0;
-    }
-    cpp->elsedepth[cpp->elsetracker] = 0;
-
-    if (token != CPP_IDENTIFIER) {
-            defined ? CPPErrorToInfoLog("ifdef"):CPPErrorToInfoLog("ifndef");
-    } else {
-        Symbol *s = LookUpSymbol(macros, name);
-        token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-        if (token != '\n') {
-            CPPWarningToInfoLog("unexpected tokens following #ifdef preprocessor directive - expected a newline");
-            while (token != '\n') {
-                token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-                if (token <= 0) { // EOF or error
-                    CPPErrorToInfoLog("unexpected end of input in #ifdef preprocessor directive - expected a newline");
-                    return 0;
-                }
-            }
-        }
-        if (((s && !s->details.mac.undef) ? 1 : 0) != defined)
-            token = CPPelse(1, yylvalpp);
-    }
-    return token;
-} // CPPifdef
-
-static int CPPline(yystypepp * yylvalpp) 
-{
-    int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-	if(token=='\n'){
-		DecLineNumber();
-        CPPErrorToInfoLog("#line");
-        IncLineNumber();
-		return token;
-	}
-	else if (token == CPP_INTCONSTANT) {
-		yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
-		SetLineNumber(yylvalpp->sc_int);
-        token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-        
-		if (token == CPP_INTCONSTANT) {
-            yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
-			SetStringNumber(yylvalpp->sc_int);
-            token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-			if(token!='\n')
-				CPPErrorToInfoLog("#line");
-        }
-		else if (token == '\n'){
-			return token;
-		}
-		else{
-            CPPErrorToInfoLog("#line");
-		}
-	}
-	else{
-          CPPErrorToInfoLog("#line");
-	}
-    return token;
-}
-
-static int CPPerror(yystypepp * yylvalpp) {
-
-	int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-    const char *message;
-	
-    while (token != '\n') {
-        if (token <= 0){
-            CPPErrorToInfoLog("unexpected end of input in #error preprocessor directive - expected a newline");
-            return 0;
-        }else if (token == CPP_FLOATCONSTANT || token == CPP_INTCONSTANT){
-            StoreStr(yylvalpp->symbol_name);
-		}else if(token == CPP_IDENTIFIER || token == CPP_STRCONSTANT){
-			StoreStr(GetStringOfAtom(atable,yylvalpp->sc_ident));
-		}else {
-		    StoreStr(GetStringOfAtom(atable,token));
-		}
-		token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-	}
-	DecLineNumber();
-	//store this msg into the shader's information log..set the Compile Error flag!!!!
-	message=GetStrfromTStr();
-    CPPShInfoLogMsg(message);
-    ResetTString();
-    cpp->CompileError=1;
-    IncLineNumber();
-    return '\n';
-}//CPPerror
-
-static int CPPpragma(yystypepp * yylvalpp)
-{
-	char SrcStrName[2];
-	char** allTokens;
-	int tokenCount = 0;
-	int maxTokenCount = 10;
-	const char* SrcStr;
-	int i;
-
-	int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-	
-	if (token=='\n') {
-		DecLineNumber();
-        CPPErrorToInfoLog("#pragma");
-        IncLineNumber();
-	    return token;
-	}
-	
-	allTokens = (char**)malloc(sizeof(char*) * maxTokenCount);	
-
-	while (token != '\n') {
-		if (tokenCount >= maxTokenCount) {
-			maxTokenCount *= 2;
-			allTokens = (char**)realloc((char**)allTokens, sizeof(char*) * maxTokenCount);
-		}
-		switch (token) {
-		case CPP_IDENTIFIER:
-			SrcStr = GetAtomString(atable, yylvalpp->sc_ident);
-			allTokens[tokenCount] = (char*)malloc(strlen(SrcStr) + 1);
-			strcpy(allTokens[tokenCount++], SrcStr);
-			break;
-		case CPP_INTCONSTANT:
-			SrcStr = yylvalpp->symbol_name;
-			allTokens[tokenCount] = (char*)malloc(strlen(SrcStr) + 1);
-			strcpy(allTokens[tokenCount++], SrcStr);
-			break;
-		case CPP_FLOATCONSTANT:
-			SrcStr = yylvalpp->symbol_name;
-			allTokens[tokenCount] = (char*)malloc(strlen(SrcStr) + 1);
-			strcpy(allTokens[tokenCount++], SrcStr);
-			break;
-		case -1:
-            // EOF
-            CPPShInfoLogMsg("#pragma directive must end with a newline");			
-			goto freeMemoryAndReturnToken;
-		default:
-			SrcStrName[0] = token;
-			SrcStrName[1] = '\0';
-			allTokens[tokenCount] = (char*)malloc(2);
-			strcpy(allTokens[tokenCount++], SrcStrName);
-		}
-		token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-	}
-
-	HandlePragma((const char**)allTokens, tokenCount);
-	
-freeMemoryAndReturnToken:
-	for (i = 0; i < tokenCount; ++i) {
-		free (allTokens[i]);
-	}
-	free (allTokens);	
-
-	return token;    
-} // CPPpragma
-
-#define ESSL_VERSION_NUMBER 100
-#define ESSL_VERSION_STRING "100"
-
-static int CPPversion(yystypepp * yylvalpp)
-{
-
-    int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-
-    if (cpp->pastFirstStatement == 1)
-        CPPShInfoLogMsg("#version must occur before any other statement in the program");
-
-    if(token=='\n'){
-		DecLineNumber();
-        CPPErrorToInfoLog("#version");
-        IncLineNumber();
-		return token;
-	}
-    if (token != CPP_INTCONSTANT)
-        CPPErrorToInfoLog("#version");
-	
-    yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
-	//SetVersionNumber(yylvalpp->sc_int);
-    
-    if (yylvalpp->sc_int != ESSL_VERSION_NUMBER)
-        CPPShInfoLogMsg("Version number not supported by ESSL");
-
-    token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-    
-	if (token == '\n'){
-		return token;
-	}
-	else{
-        CPPErrorToInfoLog("#version");
-	}
-    return token;
-} // CPPversion
-
-static int CPPextension(yystypepp * yylvalpp)
-{
-
-    int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-    char extensionName[MAX_SYMBOL_NAME_LEN + 1];
-
-    if(token=='\n'){
-		DecLineNumber();
-        CPPShInfoLogMsg("extension name not specified");
-        IncLineNumber();
-		return token;
-	}
-
-    if (token != CPP_IDENTIFIER)
-        CPPErrorToInfoLog("#extension");
-    
-    strncpy(extensionName, GetAtomString(atable, yylvalpp->sc_ident), MAX_SYMBOL_NAME_LEN);
-    extensionName[MAX_SYMBOL_NAME_LEN] = '\0';
-	    
-    token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-    if (token != ':') {
-        CPPShInfoLogMsg("':' missing after extension name");
-        return token;
-    }
-    
-    token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-    if (token != CPP_IDENTIFIER) {
-        CPPShInfoLogMsg("behavior for extension not specified");
-        return token;
-    }
-
-    updateExtensionBehavior(extensionName, GetAtomString(atable, yylvalpp->sc_ident));
-
-    token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-	if (token == '\n'){
-		return token;
-	}
-	else{
-        CPPErrorToInfoLog("#extension");
-	}
-    return token;
-} // CPPextension
-
-int readCPPline(yystypepp * yylvalpp)
-{
-    int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-    const char *message;
-
-    if (token == CPP_IDENTIFIER) {
-        if (yylvalpp->sc_ident == defineAtom) {
-             token = CPPdefine(yylvalpp);
-        } else if (yylvalpp->sc_ident == elseAtom) {
-			 if(ChkCorrectElseNesting()){
-                 if (!cpp->ifdepth ){
-                     CPPErrorToInfoLog("#else mismatch");
-                     cpp->CompileError=1;
-                     return 0;
-                 }
-                 token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-                 if (token != '\n') {
-                     CPPWarningToInfoLog("unexpected tokens following #else preprocessor directive - expected a newline");
-                     while (token != '\n') {
-                         token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-                         if (token <= 0) { // EOF or error
-                             CPPErrorToInfoLog("unexpected end of input in #ifdef preprocessor directive - expected a newline");
-                             return 0;
-                         }
-                     }
-                 }
-			     token = CPPelse(0, yylvalpp);
-             }else{
-                 CPPErrorToInfoLog("#else after a #else");
-                 cpp->ifdepth = 0;
-                 cpp->elsetracker = 0;
-                 cpp->pastFirstStatement = 1;
-                 cpp->CompileError = 1;
-                 return 0;
-             }
-		} else if (yylvalpp->sc_ident == elifAtom) {
-            if (!cpp->ifdepth){
-                 CPPErrorToInfoLog("#elif mismatch");
-                 cpp->CompileError=1;
-                 return 0;
-            } 
-            // this token is really a dont care, but we still need to eat the tokens
-            token = cpp->currentInput->scan(cpp->currentInput, yylvalpp); 
-            while (token != '\n') {
-                token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-                if (token <= 0) { // EOF or error
-                    CPPErrorToInfoLog("unexpect tokens following #elif preprocessor directive - expected a newline");
-                    cpp->CompileError = 1;
-                    return 0;
-                }
-            }
-		    token = CPPelse(0, yylvalpp);
-        } else if (yylvalpp->sc_ident == endifAtom) {
-             if (!cpp->ifdepth){
-                 CPPErrorToInfoLog("#endif mismatch");
-                 cpp->CompileError=1;
-                 return 0;
-             }
-             else
-                 --cpp->ifdepth;
-
-             if (cpp->elsetracker)
-                 --cpp->elsetracker;
-
-	    } else if (yylvalpp->sc_ident == ifAtom) {
-             token = CPPif(yylvalpp);
-        } else if (yylvalpp->sc_ident == ifdefAtom) {
-             token = CPPifdef(1, yylvalpp);
-        } else if (yylvalpp->sc_ident == ifndefAtom) {
-             token = CPPifdef(0, yylvalpp);
-        } else if (yylvalpp->sc_ident == lineAtom) {
-             token = CPPline(yylvalpp);
-        } else if (yylvalpp->sc_ident == pragmaAtom) {
-             token = CPPpragma(yylvalpp);
-        } else if (yylvalpp->sc_ident == undefAtom) {
-             token = CPPundef(yylvalpp);
-        } else if (yylvalpp->sc_ident == errorAtom) {
-             token = CPPerror(yylvalpp);
-        } else if (yylvalpp->sc_ident == versionAtom) {
-            token = CPPversion(yylvalpp);
-        } else if (yylvalpp->sc_ident == extensionAtom) {
-            token = CPPextension(yylvalpp);
-        } else {
-            StoreStr("Invalid Directive");
-            StoreStr(GetStringOfAtom(atable,yylvalpp->sc_ident));
-            message=GetStrfromTStr();
-            CPPShInfoLogMsg(message);
-            ResetTString();
-        }
-    }
-    while (token != '\n' && token != 0 && token != EOF) {
-		token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-	}
-        
-    cpp->pastFirstStatement = 1;
-
-    return token;
-} // readCPPline
-
-void FreeMacro(MacroSymbol *s) {
-    DeleteTokenStream(s->body);
-}
-
-void PredefineIntMacro(const char *name, int value) {
-    SourceLoc location = {0, 0};
-    Symbol *symbol = NULL;
-    MacroSymbol macro = {0, NULL, NULL, 0, 0};
-    yystypepp val = {0, 0.0, 0, {0}};
-    int atom = 0;
-
-    macro.body = NewTokenStream(name, macros->pool);
-    val.sc_int = value;
-    snprintf(val.symbol_name, MAX_SYMBOL_NAME_LEN+1, "%d", value);
-    RecordToken(macro.body, CPP_INTCONSTANT, &val);
-    atom = LookUpAddString(atable, name);
-    symbol = AddSymbol(&location, macros, atom, MACRO_S);
-    symbol->details.mac = macro;
-}
-
-static int eof_scan(InputSrc *in, yystypepp * yylvalpp) { return -1; }
-static void noop(InputSrc *in, int ch, yystypepp * yylvalpp) { }
-
-static void PushEofSrc() {
-    InputSrc *in = malloc(sizeof(InputSrc));
-    memset(in, 0, sizeof(InputSrc));
-    in->scan = eof_scan;
-    in->getch = eof_scan;
-    in->ungetch = noop;
-    in->prev = cpp->currentInput;
-    cpp->currentInput = in;
-}
-
-static void PopEofSrc() {
-    if (cpp->currentInput->scan == eof_scan) {
-        InputSrc *in = cpp->currentInput;
-        cpp->currentInput = in->prev;
-        free(in);
-    }
-}
-
-static TokenStream *PrescanMacroArg(TokenStream *a, yystypepp * yylvalpp) {
-    int token;
-    TokenStream *n;
-    RewindTokenStream(a);
-    do {
-        token = ReadToken(a, yylvalpp);
-        if (token == CPP_IDENTIFIER && LookUpSymbol(macros, yylvalpp->sc_ident))
-            break;
-    } while (token > 0);
-    if (token <= 0) return a;
-    n = NewTokenStream("macro arg", 0);
-    PushEofSrc();
-    ReadFromTokenStream(a, 0, 0);
-    while ((token = cpp->currentInput->scan(cpp->currentInput, yylvalpp)) > 0) {
-        if (token == CPP_IDENTIFIER && MacroExpand(yylvalpp->sc_ident, yylvalpp))
-            continue;
-        RecordToken(n, token, yylvalpp);
-    }
-    PopEofSrc();
-    DeleteTokenStream(a);
-    return n;
-} // PrescanMacroArg
-
-typedef struct MacroInputSrc {
-    InputSrc    base;
-    MacroSymbol *mac;
-    TokenStream **args;
-} MacroInputSrc;
-
-/* macro_scan ---
-** return the next token for a macro expanion, handling macro args 
-*/
-static int macro_scan(MacroInputSrc *in, yystypepp * yylvalpp) {
-    int i;
-    int token = ReadToken(in->mac->body, yylvalpp);
-    if (token == CPP_IDENTIFIER) {
-        for (i = in->mac->argc-1; i>=0; i--)
-            if (in->mac->args[i] == yylvalpp->sc_ident) break;
-        if (i >= 0) {
-            ReadFromTokenStream(in->args[i], yylvalpp->sc_ident, 0);
-            return cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-        }
-    }
-    if (token > 0) return token;
-    in->mac->busy = 0;
-    cpp->currentInput = in->base.prev;
-    if (in->args) {
-        for (i=in->mac->argc-1; i>=0; i--)
-            DeleteTokenStream(in->args[i]);
-        free(in->args);
-    }
-    free(in);
-    return cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-} // macro_scan
-
-/* MacroExpand
-** check an identifier (atom) to see if it a macro that should be expanded.
-** If it is, push an InputSrc that will produce the appropriate expansion
-** and return TRUE.  If not, return FALSE.
-*/
-
-int MacroExpand(int atom, yystypepp * yylvalpp)
-{
-    Symbol              *sym = LookUpSymbol(macros, atom);
-    MacroInputSrc       *in;
-    int i,j, token, depth=0;
-    const char *message;
-	if (atom == __LINE__Atom) {
-        yylvalpp->sc_int = GetLineNumber();
-        snprintf(yylvalpp->symbol_name, MAX_SYMBOL_NAME_LEN+1, "%d", yylvalpp->sc_int);
-        UngetToken(CPP_INTCONSTANT, yylvalpp);
-        return 1;
-    }
-    if (atom == __FILE__Atom) {
-        yylvalpp->sc_int = GetStringNumber();
-        snprintf(yylvalpp->symbol_name, MAX_SYMBOL_NAME_LEN+1, "%d", yylvalpp->sc_int);
-        UngetToken(CPP_INTCONSTANT, yylvalpp);
-        return 1;
-    }
-	if (atom == __VERSION__Atom) {
-        strcpy(yylvalpp->symbol_name,ESSL_VERSION_STRING);
-        yylvalpp->sc_int = atoi(yylvalpp->symbol_name);
-        UngetToken(CPP_INTCONSTANT, yylvalpp);
-        return 1;
-    }
-    if (!sym || sym->details.mac.undef) return 0;
-    if (sym->details.mac.busy) return 0;        // no recursive expansions
-    in = malloc(sizeof(*in));
-    memset(in, 0, sizeof(*in));
-    in->base.scan = (void *)macro_scan;
-    in->base.line = cpp->currentInput->line;
-    in->base.name = cpp->currentInput->name;
-    in->mac = &sym->details.mac;
-    if (sym->details.mac.args) {
-        token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-		if (token != '(') {
-            UngetToken(token, yylvalpp);
-            yylvalpp->sc_ident = atom;
-            return 0;
-        }
-        in->args = malloc(in->mac->argc * sizeof(TokenStream *));
-        for (i=0; i<in->mac->argc; i++)
-            in->args[i] = NewTokenStream("macro arg", 0);
-		i=0;j=0;
-        do{
-            depth = 0;
-			while(1) {
-                token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-                if (token <= 0) {
-                    StoreStr("EOF in Macro ");
-                    StoreStr(GetStringOfAtom(atable,atom));
-                    message=GetStrfromTStr();
-                    CPPShInfoLogMsg(message);
-                    ResetTString();
-                    return 1;
-                }
-                if((in->mac->argc==0) && (token!=')')) break;
-                if (depth == 0 && (token == ',' || token == ')')) break;
-                if (token == '(') depth++;
-                if (token == ')') depth--;
-                RecordToken(in->args[i], token, yylvalpp);
-                j=1;
-			}
-            if (token == ')') {
-                if((in->mac->argc==1) &&j==0)
-                    break;
-                i++;
-                break;
-            }
-            i++;
-		}while(i < in->mac->argc);
-
-        if (i < in->mac->argc) {
-            StoreStr("Too few args in Macro ");
-            StoreStr(GetStringOfAtom(atable,atom));
-            message=GetStrfromTStr();
-            CPPShInfoLogMsg(message);
-            ResetTString();
-        } else if (token != ')') {
-            depth=0;
-			while (token >= 0 && (depth > 0 || token != ')')) {
-                if (token == ')') depth--;
-                token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-                if (token == '(') depth++;
-            }
-			
-            if (token <= 0) {
-                StoreStr("EOF in Macro ");
-                StoreStr(GetStringOfAtom(atable,atom));
-                message=GetStrfromTStr();
-                CPPShInfoLogMsg(message);
-                ResetTString();
-                return 1;
-            }
-            StoreStr("Too many args in Macro ");
-            StoreStr(GetStringOfAtom(atable,atom));
-            message=GetStrfromTStr();
-            CPPShInfoLogMsg(message);
-            ResetTString();
-		}
-		for (i=0; i<in->mac->argc; i++) {
-            in->args[i] = PrescanMacroArg(in->args[i], yylvalpp);
-        }
-    }
-#if 0
-    printf("  <%s:%d>found macro %s\n", GetAtomString(atable, loc.file),
-           loc.line, GetAtomString(atable, atom));
-    for (i=0; i<in->mac->argc; i++) {
-        printf("\targ %s = '", GetAtomString(atable, in->mac->args[i]));
-        DumpTokenStream(stdout, in->args[i]);
-        printf("'\n");
-    }
-#endif
-	/*retain the input source*/
-    in->base.prev = cpp->currentInput;
-    sym->details.mac.busy = 1;
-    RewindTokenStream(sym->details.mac.body);
-    cpp->currentInput = &in->base;
-    return 1;
-} // MacroExpand
-
-int ChkCorrectElseNesting(void)
-{
-    // sanity check to make sure elsetracker is in a valid range
-    if (cpp->elsetracker < 0 || cpp->elsetracker >= MAX_IF_NESTING) {
-        return 0;
-    }
-
-    if (cpp->elsedepth[cpp->elsetracker] == 0) {
-        cpp->elsedepth[cpp->elsetracker] = 1;
-        return 1;
-    }
-    return 0;
-}
-
-
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.h
deleted file mode 100644
index 802e23e..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms.  If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder. 
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-//
-// cpp.h
-//
-
-#if !defined(__CPP_H)
-#define __CPP_H 1
-
-#include "compiler/preprocessor/parser.h"
-#include "compiler/preprocessor/tokens.h"
-
-int InitCPP(void);
-int FinalCPP(void);
-int  readCPPline(yystypepp * yylvalpp);
-int MacroExpand(int atom, yystypepp * yylvalpp);
-int ChkCorrectElseNesting(void);
-
-typedef struct MacroSymbol {
-    int argc;
-    int *args;
-    TokenStream *body;
-    unsigned busy:1;
-    unsigned undef:1;
-} MacroSymbol;
-
-void FreeMacro(MacroSymbol *);
-void PredefineIntMacro(const char *name, int value);
-
-void  CPPDebugLogMsg(const char *msg);      // Prints information into debug log
-void  CPPShInfoLogMsg(const char*);         // Store cpp Err Msg into Sh.Info.Log
-void  CPPWarningToInfoLog(const char *msg); // Prints warning messages into info log
-void  HandlePragma(const char**, int numTokens);  // #pragma directive container.
-void  ResetTString(void);                   // #error Message as TString.
-void  CPPErrorToInfoLog(const char*);       // Stick all cpp errors into Sh.Info.log.
-void  StoreStr(const char*);                // Store the TString in Parse Context.
-void  SetLineNumber(int);                   // Set line number.  
-void  SetStringNumber(int);                 // Set string number.    
-int   GetLineNumber(void);                  // Get the current String Number. 
-int   GetStringNumber(void);                // Get the current String Number. 
-const char* GetStrfromTStr(void);           // Convert TString to String.  
-void  updateExtensionBehavior(const char* extName, const char* behavior);
-int   FreeCPP(void);
-
-#endif // !(defined(__CPP_H)
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cppstruct.c b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cppstruct.c
deleted file mode 100644
index 58cff31..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/cppstruct.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms.  If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder. 
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-//
-// cppstruct.c
-//
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "compiler/preprocessor/slglobals.h"
-
-CPPStruct  *cpp      = NULL;
-static int  refCount = 0;
-
-int InitPreprocessor(void);
-int ResetPreprocessor(void);
-int FreeCPPStruct(void);
-int FinalizePreprocessor(void);
-
-/*
- * InitCPPStruct() - Initilaize the CPP structure.
- *
- */
-
-int InitCPPStruct(void)
-{
-    int len;
-    char *p;
-
-    cpp = (CPPStruct *) malloc(sizeof(CPPStruct));
-    if (cpp == NULL)
-        return 0;
-
-    refCount++;
-
-    // Initialize public members:
-    cpp->pLastSourceLoc = &cpp->lastSourceLoc;
-    
-	p = (char *) &cpp->options;
-    len = sizeof(cpp->options);
-    while (--len >= 0)
-        p[len] = 0;
-     
-    ResetPreprocessor();
-    return 1;
-} // InitCPPStruct
-
-int ResetPreprocessor(void)
-{
-    // Initialize private members:
-
-    cpp->lastSourceLoc.file = 0;
-    cpp->lastSourceLoc.line = 0;
-    cpp->pC = 0;
-    cpp->CompileError = 0;
-    cpp->ifdepth = 0;
-    for(cpp->elsetracker = 0; cpp->elsetracker < MAX_IF_NESTING; cpp->elsetracker++)
-        cpp->elsedepth[cpp->elsetracker] = 0;
-    cpp->elsetracker = 0;
-    cpp->tokensBeforeEOF = 0;
-    return 1;
-}
-
-//Intializing the Preprocessor.
-
-int InitPreprocessor(void)
-{
-   #  define CPP_STUFF true
-        #  ifdef CPP_STUFF
-            FreeCPPStruct();
-            InitCPPStruct();
-            cpp->options.Quiet = 1;
-            cpp->options.profileString = "generic";
-            if (!InitAtomTable(atable, 0))
-                return 1;
-            if (!InitScanner(cpp))
-	            return 1;
-       #  endif
-  return 0; 
-}
-
-//FreeCPPStruct() - Free the CPP structure.
-
-int FreeCPPStruct(void)
-{
-    if (refCount)
-    {
-       free(cpp);
-       refCount--;
-    }
-    
-    return 1;
-}
-
-//Finalizing the Preprocessor.
-
-int FinalizePreprocessor(void)
-{
-   #  define CPP_STUFF true
-        #  ifdef CPP_STUFF
-            FreeAtomTable(atable);
-            FreeCPPStruct();
-            FreeScanner();
-       #  endif
-  return 0; 
-}
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////// End of cppstruct.c //////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/generate_parser.sh b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/generate_parser.sh
similarity index 100%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/generate_parser.sh
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/generate_parser.sh
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.c b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.c
deleted file mode 100644
index 029521a..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms.  If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder. 
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-//
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifndef _MSC_VER
-#include <stdint.h>
-#endif
-
-#include "compiler/preprocessor/memory.h"
-
-#if defined(_MSC_VER)
-#pragma warning(disable: 4706)
-#endif
-
-// default alignment and chunksize, if called with 0 arguments
-#define CHUNKSIZE       (64*1024)
-#define ALIGN           8
-
-// we need to call the `real' malloc and free, not our replacements
-#undef malloc
-#undef free
-
-struct chunk {
-    struct chunk        *next;
-};
-
-struct cleanup {
-    struct cleanup      *next;
-    void                (*fn)(void *);
-    void                *arg;
-};
-
-struct MemoryPool_rec {
-    struct chunk        *next;
-    uintptr_t           free, end;
-    size_t              chunksize;
-    uintptr_t           alignmask;
-    struct cleanup      *cleanup;
-};
-
-MemoryPool *mem_CreatePool(size_t chunksize, unsigned int align)
-{
-    MemoryPool  *pool;
-
-    if (align == 0) align = ALIGN;
-    if (chunksize == 0) chunksize = CHUNKSIZE;
-    if (align & (align-1)) return 0;
-    if (chunksize < sizeof(MemoryPool)) return 0;
-    if (chunksize & (align-1)) return 0;
-    if (!(pool = malloc(chunksize))) return 0;
-    pool->next = 0;
-    pool->chunksize = chunksize;
-    pool->alignmask = (uintptr_t)(align)-1;  
-    pool->free = ((uintptr_t)(pool + 1) + pool->alignmask) & ~pool->alignmask;
-    pool->end = (uintptr_t)pool + chunksize;
-    pool->cleanup = 0;
-    return pool;
-}
-
-void mem_FreePool(MemoryPool *pool)
-{
-    struct cleanup      *cleanup;
-    struct chunk        *p, *next;
-
-    for (cleanup = pool->cleanup; cleanup; cleanup = cleanup->next) {
-        cleanup->fn(cleanup->arg);
-    }
-    for (p = (struct chunk *)pool; p; p = next) {
-        next = p->next;
-        free(p);
-    }
-}
-
-void *mem_Alloc(MemoryPool *pool, size_t size)
-{
-    struct chunk *ch;
-    void *rv = (void *)pool->free;
-    size = (size + pool->alignmask) & ~pool->alignmask;
-    if (size <= 0) size = pool->alignmask;
-    pool->free += size;
-    if (pool->free > pool->end || pool->free < (uintptr_t)rv) {
-        size_t minreq = (size + sizeof(struct chunk) + pool->alignmask)
-                      & ~pool->alignmask;
-        pool->free = (uintptr_t)rv;
-        if (minreq >= pool->chunksize) {
-            // request size is too big for the chunksize, so allocate it as
-            // a single chunk of the right size
-            ch = malloc(minreq);
-            if (!ch) return 0;
-        } else {
-            ch = malloc(pool->chunksize);
-            if (!ch) return 0;
-            pool->free = (uintptr_t)ch + minreq;
-            pool->end = (uintptr_t)ch + pool->chunksize;
-        }
-        ch->next = pool->next;
-        pool->next = ch;
-        rv = (void *)(((uintptr_t)(ch+1) + pool->alignmask) & ~pool->alignmask);
-    }
-    return rv;
-}
-
-int mem_AddCleanup(MemoryPool *pool, void (*fn)(void *), void *arg) {
-    struct cleanup *cleanup;
-
-    pool->free = (pool->free + sizeof(void *) - 1) & ~(sizeof(void *)-1);
-    cleanup = mem_Alloc(pool, sizeof(struct cleanup));
-    if (!cleanup) return -1;
-    cleanup->next = pool->cleanup;
-    cleanup->fn = fn;
-    cleanup->arg = arg;
-    pool->cleanup = cleanup;
-    return 0;
-}
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.h
deleted file mode 100644
index 5fcadb3..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms.  If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder. 
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-//
-#ifndef __MEMORY_H
-#define __MEMORY_H
-
-#include <stddef.h>
-
-typedef struct MemoryPool_rec MemoryPool;
-
-extern MemoryPool *mem_CreatePool(size_t chunksize, unsigned int align);
-extern void mem_FreePool(MemoryPool *);
-extern void *mem_Alloc(MemoryPool *p, size_t size);
-extern void *mem_Realloc(MemoryPool *p, void *old, size_t oldsize, size_t newsize);
-extern int mem_AddCleanup(MemoryPool *p, void (*fn)(void *), void *arg);
-
-#endif /* __MEMORY_H */
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DiagnosticsBase.cpp b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DiagnosticsBase.cpp
deleted file mode 100644
index 7b32540..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DiagnosticsBase.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// 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.
-//
-
-#include "Diagnostics.h"
-
-#include <cassert>
-
-namespace pp
-{
-
-Diagnostics::~Diagnostics()
-{
-}
-
-void Diagnostics::report(ID id,
-                         const SourceLocation& loc,
-                         const std::string& text)
-{
-    // TODO(alokp): Keep a count of errors and warnings.
-    print(id, loc, text);
-}
-
-Diagnostics::Severity Diagnostics::severity(ID id)
-{
-    if ((id > ERROR_BEGIN) && (id < ERROR_END))
-        return ERROR;
-
-    if ((id > WARNING_BEGIN) && (id < WARNING_END))
-        return WARNING;
-
-    assert(false);
-    return ERROR;
-}
-
-}  // namespace pp
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/new_file.cpp b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/new_file.cpp
deleted file mode 100644
index 0aa5fd8..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/new_file.cpp
+++ /dev/null
@@ -1 +0,0 @@
-    Some new code that uses tabs
\ No newline at end of file
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/new_file2.cpp b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/new_file2.cpp
deleted file mode 100644
index d0e16df..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/new_file2.cpp
+++ /dev/null
@@ -1 +0,0 @@
-some other file
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/preprocessor.vcproj b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/preprocessor.vcproj
deleted file mode 100644
index 36a9759..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/preprocessor.vcproj
+++ /dev/null
@@ -1,393 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="9.00"
-	Name="preprocessor"
-	ProjectGUID="{FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}"
-	RootNamespace="preprocessor"
-	Keyword="Win32Proj"
-	TargetFrameworkVersion="196613"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-		<Platform
-			Name="x64"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="4"
-			CharacterSet="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="0"
-				WarningLevel="4"
-				WarnAsError="true"
-				DebugInformationFormat="4"
-				DisableSpecificWarnings="4100;4127;4244;4702"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="4"
-			CharacterSet="1"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				EnableIntrinsicFunctions="true"
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				UsePrecompiledHeader="0"
-				WarningLevel="4"
-				WarnAsError="true"
-				DebugInformationFormat="3"
-				DisableSpecificWarnings="4100;4127;4244"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug|x64"
-			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="4"
-			CharacterSet="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				TargetEnvironment="3"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="0"
-				WarningLevel="4"
-				WarnAsError="true"
-				DebugInformationFormat="3"
-				DisableSpecificWarnings="4100;4127;4244;4267;4702"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|x64"
-			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="4"
-			CharacterSet="1"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				TargetEnvironment="3"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				EnableIntrinsicFunctions="true"
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				UsePrecompiledHeader="0"
-				WarningLevel="4"
-				WarnAsError="true"
-				DebugInformationFormat="3"
-				DisableSpecificWarnings="4100;4127;4244;4267"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<File
-				RelativePath=".\Diagnostics.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\DirectiveHandler.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\DirectiveParser.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\ExpressionParser.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Input.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Lexer.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Macro.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\MacroExpander.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Preprocessor.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Token.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Tokenizer.cpp"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<File
-				RelativePath=".\Diagnostics.h"
-				>
-			</File>
-			<File
-				RelativePath=".\DirectiveHandler.h"
-				>
-			</File>
-			<File
-				RelativePath=".\DirectiveParser.h"
-				>
-			</File>
-			<File
-				RelativePath=".\ExpressionParser.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Input.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Lexer.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Macro.h"
-				>
-			</File>
-			<File
-				RelativePath=".\MacroExpander.h"
-				>
-			</File>
-			<File
-				RelativePath=".\pp_utils.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Preprocessor.h"
-				>
-			</File>
-			<File
-				RelativePath=".\SourceLocation.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Token.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Tokenizer.h"
-				>
-			</File>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/numeric_lex.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/numeric_lex.h
new file mode 100644
index 0000000..b04125d
--- /dev/null
+++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/numeric_lex.h
@@ -0,0 +1,61 @@
+//
+// 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.
+//
+
+// numeric_lex.h: Functions to extract numeric values from string.
+
+#ifndef COMPILER_PREPROCESSOR_NUMERIC_LEX_H_
+#define COMPILER_PREPROCESSOR_NUMERIC_LEX_H_
+
+#include <sstream>
+
+namespace pp {
+
+inline std::ios::fmtflags numeric_base_int(const std::string& str)
+{
+    if ((str.size() >= 2) &&
+        (str[0] == '0') &&
+        (str[1] == 'x' || str[1] == 'X'))
+    {
+        return std::ios::hex;
+    }
+    else if ((str.size() >= 1) && (str[0] == '0'))
+    {
+        return std::ios::oct;
+    }
+    return std::ios::dec;
+}
+
+// The following functions parse the given string to extract a numerical
+// value of the given type. These functions assume that the string is
+// of the correct form. They can only fail if the parsed value is too big,
+// in which case false is returned.
+
+template<typename IntType>
+bool numeric_lex_int(const std::string& str, IntType* value)
+{
+    std::istringstream stream(str);
+    // This should not be necessary, but MSVS has a buggy implementation.
+    // It returns incorrect results if the base is not specified.
+    stream.setf(numeric_base_int(str), std::ios::basefield);
+
+    stream >> (*value);
+    return !stream.fail();
+}
+
+template<typename FloatType>
+bool numeric_lex_float(const std::string& str, FloatType* value)
+{
+    std::istringstream stream(str);
+    // Force "C" locale so that decimal character is always '.', and
+    // not dependent on the current locale.
+    stream.imbue(std::locale::classic());
+
+    stream >> (*value);
+    return !stream.fail();
+}
+
+} // namespace pp.
+#endif // COMPILER_PREPROCESSOR_NUMERIC_LEX_H_
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/parser.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/parser.h
deleted file mode 100644
index f67342b..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/parser.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms.  If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder. 
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-
-#ifndef BISON_PARSER_H
-# define BISON_PARSER_H
-
-#ifndef yystypepp
-typedef struct {
-    int    sc_int;
-    float  sc_fval;
-    int    sc_ident;
-	char   symbol_name[MAX_SYMBOL_NAME_LEN+1];
-} yystypepp;
-
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-# define	CPP_AND_OP	        257
-# define	CPP_SUB_ASSIGN	    259
-# define	CPP_MOD_ASSIGN	    260
-# define	CPP_ADD_ASSIGN	261
-# define	CPP_DIV_ASSIGN	262
-# define	CPP_MUL_ASSIGN	263
-# define	CPP_EQ_OP	        264
-# define    CPP_XOR_OP         265 
-# define	ERROR_SY	    266
-# define	CPP_FLOATCONSTANT	267
-# define	CPP_GE_OP	        268
-# define	CPP_RIGHT_OP        269
-# define	CPP_IDENTIFIER	    270
-# define	CPP_INTCONSTANT	    271
-# define	CPP_LE_OP	        272
-# define	CPP_LEFT_OP	        273
-# define	CPP_DEC_OP	274
-# define	CPP_NE_OP	        275
-# define	CPP_OR_OP	        276
-# define	CPP_INC_OP	    277
-# define	CPP_STRCONSTANT	    278
-# define	CPP_TYPEIDENTIFIER	279
-
-# define	FIRST_USER_TOKEN_SY	289
-
-# define	CPP_RIGHT_ASSIGN	    280
-# define	CPP_LEFT_ASSIGN	    281
-# define	CPP_AND_ASSIGN	282
-# define	CPP_OR_ASSIGN  	283
-# define	CPP_XOR_ASSIGN	284
-# define	CPP_LEFT_BRACKET	285
-# define	CPP_RIGHT_BRACKET	286
-# define	CPP_LEFT_BRACE	287
-# define	CPP_RIGHT_BRACE	288
-
-#endif /* not BISON_PARSER_H */
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/pp_utils.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/pp_utils.h
similarity index 100%
rename from Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/pp_utils.h
rename to Source/ThirdParty/ANGLE/src/compiler/preprocessor/pp_utils.h
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/preprocess.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/preprocess.h
deleted file mode 100644
index 15056da..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/preprocess.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms.  If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder. 
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-
-#include "compiler/preprocessor/slglobals.h"
-extern CPPStruct *cpp;
-int InitCPPStruct(void);
-int InitScanner(CPPStruct *cpp);
-int InitAtomTable(AtomTable *atable, int htsize);
-char* GetStringOfAtom(AtomTable *atable, int atom);
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.c b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.c
deleted file mode 100644
index fde853c..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.c
+++ /dev/null
@@ -1,698 +0,0 @@
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms.  If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder. 
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-//
-// scanner.c
-//
-
-#include <assert.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if 0
-    #include <ieeefp.h>
-#else
-    #define isinff(x) (((*(int *)&(x) & 0x7f800000L)==0x7f800000L) && \
-                       ((*(int *)&(x) & 0x007fffffL)==0000000000L))
-#endif
-
-#include "compiler/preprocessor/slglobals.h"
-#include "compiler/util.h"
-
-typedef struct StringInputSrc {
-    InputSrc base;
-    char *p;
-} StringInputSrc;
-
-static int ScanFromString(const char *s);
-
-static int eof_scan(InputSrc *is, yystypepp * yylvalpp)
-{
-    return EOF;
-} // eof_scan
-
-static void noop(InputSrc *in, int ch, yystypepp * yylvalpp) {}
-
-static InputSrc eof_inputsrc = { 0, &eof_scan, &eof_scan, &noop, 0, 0 };
-
-static int byte_scan(InputSrc *, yystypepp * yylvalpp);
-
-#define EOL_SY '\n'
-
-#if defined(_MSC_VER)
-    #define DBG_BREAKPOINT() __asm int 3
-#elif defined(_M_AMD64)
-    #define DBG_BREAKPOINT() assert(!"Dbg_Breakpoint");
-#else
-    #define DBG_BREAKPOINT()
-#endif
-
-#if defined(_MSC_VER) && !defined(_M_AMD64)
-    __int64 RDTSC ( void ) {
-
-        __int64 v;
-    
-        __asm __emit 0x0f
-        __asm __emit 0x31
-        __asm mov dword ptr v, eax
-        __asm mov dword ptr v+4, edx
-    
-        return v;
-    }
-#endif
-
-
-int InitScanner(CPPStruct *cpp)
-{
-    // Add various atoms needed by the CPP line scanner:
-    if (!InitCPP())
-        return 0;
-
-    cpp->mostRecentToken = 0;
-    cpp->tokenLoc = &cpp->ltokenLoc;
-
-    cpp->ltokenLoc.file = 0;
-    cpp->ltokenLoc.line = 0;
-
-    cpp->currentInput = &eof_inputsrc;
-    cpp->previous_token = '\n';
-    cpp->pastFirstStatement = 0;
-
-    return 1;
-} // InitScanner
-
-int FreeScanner(void)
-{
-    return (FreeCPP());
-}
-
-int InitScannerInput(CPPStruct *cpp, int count, const char* const string[], const int length[])
-{
-    cpp->PaWhichStr = 0;
-    cpp->PaArgv     = string;
-    cpp->PaArgc     = count;
-    cpp->PaStrLen   = length;
-    ScanFromString(string[0]);
-    return 0;
-}
-
-/*
- * str_getch()
- * takes care of reading from multiple strings.
- * returns the next-char from the input stream.
- * returns EOF when the complete shader is parsed.
- */
-static int str_getch(StringInputSrc *in)
-{
-    for(;;){
-       if (*in->p){
-          if (*in->p == '\n') {
-             in->base.line++;
-             IncLineNumber();
-          }
-          return *in->p++;
-       }
-       if(++(cpp->PaWhichStr) < cpp->PaArgc){
-          free(in);
-          SetStringNumber(cpp->PaWhichStr);
-          SetLineNumber(1);
-          ScanFromString(cpp->PaArgv[cpp->PaWhichStr]);
-          in=(StringInputSrc*)cpp->currentInput;
-          continue;             
-       }
-       else{
-          cpp->currentInput = in->base.prev;
-          cpp->PaWhichStr=0;
-          free(in);
-          return EOF;
-       }  
-    }
-} // str_getch
-
-static void str_ungetch(StringInputSrc *in, int ch, yystypepp *type) {
-    if (in->p[-1] == ch)in->p--;
-    else {
-        *(in->p)='\0'; //this would take care of shifting to the previous string.
-        cpp->PaWhichStr--;
-    }  
-    if (ch == '\n') {
-        in->base.line--;
-        DecLineNumber();
-    }
-} // str_ungetch
-
-int ScanFromString(const char *s)
-{
-    
-    StringInputSrc *in = malloc(sizeof(StringInputSrc));
-    memset(in, 0, sizeof(StringInputSrc));
-    in->p = (char*) s;
-    in->base.line = 1;
-    in->base.scan = byte_scan;
-    in->base.getch = (int (*)(InputSrc *, yystypepp *))str_getch;
-    in->base.ungetch = (void (*)(InputSrc *, int, yystypepp *))str_ungetch;
-    in->base.prev = cpp->currentInput;
-    cpp->currentInput = &in->base;
-
-    return 1;
-} // ScanFromString;
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////// Floating point constants: /////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-#define APPEND_CHAR_S(ch, str, len, max_len) \
-      if (len < max_len) { \
-          str[len++] = ch; \
-      } else if (!alreadyComplained) { \
-          CPPErrorToInfoLog("BUFFER OVERFLOW"); \
-          alreadyComplained = 1; \
-      }
-
-/*
- * lFloatConst() - Scan a floating point constant.  Assumes that the scanner
- *         has seen at least one digit, followed by either a decimal '.' or the
- *         letter 'e'.
- * ch - '.' or 'e'
- * len - length of string already copied into yylvalpp->symbol_name.
- */
-
-static int lFloatConst(int ch, int len, yystypepp * yylvalpp)
-{
-    int alreadyComplained = 0;
-    assert((ch == '.') || (ch == 'e') || (ch == 'E'));
-
-    if (ch == '.') {
-        do {
-            APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-        } while (ch >= '0' && ch <= '9');
-    }
-
-    // Exponent:
-    if (ch == 'e' || ch == 'E') {
-        APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
-        ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-        if (ch == '+') {
-            APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-        } else if (ch == '-') {
-            APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-        }
-        if (ch >= '0' && ch <= '9') {
-            while (ch >= '0' && ch <= '9') {
-                APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
-                ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            }
-        } else {
-            CPPErrorToInfoLog("EXPONENT INVALID");
-        }
-    }
-    cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-
-    assert(len <= MAX_SYMBOL_NAME_LEN);
-    yylvalpp->symbol_name[len] = '\0';
-    yylvalpp->sc_fval = (float) atof_dot(yylvalpp->symbol_name);
-    if (isinff(yylvalpp->sc_fval)) {
-        CPPErrorToInfoLog("FLOAT CONSTANT OVERFLOW");
-    }
-    return CPP_FLOATCONSTANT;
-} // lFloatConst
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////// Normal Scanner //////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-    
-static int byte_scan(InputSrc *in, yystypepp * yylvalpp)
-{
-    char string_val[MAX_STRING_LEN + 1];
-    int alreadyComplained = 0;
-    int len, ch, ii, ival = 0;
-
-    for (;;) {
-        yylvalpp->sc_int = 0;
-        ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- 
-        while (ch == ' ' || ch == '\t' || ch == '\r') {
-            yylvalpp->sc_int = 1;
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-        }
-        
-        cpp->ltokenLoc.file = cpp->currentInput->name;
-        cpp->ltokenLoc.line = cpp->currentInput->line;
-        alreadyComplained = 0;
-        len = 0;
-        switch (ch) {
-        default:
-            return ch; // Single character token
-        case EOF:
-            return -1;
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z':            
-            do {
-                APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
-                ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            } while ((ch >= 'a' && ch <= 'z') ||
-                     (ch >= 'A' && ch <= 'Z') ||
-                     (ch >= '0' && ch <= '9') ||
-                     ch == '_');
-            assert(len <= MAX_SYMBOL_NAME_LEN);
-            yylvalpp->symbol_name[len] = '\0';
-            cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-            yylvalpp->sc_ident = LookUpAddString(atable, yylvalpp->symbol_name);
-            return CPP_IDENTIFIER;
-            break;
-        case '0':
-            APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            if (ch == 'x' || ch == 'X') {  // hexadecimal integer constants
-                APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
-                ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-                if ((ch >= '0' && ch <= '9') ||
-                    (ch >= 'A' && ch <= 'F') ||
-                    (ch >= 'a' && ch <= 'f'))
-                {
-                    ival = 0;
-                    do {
-                        if ((ival <= 0x0fffffff) && (len < MAX_SYMBOL_NAME_LEN)) {
-                            yylvalpp->symbol_name[len++] = ch;
-                            if (ch >= '0' && ch <= '9') {
-                                ii = ch - '0';
-                            } else if (ch >= 'A' && ch <= 'F') {
-                                ii = ch - 'A' + 10;
-                            } else {
-                                ii = ch - 'a' + 10;
-                            }
-                            ival = (ival << 4) | ii;
-                        } else if (!alreadyComplained) {
-                            CPPErrorToInfoLog("HEX CONSTANT OVERFLOW");
-                            alreadyComplained = 1;
-                        }
-                        ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-                    } while ((ch >= '0' && ch <= '9') ||
-                             (ch >= 'A' && ch <= 'F') ||
-                             (ch >= 'a' && ch <= 'f'));
-                } else {
-                    CPPErrorToInfoLog("HEX CONSTANT INVALID");
-                }
-                assert(len <= MAX_SYMBOL_NAME_LEN);
-                yylvalpp->symbol_name[len] = '\0';
-                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                yylvalpp->sc_int = ival;
-                return CPP_INTCONSTANT;
-            } else if (ch >= '0' && ch <= '7') { // octal integer constants
-                ival = 0;
-                do {
-                    if ((ival <= 0x1fffffff) && (len < MAX_SYMBOL_NAME_LEN)) {
-                        yylvalpp->symbol_name[len++] = ch;
-                        ii = ch - '0';
-                        ival = (ival << 3) | ii;
-                    } else if (!alreadyComplained) {
-                        CPPErrorToInfoLog("OCT CONSTANT OVERFLOW");
-                        alreadyComplained = 1;
-                    }
-                    ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-                } while (ch >= '0' && ch <= '7');
-                if (ch == '.' || ch == 'e' || ch == 'f' || ch == 'h' || ch == 'x'|| ch == 'E') 
-                     return lFloatConst(ch, len, yylvalpp);
-                assert(len <= MAX_SYMBOL_NAME_LEN);
-                yylvalpp->symbol_name[len] = '\0';
-                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                yylvalpp->sc_int = ival;
-                return CPP_INTCONSTANT;
-            } else {
-                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                ch = '0';
-            }
-            // Fall through...
-        case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-            do {
-                APPEND_CHAR_S(ch, yylvalpp->symbol_name, len, MAX_SYMBOL_NAME_LEN);
-                ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            } while (ch >= '0' && ch <= '9');
-            if (ch == '.' || ch == 'e' || ch == 'E') {
-                return lFloatConst(ch, len, yylvalpp);
-            } else {
-                assert(len <= MAX_SYMBOL_NAME_LEN);
-                yylvalpp->symbol_name[len] = '\0';
-                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                ival = 0;
-                for (ii = 0; ii < len; ii++) {
-                    ch = yylvalpp->symbol_name[ii] - '0';
-                    ival = ival*10 + ch;
-                    if ((ival > 214748364) || (ival == 214748364 && ch >= 8)) {
-                        CPPErrorToInfoLog("INTEGER CONSTANT OVERFLOW");
-                        break;
-                    }
-                }
-                yylvalpp->sc_int = ival;
-                if(ival==0)
-                   strcpy(yylvalpp->symbol_name,"0");
-                return CPP_INTCONSTANT;
-            }
-            break;
-        case '-':
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            if (ch == '-') {
-                return CPP_DEC_OP;
-            } else if (ch == '=') {
-                return CPP_SUB_ASSIGN;
-            } else {
-                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                return '-';
-            }
-        case '+':
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            if (ch == '+') {
-                return CPP_INC_OP;
-            } else if (ch == '=') {
-                return CPP_ADD_ASSIGN;
-            } else {
-                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                return '+';
-            }
-        case '*':
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            if (ch == '=') {
-                return CPP_MUL_ASSIGN;
-            } else {
-                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                return '*';
-            }
-        case '%':
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            if (ch == '=') {
-                return CPP_MOD_ASSIGN;
-            } else if (ch == '>'){
-                return CPP_RIGHT_BRACE;
-            } else {
-                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                return '%';
-            }
-        case ':':
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            if (ch == '>') {
-                return CPP_RIGHT_BRACKET;
-            } else {
-                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                return ':';
-            }
-        case '^':
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            if (ch == '^') {
-                return CPP_XOR_OP;
-            } else {
-                if (ch == '=')
-                    return CPP_XOR_ASSIGN;
-                else{
-                  cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                  return '^';
-                }
-            }
-        
-        case '=':
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            if (ch == '=') {
-                return CPP_EQ_OP;
-            } else {
-                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                return '=';
-            }
-        case '!':
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            if (ch == '=') {
-                return CPP_NE_OP;
-            } else {
-                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                return '!';
-            }
-        case '|':
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            if (ch == '|') {
-                return CPP_OR_OP;
-            } else {
-                if (ch == '=')
-                    return CPP_OR_ASSIGN;
-                else{
-                  cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                  return '|';
-                }
-            }
-        case '&':
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            if (ch == '&') {
-                return CPP_AND_OP;
-            } else {
-                if (ch == '=')
-                    return CPP_AND_ASSIGN;
-                else{
-                  cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                  return '&';
-                }
-            }
-        case '<':
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            if (ch == '<') {
-                ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-                if(ch == '=')
-                    return CPP_LEFT_ASSIGN;
-                else{
-                    cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                    return CPP_LEFT_OP;
-                }
-            } else {
-                if (ch == '=') {
-                    return CPP_LE_OP;
-                } else {
-                    if (ch == '%')
-                        return CPP_LEFT_BRACE;
-                    else if (ch == ':')
-                        return CPP_LEFT_BRACKET;
-                    else{
-                        cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                        return '<';
-                    }
-                }
-            }
-        case '>':
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            if (ch == '>') {
-                ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-                if(ch == '=')
-                    return CPP_RIGHT_ASSIGN;
-                else{
-                    cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                    return CPP_RIGHT_OP;
-                }
-            } else {
-                if (ch == '=') {
-                    return CPP_GE_OP;
-                } else {
-                    cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                    return '>';
-                }
-            }
-        case '.':
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            if (ch >= '0' && ch <= '9') {
-                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                return lFloatConst('.', 0, yylvalpp);
-            } else {
-                if (ch == '.') {
-                    return -1; // Special EOF hack
-                } else {
-                    cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                    return '.';
-                }
-            }
-        case '/':
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            if (ch == '/') {
-                do {
-                    ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-                } while (ch != '\n' && ch != EOF);
-                if (ch == EOF)
-                    return -1;
-                return '\n';
-            } else if (ch == '*') {
-                ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-                do {
-                    while (ch != '*') {
-                        if (ch == EOF) {
-                            CPPErrorToInfoLog("EOF IN COMMENT");
-                            return -1;
-                        }
-                        ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-                    }
-                    ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-                    if (ch == EOF) {
-                        CPPErrorToInfoLog("EOF IN COMMENT");
-                        return -1;
-                    }
-                } while (ch != '/');
-                // Go try it again...
-            } else if (ch == '=') {
-                return CPP_DIV_ASSIGN;
-            } else {
-                cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
-                return '/';
-            }
-            break;
-        case '"':
-            ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            while (ch != '"' && ch != '\n' && ch != EOF) {
-                if (ch == '\\') {
-                    CPPErrorToInfoLog("The line continuation character (\\) is not part of the OpenGL ES Shading Language");
-                    return -1;
-                }
-                APPEND_CHAR_S(ch, string_val, len, MAX_STRING_LEN);
-                ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-            };
-            assert(len <= MAX_STRING_LEN);
-            string_val[len] = '\0';
-            if (ch == '"') {
-                yylvalpp->sc_ident = LookUpAddString(atable, string_val);
-                return CPP_STRCONSTANT;
-            } else {
-                CPPErrorToInfoLog("EOL IN STRING");
-                return ERROR_SY;
-            }
-            break;
-        }
-    }
-} // byte_scan
-
-int yylex_CPP(char* buf, int maxSize)
-{    
-    yystypepp yylvalpp;
-    int token = '\n';   
-
-    for(;;) {
-
-        char* tokenString = 0;
-        token = cpp->currentInput->scan(cpp->currentInput, &yylvalpp);
-        if(check_EOF(token))
-            return 0;
-        if (token < 0) {
-            // This check may need to be improved to support UTF-8
-            // characters in comments.
-            CPPErrorToInfoLog("preprocessor encountered non-ASCII character in shader source");
-            return 0;
-        }
-        if (token == '#') {
-            if (cpp->previous_token == '\n'|| cpp->previous_token == 0) {
-                token = readCPPline(&yylvalpp);
-                if(check_EOF(token))
-                    return 0;
-                continue;
-            } else {
-                CPPErrorToInfoLog("preprocessor command must not be preceded by any other statement in that line");
-                return 0;
-            }
-        }
-        cpp->previous_token = token;
-        // expand macros
-        if (token == CPP_IDENTIFIER && MacroExpand(yylvalpp.sc_ident, &yylvalpp)) {
-            cpp->pastFirstStatement = 1;
-            continue;
-        }
-
-        if (token == '\n')
-            continue;
-        cpp->pastFirstStatement = 1;
-
-        if (token == CPP_IDENTIFIER) {
-            tokenString = GetStringOfAtom(atable,yylvalpp.sc_ident);
-        } else if (token == CPP_FLOATCONSTANT || token == CPP_INTCONSTANT){
-            tokenString = yylvalpp.symbol_name;
-        } else {
-            tokenString = GetStringOfAtom(atable,token);
-        }
-
-        if (tokenString) {
-            int len = strlen(tokenString);
-            cpp->tokensBeforeEOF = 1;
-            if (len >= maxSize) {
-                return maxSize;
-            } else  if (len > 0) {
-                strcpy(buf, tokenString);
-                return len;
-            }
-
-            return 0;
-        }
-    }
-} // yylex
-
-//Checks if the token just read is EOF or not.
-int check_EOF(int token)
-{
-   if(token==-1){
-       if(cpp->ifdepth >0){
-        CPPErrorToInfoLog("#endif missing!! Compilation stopped");
-        cpp->CompileError=1;
-       }
-      return 1;
-   }
-   return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////// End of scanner.c //////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.h
deleted file mode 100644
index b67c1d6..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms.  If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder. 
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-//
-// scanner.h
-//
-
-#if !defined(__SCANNER_H)
-#define __SCANNER_H 1
-
-#include "compiler/preprocessor/length_limits.h"
-#include "compiler/preprocessor/parser.h"
-
-// Not really atom table stuff but needed first...
-
-typedef struct SourceLoc_Rec {
-    unsigned short file, line;
-} SourceLoc;
-
-int yylex_CPP(char* buf, int maxSize);
-
-typedef struct InputSrc {
-    struct InputSrc	*prev;
-    int			(*scan)(struct InputSrc *, yystypepp *);
-    int			(*getch)(struct InputSrc *, yystypepp *);
-    void		(*ungetch)(struct InputSrc *, int, yystypepp *);
-    int			name;  /* atom */
-    int			line;
-} InputSrc;
-
-int InitScanner(CPPStruct *cpp);   // Intialise the cpp scanner. 
-int InitScannerInput(CPPStruct *cpp, int count, const char* const string[], const int length[]);
-int check_EOF(int);              // check if we hit a EOF abruptly 
-void CPPErrorToInfoLog(const char *);   // sticking the msg,line into the Shader's.Info.log
-void SetLineNumber(int);
-void SetStringNumber(int);
-void IncLineNumber(void);
-void DecLineNumber(void);
-int FreeScanner(void);                 // Free the cpp scanner
-#endif // !(defined(__SCANNER_H)
-
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/slglobals.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/slglobals.h
deleted file mode 100644
index 4634626..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/slglobals.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms.  If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder. 
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-//
-// slglobals.h
-//
-
-#if !defined(__SLGLOBALS_H)
-#define __SLGLOBALS_H 1
-
-typedef struct CPPStruct_Rec CPPStruct;
-
-extern CPPStruct *cpp;
-
-#undef  CPPC_DEBUG_THE_COMPILER
-#if defined(_DEBUG)
-#define CPPC_DEBUG_THE_COMPILER 1
-#endif
-
-#undef  CPPC_ENABLE_TOOLS
-#define CPPC_ENABLE_TOOLS 1
-
-#include "compiler/preprocessor/memory.h"
-#include "compiler/preprocessor/atom.h"
-#include "compiler/preprocessor/scanner.h"
-#include "compiler/preprocessor/cpp.h"
-#include "compiler/preprocessor/tokens.h"
-#include "compiler/preprocessor/symbols.h"
-#include "compiler/preprocessor/compile.h"
-#if !defined(NO_PARSER)
-#include "compiler/preprocessor/parser.h"
-#endif
-
-#if !defined(NULL)
-#define NULL 0
-#endif
-
-#endif // !(defined(__SLGLOBALS_H)
-
-
-    
-
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/symbols.c b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/symbols.c
deleted file mode 100644
index f18b256..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/symbols.c
+++ /dev/null
@@ -1,288 +0,0 @@
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms.  If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder. 
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-//
-// symbols.c
-//
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "compiler/preprocessor/slglobals.h"
-
-#if defined(_MSC_VER)
-#pragma warning(disable: 4706)
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////// Symbol Table Variables: ///////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-Scope *ScopeList = NULL;
-Scope *CurrentScope = NULL;
-Scope *GlobalScope = NULL;
-
-static void unlinkScope(void *_scope) {
-    Scope *scope = _scope;
-
-    if (scope->next)
-        scope->next->prev = scope->prev;
-    if (scope->prev)
-        scope->prev->next = scope->next;
-    else
-        ScopeList = scope->next;
-}
-
-/*
- * NewScope()
- *
- */
-Scope *NewScopeInPool(MemoryPool *pool)
-{
-    Scope *lScope;
-
-    lScope = mem_Alloc(pool, sizeof(Scope));
-    lScope->pool = pool;
-    lScope->parent = NULL;
-    lScope->funScope = NULL;
-    lScope->symbols = NULL;
-    
-    lScope->level = 0;
-
-    lScope->programs = NULL;
-    if ((lScope->next = ScopeList))
-        ScopeList->prev = lScope;
-    lScope->prev = 0;
-    ScopeList = lScope;
-    mem_AddCleanup(pool, unlinkScope, lScope);
-    return lScope;
-} // NewScope
-
-/*
- * PushScope()
- *
- */
-
-void PushScope(Scope *fScope)
-{
-    Scope *lScope;
-
-    if (CurrentScope) {
-        fScope->level = CurrentScope->level + 1;
-        if (fScope->level == 1) {
-            if (!GlobalScope) {
-                /* HACK - CTD -- if GlobalScope==NULL and level==1, we're
-                 * defining a function in the superglobal scope.  Things
-                 * will break if we leave the level as 1, so we arbitrarily
-                 * set it to 2 */
-                fScope->level = 2;
-            }
-        }
-        if (fScope->level >= 2) {
-            lScope = fScope;
-            while (lScope->level > 2)
-                lScope = lScope->next;
-            fScope->funScope = lScope;
-        }
-    } else {
-        fScope->level = 0;
-    }
-    fScope->parent = CurrentScope;
-    CurrentScope = fScope;
-} // PushScope
-
-/*
- * PopScope()
- *
- */
-
-Scope *PopScope(void)
-{
-    Scope *lScope;
-
-    lScope = CurrentScope;
-    if (CurrentScope)
-        CurrentScope = CurrentScope->parent;
-    return lScope;
-} // PopScope
-
-/*
- * NewSymbol() - Allocate a new symbol node;
- *
- */
-
-Symbol *NewSymbol(SourceLoc *loc, Scope *fScope, int name, symbolkind kind)
-{
-    Symbol *lSymb;
-    char *pch;
-    unsigned int ii;
-
-    lSymb = (Symbol *) mem_Alloc(fScope->pool, sizeof(Symbol));
-    lSymb->left = NULL;
-    lSymb->right = NULL;
-    lSymb->next = NULL;
-    lSymb->name = name;
-    lSymb->loc = *loc;
-    lSymb->kind = kind;
-    
-    // Clear union area:
-
-    pch = (char *) &lSymb->details;
-    for (ii = 0; ii < sizeof(lSymb->details); ii++)
-        *pch++ = 0;
-    return lSymb;
-} // NewSymbol
-
-/*
- * lAddToTree() - Using a binary tree is not a good idea for basic atom values because they
- *         are generated in order.  We'll fix this later (by reversing the bit pattern).
- */
-
-static void lAddToTree(Symbol **fSymbols, Symbol *fSymb)
-{
-    Symbol *lSymb;
-    int lrev, frev;
-
-    lSymb = *fSymbols;
-    if (lSymb) {
-        frev = GetReversedAtom(atable, fSymb->name);
-        while (lSymb) {
-            lrev = GetReversedAtom(atable, lSymb->name);
-            if (lrev == frev) {
-                CPPErrorToInfoLog("GetAtomString(atable, fSymb->name)");
-                break;
-            } else {
-                if (lrev > frev) {
-                    if (lSymb->left) {
-                        lSymb = lSymb->left;
-                    } else {
-                        lSymb->left = fSymb;
-                        break;
-                    }
-                } else {
-                    if (lSymb->right) {
-                        lSymb = lSymb->right;
-                    } else {
-                        lSymb->right = fSymb;
-                        break;
-                    }
-                }
-            }
-        }
-    } else {
-        *fSymbols = fSymb;
-    }
-} // lAddToTree
-
-
-/*
- * AddSymbol() - Add a variable, type, or function name to a scope.
- *
- */
-
-Symbol *AddSymbol(SourceLoc *loc, Scope *fScope, int atom, symbolkind kind)
-{
-    Symbol *lSymb;
-
-    if (!fScope)
-        fScope = CurrentScope;
-    lSymb = NewSymbol(loc, fScope, atom, kind);
-    lAddToTree(&fScope->symbols, lSymb);
-    return lSymb;
-} // AddSymbol
-
-
-/*********************************************************************************************/
-/************************************ Symbol Semantic Functions ******************************/
-/*********************************************************************************************/
-
-/*
- * LookUpLocalSymbol()
- *
- */
-
-Symbol *LookUpLocalSymbol(Scope *fScope, int atom)
-{
-    Symbol *lSymb;
-    int rname, ratom;
-
-    ratom = GetReversedAtom(atable, atom);
-    if (!fScope)
-        fScope = CurrentScope;
-    lSymb = fScope->symbols;
-    while (lSymb) {
-        rname = GetReversedAtom(atable, lSymb->name);
-        if (rname == ratom) {
-            return lSymb;
-        } else {
-            if (rname > ratom) {
-                lSymb = lSymb->left;
-            } else {
-                lSymb = lSymb->right;
-            }
-        }
-    }
-    return NULL;
-} // LookUpLocalSymbol
-
-/*
- * LookUpSymbol()
- *
- */
-
-Symbol *LookUpSymbol(Scope *fScope, int atom)
-{
-    Symbol *lSymb;
-
-    if (!fScope)
-        fScope = CurrentScope;
-    while (fScope) {
-        lSymb = LookUpLocalSymbol(fScope, atom);
-        if (lSymb)
-            return lSymb;
-        fScope = fScope->parent;
-    }
-    return NULL;
-} // LookUpSymbol
-
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/symbols.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/symbols.h
deleted file mode 100644
index e7d0b07..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/symbols.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms.  If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder. 
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-//
-// symbols.h
-//
-
-#if !defined(__SYMBOLS_H)
-#define __SYMBOLS_H 1
-
-#include "compiler/preprocessor/memory.h"
-
-typedef enum symbolkind {
-   MACRO_S
-} symbolkind;
-
-// Typedefs for things defined here in "symbols.h":
-
-typedef struct Scope_Rec Scope;
-typedef struct Symbol_Rec Symbol;
-
-typedef struct SymbolList_Rec {
-    struct SymbolList_Rec *next;
-    Symbol *symb;
-} SymbolList;
-
-struct Scope_Rec {
-    Scope *next, *prev;     // doubly-linked list of all scopes
-    Scope *parent;
-    Scope *funScope;        // Points to base scope of enclosing function
-    MemoryPool *pool;       // pool used for allocation in this scope
-    Symbol *symbols;
-    
-	int level;              // 0 = super globals, 1 = globals, etc.
-
-    // Only used at global scope (level 1):
-    SymbolList *programs;   // List of programs for this compilation.
-};
-
-
-// Symbol table is a simple binary tree.
-
-#include "compiler/preprocessor/cpp.h"        // to get MacroSymbol def
-
-struct Symbol_Rec {
-    Symbol *left, *right;
-    Symbol *next;
-    int name;       // Name atom
-    SourceLoc loc;
-    symbolkind kind;
-    union {
-        MacroSymbol mac;
-    } details;
-};
-
-extern Scope *CurrentScope;
-extern Scope *GlobalScope;
-extern Scope *ScopeList;
-
-Scope *NewScopeInPool(MemoryPool *);
-#define NewScope()      NewScopeInPool(CurrentScope->pool)
-void PushScope(Scope *fScope);
-Scope *PopScope(void);
-Symbol *NewSymbol(SourceLoc *loc, Scope *fScope, int name, symbolkind kind);
-Symbol *AddSymbol(SourceLoc *loc, Scope *fScope, int atom, symbolkind kind);
-Symbol *LookUpLocalSymbol(Scope *fScope, int atom);
-Symbol *LookUpSymbol(Scope *fScope, int atom);
-
-
-#endif // !defined(__SYMBOLS_H)
-
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/tokens.c b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/tokens.c
deleted file mode 100644
index b94c05e..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/tokens.c
+++ /dev/null
@@ -1,467 +0,0 @@
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms.  If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder. 
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-//
-// tokens.c
-//
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-
-#include "common/angleutils.h"
-#include "compiler/debug.h"
-#include "compiler/preprocessor/slglobals.h"
-#include "compiler/util.h"
-
-#if defined(_MSC_VER)
-#pragma warning(disable: 4054)
-#pragma warning(disable: 4152)
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-//////////////////////// Preprocessor and Token Recorder and Playback: ////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-/*
- * idstr()
- * Copy a string to a malloc'ed block and convert it into something suitable
- * for an ID
- *
- */
-
-static char *idstr(const char *fstr, MemoryPool *pool)
-{
-    size_t len;
-    char *str, *t;
-    const char *f;
-
-    len = strlen(fstr);
-    if (!pool)
-        str = (char *) malloc(len + 1);
-    else
-        str = (char *) mem_Alloc(pool, len + 1);
-    
-    for (f=fstr, t=str; *f; f++) {
-        if (isalnum(*f)) *t++ = *f;
-        else if (*f == '.' || *f == '/') *t++ = '_';
-    }
-    *t = 0;
-    return str;
-} // idstr
-
-
-/*
- * lNewBlock()
- *
- */
-
-static TokenBlock *lNewBlock(TokenStream *fTok, MemoryPool *pool)
-{
-    TokenBlock *lBlock;
-
-    if (!pool)
-        lBlock = (TokenBlock *) malloc(sizeof(TokenBlock) + 256);
-    else
-        lBlock = (TokenBlock *) mem_Alloc(pool, sizeof(TokenBlock) + 256);
-    lBlock->count = 0;
-    lBlock->current = 0;
-    lBlock->data = (unsigned char *) lBlock + sizeof(TokenBlock);
-    lBlock->max = 256;
-    lBlock->next = NULL;
-    if (fTok->head) {
-        fTok->current->next = lBlock;
-    } else {
-        fTok->head = lBlock;
-    }
-    fTok->current = lBlock;
-    return lBlock;
-} // lNewBlock
-
-/*
- * lAddByte()
- *
- */
-
-static void lAddByte(TokenStream *fTok, unsigned char fVal)
-{
-    TokenBlock *lBlock;
-    lBlock = fTok->current;
-    if (lBlock->count >= lBlock->max)
-        lBlock = lNewBlock(fTok, 0);
-    lBlock->data[lBlock->count++] = fVal;
-} // lAddByte
-
-
-
-/*
- * lReadByte() - Get the next byte from a stream.
- *
- */
-
-static int lReadByte(TokenStream *pTok)
-{
-    TokenBlock *lBlock;
-    int lval = -1;
-
-    lBlock = pTok->current;
-    if (lBlock) {
-        if (lBlock->current >= lBlock->count) {
-            lBlock = lBlock->next;
-            if (lBlock)
-                lBlock->current = 0;
-            pTok->current = lBlock;
-        }
-        if (lBlock)
-            lval = lBlock->data[lBlock->current++];
-    }
-    return lval;
-} // lReadByte
-
-/////////////////////////////////////// Global Functions://////////////////////////////////////
-
-/*
- * NewTokenStream()
- *
- */
-
-TokenStream *NewTokenStream(const char *name, MemoryPool *pool)
-{
-    TokenStream *pTok;
-
-    if (!pool)
-        pTok = (TokenStream *) malloc(sizeof(TokenStream));
-    else
-        pTok = (TokenStream*)mem_Alloc(pool, sizeof(TokenStream));
-    pTok->next = NULL;
-    pTok->name = idstr(name, pool);
-    pTok->head = NULL;
-    pTok->current = NULL;
-    lNewBlock(pTok, pool);
-    return pTok;
-} // NewTokenStream
-
-/*
- * DeleteTokenStream()
- *
- */
-
-void DeleteTokenStream(TokenStream *pTok)
-{
-    TokenBlock *pBlock, *nBlock;
-
-    if (pTok) {
-        pBlock = pTok->head;
-        while (pBlock) {
-            nBlock = pBlock->next;
-            free(pBlock);
-            pBlock = nBlock;
-        }
-        if (pTok->name)
-            free(pTok->name);
-        free(pTok);
-    }
-} // DeleteTokenStream
-
-/*
- * RecordToken() - Add a token to the end of a list for later playback or printout.
- *
- */
-
-void RecordToken(TokenStream *pTok, int token, yystypepp * yylvalpp)
-{
-    const char *s;
-    char *str=NULL;
-
-    if (token > 256)
-        lAddByte(pTok, (unsigned char)((token & 0x7f) + 0x80));
-    else
-        lAddByte(pTok, (unsigned char)(token & 0x7f));
-    switch (token) {
-    case CPP_IDENTIFIER:
-    case CPP_TYPEIDENTIFIER:
-    case CPP_STRCONSTANT:
-        s = GetAtomString(atable, yylvalpp->sc_ident);
-        while (*s)
-            lAddByte(pTok, (unsigned char) *s++);
-        lAddByte(pTok, 0);
-        break;
-    case CPP_FLOATCONSTANT:
-    case CPP_INTCONSTANT:
-         str=yylvalpp->symbol_name;
-         while (*str){
-            lAddByte(pTok, (unsigned char) *str++);
-         }
-         lAddByte(pTok, 0);
-         break;
-    case '(':
-        lAddByte(pTok, (unsigned char)(yylvalpp->sc_int ? 1 : 0));
-    default:
-        break;
-    }
-} // RecordToken
-
-/*
- * RewindTokenStream() - Reset a token stream in preperation for reading.
- *
- */
-
-void RewindTokenStream(TokenStream *pTok)
-{
-    if (pTok->head) {
-        pTok->current = pTok->head;
-        pTok->current->current = 0;
-    }
-} // RewindTokenStream
-
-/*
- * ReadToken() - Read the next token from a stream.
- *
- */
-
-int ReadToken(TokenStream *pTok, yystypepp * yylvalpp)
-{
-    char symbol_name[MAX_SYMBOL_NAME_LEN + 1];
-    char string_val[MAX_STRING_LEN + 1];
-    int ltoken, len;
-    char ch;
-    int base, accum;
-    char ch_val;
-
-    ltoken = lReadByte(pTok);
-    if (ltoken >= 0) {
-        if (ltoken > 127)
-            ltoken += 128;
-        switch (ltoken) {
-        case CPP_IDENTIFIER:
-        case CPP_TYPEIDENTIFIER:
-            len = 0;
-            ch = lReadByte(pTok);
-            while ((ch >= 'a' && ch <= 'z') ||
-                     (ch >= 'A' && ch <= 'Z') ||
-                     (ch >= '0' && ch <= '9') ||
-                     ch == '_')
-            {
-                if (len < MAX_SYMBOL_NAME_LEN) {
-                    symbol_name[len++] = ch;
-                    ch = lReadByte(pTok);
-                }
-            }
-            symbol_name[len] = '\0';
-            assert(ch == '\0');
-            yylvalpp->sc_ident = LookUpAddString(atable, symbol_name);
-            return CPP_IDENTIFIER;
-            break;
-        case CPP_STRCONSTANT:
-            len = 0;
-            while ((ch = lReadByte(pTok)) != 0)
-                if (len < MAX_STRING_LEN)
-                    string_val[len++] = ch;
-            string_val[len] = '\0';
-            yylvalpp->sc_ident = LookUpAddString(atable, string_val);
-            break;
-        case CPP_FLOATCONSTANT:
-            len = 0;
-            ch = lReadByte(pTok);
-            while ((ch >= '0' && ch <= '9')||(ch=='e'||ch=='E'||ch=='.')||(ch=='+'||ch=='-'))
-            {
-                if (len < MAX_SYMBOL_NAME_LEN) {
-                    symbol_name[len++] = ch;
-                    ch = lReadByte(pTok);
-                }
-            }
-            symbol_name[len] = '\0';
-            assert(ch == '\0');
-            strcpy(yylvalpp->symbol_name,symbol_name);
-            yylvalpp->sc_fval=(float)atof_dot(yylvalpp->symbol_name);
-            break;
-        case CPP_INTCONSTANT:
-            len = 0;
-	    accum = 0;
-            ch = lReadByte(pTok);
-            if (ch == '0') {
-                symbol_name[len++] = ch;
-                ch = lReadByte(pTok);
-                if (ch == 'x' || ch == 'X') {
-                    symbol_name[len++] = ch;
-                    base = 16;
-                    ch = lReadByte(pTok);
-                } else {
-                    base = 8;
-                }
-            } else {
-                base = 10;
-            }
-
-            while (len < MAX_SYMBOL_NAME_LEN)
-            {
-                ch_val = -1;
-                if (isdigit(ch))
-                    ch_val = ch - '0';
-                else if (isxdigit(ch))
-                    ch_val = tolower(ch) - 'a' + 10;
-
-                if (ch_val < 0 || ch_val >= base)
-                    break;
-
-                symbol_name[len++] = ch;
-                accum = accum * base + ch_val;
-                ch = lReadByte(pTok);
-            }
-            symbol_name[len] = '\0';
-            assert(ch == '\0');
-            strcpy(yylvalpp->symbol_name, symbol_name);
-            yylvalpp->sc_int = accum;
-            break;
-        case '(':
-            yylvalpp->sc_int = lReadByte(pTok);
-            break;
-        }
-        return ltoken;
-    }
-    return EOF_SY;
-} // ReadToken
-
-typedef struct TokenInputSrc {
-    InputSrc            base;
-    TokenStream         *tokens;
-    int                 (*final)(CPPStruct *);
-} TokenInputSrc;
-
-static int scan_token(TokenInputSrc *in, yystypepp * yylvalpp)
-{
-    int token = ReadToken(in->tokens, yylvalpp);
-    int (*final)(CPPStruct *);
-    cpp->tokenLoc->file = cpp->currentInput->name;
-    cpp->tokenLoc->line = cpp->currentInput->line;
-    if (token == '\n') {
-        in->base.line++;
-        return token;
-    }
-    if (token > 0) return token;
-    cpp->currentInput = in->base.prev;
-    final = in->final;
-    free(in);
-    if (final && !final(cpp)) return -1;
-    return cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-}
-
-int ReadFromTokenStream(TokenStream *ts, int name, int (*final)(CPPStruct *))
-{
-    TokenInputSrc *in = malloc(sizeof(TokenInputSrc));
-    memset(in, 0, sizeof(TokenInputSrc));
-    in->base.name = name;
-    in->base.prev = cpp->currentInput;
-    in->base.scan = (int (*)(InputSrc *, yystypepp *))scan_token;
-    in->base.line = 1;
-    in->tokens = ts;
-    in->final = final;
-    RewindTokenStream(ts);
-    cpp->currentInput = &in->base;
-    return 1;
-}
-
-typedef struct UngotToken {
-    InputSrc    base;
-    int         token;
-    yystypepp     lval;
-} UngotToken;
-
-static int reget_token(UngotToken *t, yystypepp * yylvalpp)
-{
-    int token = t->token;
-    *yylvalpp = t->lval;
-    cpp->currentInput = t->base.prev;
-    free(t);
-    return token;
-}
-
-void UngetToken(int token, yystypepp * yylvalpp) {
-    UngotToken *t = malloc(sizeof(UngotToken));
-    memset(t, 0, sizeof(UngotToken));
-    t->token = token;
-    t->lval = *yylvalpp;
-    t->base.scan = (void *)reget_token;
-    t->base.prev = cpp->currentInput;
-    t->base.name = cpp->currentInput->name;
-    t->base.line = cpp->currentInput->line;
-    cpp->currentInput = &t->base;
-}
-
-
-void DumpTokenStream(FILE *fp, TokenStream *s, yystypepp * yylvalpp) {
-    int token;
-    char str[100];
-
-    if (fp == 0) fp = stdout;
-    RewindTokenStream(s);
-    while ((token = ReadToken(s, yylvalpp)) > 0) {
-        switch (token) {
-        case CPP_IDENTIFIER:
-        case CPP_TYPEIDENTIFIER:
-            snprintf(str, sizeof(str), "%s ", GetAtomString(atable, yylvalpp->sc_ident));
-            break;
-        case CPP_STRCONSTANT:
-            snprintf(str, sizeof(str), "\"%s\"", GetAtomString(atable, yylvalpp->sc_ident));
-            break;
-        case CPP_FLOATCONSTANT:
-            //printf("%g9.6 ", yylvalpp->sc_fval);
-            break;
-        case CPP_INTCONSTANT:
-            //printf("%d ", yylvalpp->sc_int);
-            break;
-        default:
-            if (token >= 127)
-                snprintf(str, sizeof(str), "%s ", GetAtomString(atable, token));
-            else
-                snprintf(str, sizeof(str), "%c", token);
-            break;
-        }
-        CPPDebugLogMsg(str);
-    }
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////// End of tokens.c ///////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/tokens.h b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/tokens.h
deleted file mode 100644
index dbf4a2c..0000000
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/tokens.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms.  If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder. 
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-//
-// tokens.h
-//
-
-#if !defined(__TOKENS_H)
-#define __TOKENS_H 1
-
-#include <stdio.h>
-#include "compiler/preprocessor/parser.h"
-
-#define EOF_SY (-1)
-
-typedef struct TokenBlock_Rec TokenBlock;
-
-typedef struct TokenStream_Rec {
-    struct TokenStream_Rec *next;
-    char *name;
-    TokenBlock *head;
-    TokenBlock *current;
-} TokenStream;
-
-struct TokenBlock_Rec {
-    TokenBlock *next;
-    int current;
-    int count;
-    int max;
-    unsigned char *data;
-};
-
-extern TokenStream stdlib_cpp_stream;
-
-
-TokenStream *NewTokenStream(const char *name, MemoryPool *pool);
-void DeleteTokenStream(TokenStream *pTok); 
-void RecordToken(TokenStream *pTok, int token, yystypepp * yylvalpp);
-void RewindTokenStream(TokenStream *pTok);
-int ReadToken(TokenStream *pTok, yystypepp * yylvalpp);
-int ReadFromTokenStream(TokenStream *pTok, int name, int (*final)(CPPStruct *));
-void UngetToken(int, yystypepp * yylvalpp);
-
-#if defined(CPPC_ENABLE_TOOLS)
-
-void DumpTokenStream(FILE *, TokenStream *, yystypepp * yylvalpp);
-
-#endif // defined(CPPC_ENABLE_TOOLS)
-
-#endif // !defined(__TOKENS_H)
diff --git a/Source/ThirdParty/ANGLE/src/libEGL/Config.cpp b/Source/ThirdParty/ANGLE/src/libEGL/Config.cpp
deleted file mode 100644
index 89bc8d8..0000000
--- a/Source/ThirdParty/ANGLE/src/libEGL/Config.cpp
+++ /dev/null
@@ -1,399 +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.
-//
-
-// Config.cpp: Implements the egl::Config class, describing the format, type
-// and size for an egl::Surface. Implements EGLConfig and related functionality.
-// [EGL 1.4] section 3.4 page 15.
-
-#include "libEGL/Config.h"
-
-#include <algorithm>
-#include <vector>
-
-#include "common/debug.h"
-
-using namespace std;
-
-namespace egl
-{
-Config::Config(D3DDISPLAYMODE displayMode, EGLint minInterval, EGLint maxInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight)
-    : mDisplayMode(displayMode), mRenderTargetFormat(renderTargetFormat), mDepthStencilFormat(depthStencilFormat), mMultiSample(multiSample)
-{
-    set(displayMode, minInterval, maxInterval, renderTargetFormat, depthStencilFormat, multiSample, texWidth, texHeight);
-}
-
-void Config::setDefaults()
-{
-    mBufferSize = 0;
-    mRedSize = 0;
-    mGreenSize = 0;
-    mBlueSize = 0;
-    mLuminanceSize = 0;
-    mAlphaSize = 0;
-    mAlphaMaskSize = 0;
-    mBindToTextureRGB = EGL_DONT_CARE;
-    mBindToTextureRGBA = EGL_DONT_CARE;
-    mColorBufferType = EGL_RGB_BUFFER;
-    mConfigCaveat = EGL_DONT_CARE;
-    mConfigID = EGL_DONT_CARE;
-    mConformant = 0;
-    mDepthSize = 0;
-    mLevel = 0;
-    mMatchNativePixmap = EGL_NONE;
-    mMaxPBufferWidth = 0;
-    mMaxPBufferHeight = 0;
-    mMaxPBufferPixels = 0;
-    mMaxSwapInterval = EGL_DONT_CARE;
-    mMinSwapInterval = EGL_DONT_CARE;
-    mNativeRenderable = EGL_DONT_CARE;
-    mNativeVisualID = 0;
-    mNativeVisualType = EGL_DONT_CARE;
-    mRenderableType = EGL_OPENGL_ES_BIT;
-    mSampleBuffers = 0;
-    mSamples = 0;
-    mStencilSize = 0;
-    mSurfaceType = EGL_WINDOW_BIT;
-    mTransparentType = EGL_NONE;
-    mTransparentRedValue = EGL_DONT_CARE;
-    mTransparentGreenValue = EGL_DONT_CARE;
-    mTransparentBlueValue = EGL_DONT_CARE;
-}
-
-void Config::set(D3DDISPLAYMODE displayMode, EGLint minInterval, EGLint maxInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight)
-{
-    mBindToTextureRGB = EGL_FALSE;
-    mBindToTextureRGBA = EGL_FALSE;
-    switch (renderTargetFormat)
-    {
-      case D3DFMT_A1R5G5B5:
-        mBufferSize = 16;
-        mRedSize = 5;
-        mGreenSize = 5;
-        mBlueSize = 5;
-        mAlphaSize = 1;
-        break;
-      case D3DFMT_A2R10G10B10:
-        mBufferSize = 32;
-        mRedSize = 10;
-        mGreenSize = 10;
-        mBlueSize = 10;
-        mAlphaSize = 2;
-        break;
-      case D3DFMT_A8R8G8B8:
-        mBufferSize = 32;
-        mRedSize = 8;
-        mGreenSize = 8;
-        mBlueSize = 8;
-        mAlphaSize = 8;
-        mBindToTextureRGBA = true;
-        break;
-      case D3DFMT_R5G6B5:
-        mBufferSize = 16;
-        mRedSize = 5;
-        mGreenSize = 6;
-        mBlueSize = 5;
-        mAlphaSize = 0;
-        break;
-      case D3DFMT_X8R8G8B8:
-        mBufferSize = 32;
-        mRedSize = 8;
-        mGreenSize = 8;
-        mBlueSize = 8;
-        mAlphaSize = 0;
-        mBindToTextureRGB = true;
-        break;
-      default:
-        UNREACHABLE();   // Other formats should not be valid
-    }
-
-    mLuminanceSize = 0;
-    mAlphaMaskSize = 0;
-    mColorBufferType = EGL_RGB_BUFFER;
-    mConfigCaveat = (displayMode.Format == renderTargetFormat) ? EGL_NONE : EGL_SLOW_CONFIG;
-    mConfigID = 0;
-    mConformant = EGL_OPENGL_ES2_BIT;
-
-    switch (depthStencilFormat)
-    {
-      case D3DFMT_UNKNOWN:
-        mDepthSize = 0;
-        mStencilSize = 0;
-        break;
-//    case D3DFMT_D16_LOCKABLE:
-//      mDepthSize = 16;
-//      mStencilSize = 0;
-//      break;
-      case D3DFMT_D32:
-        mDepthSize = 32;
-        mStencilSize = 0;
-        break;
-      case D3DFMT_D15S1:
-        mDepthSize = 15;
-        mStencilSize = 1;
-        break;
-      case D3DFMT_D24S8:
-        mDepthSize = 24;
-        mStencilSize = 8;
-        break;
-      case D3DFMT_D24X8:
-        mDepthSize = 24;
-        mStencilSize = 0;
-        break;
-      case D3DFMT_D24X4S4:
-        mDepthSize = 24;
-        mStencilSize = 4;
-        break;
-      case D3DFMT_D16:
-        mDepthSize = 16;
-        mStencilSize = 0;
-        break;
-//    case D3DFMT_D32F_LOCKABLE:
-//      mDepthSize = 32;
-//      mStencilSize = 0;
-//      break;
-//    case D3DFMT_D24FS8:
-//      mDepthSize = 24;
-//      mStencilSize = 8;
-//      break;
-      default:
-        UNREACHABLE();
-    }
-
-    mLevel = 0;
-    mMatchNativePixmap = EGL_NONE;
-    mMaxPBufferWidth = texWidth;
-    mMaxPBufferHeight = texHeight;
-    mMaxPBufferPixels = texWidth*texHeight;
-    mMaxSwapInterval = maxInterval;
-    mMinSwapInterval = minInterval;
-    mNativeRenderable = EGL_FALSE;
-    mNativeVisualID = 0;
-    mNativeVisualType = 0;
-    mRenderableType = EGL_OPENGL_ES2_BIT;
-    mSampleBuffers = multiSample ? 1 : 0;
-    mSamples = multiSample;
-    mSurfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
-    mTransparentType = EGL_NONE;
-    mTransparentRedValue = 0;
-    mTransparentGreenValue = 0;
-    mTransparentBlueValue = 0;
-}
-
-EGLConfig Config::getHandle() const
-{
-    return (EGLConfig)(size_t)mConfigID;
-}
-
-SortConfig::SortConfig(const EGLint *attribList)
-    : mWantRed(false), mWantGreen(false), mWantBlue(false), mWantAlpha(false), mWantLuminance(false)
-{
-    scanForWantedComponents(attribList);
-}
-
-void SortConfig::scanForWantedComponents(const EGLint *attribList)
-{
-    // [EGL] section 3.4.1 page 24
-    // Sorting rule #3: by larger total number of color bits, not considering
-    // components that are 0 or don't-care.
-    for (const EGLint *attr = attribList; attr[0] != EGL_NONE; attr += 2)
-    {
-        if (attr[1] != 0 && attr[1] != EGL_DONT_CARE)
-        {
-            switch (attr[0])
-            {
-              case EGL_RED_SIZE:       mWantRed = true; break;
-              case EGL_GREEN_SIZE:     mWantGreen = true; break;
-              case EGL_BLUE_SIZE:      mWantBlue = true; break;
-              case EGL_ALPHA_SIZE:     mWantAlpha = true; break;
-              case EGL_LUMINANCE_SIZE: mWantLuminance = true; break;
-            }
-        }
-    }
-}
-
-EGLint SortConfig::wantedComponentsSize(const Config &config) const
-{
-    EGLint total = 0;
-
-    if (mWantRed)       total += config.mRedSize;
-    if (mWantGreen)     total += config.mGreenSize;
-    if (mWantBlue)      total += config.mBlueSize;
-    if (mWantAlpha)     total += config.mAlphaSize;
-    if (mWantLuminance) total += config.mLuminanceSize;
-
-    return total;
-}
-
-bool SortConfig::operator()(const Config *x, const Config *y) const
-{
-    return (*this)(*x, *y);
-}
-
-bool SortConfig::operator()(const Config &x, const Config &y) const
-{
-    #define SORT(attribute)                        \
-        if (x.attribute != y.attribute)            \
-        {                                          \
-            return x.attribute < y.attribute;      \
-        }
-
-    META_ASSERT(EGL_NONE < EGL_SLOW_CONFIG && EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG);
-    SORT(mConfigCaveat);
-
-    META_ASSERT(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER);
-    SORT(mColorBufferType);
-
-    // By larger total number of color bits, only considering those that are requested to be > 0.
-    EGLint xComponentsSize = wantedComponentsSize(x);
-    EGLint yComponentsSize = wantedComponentsSize(y);
-    if (xComponentsSize != yComponentsSize)
-    {
-        return xComponentsSize > yComponentsSize;
-    }
-
-    SORT(mBufferSize);
-    SORT(mSampleBuffers);
-    SORT(mSamples);
-    SORT(mDepthSize);
-    SORT(mStencilSize);
-    SORT(mAlphaMaskSize);
-    SORT(mNativeVisualType);
-    SORT(mConfigID);
-
-    #undef SORT
-
-    return false;
-}
-
-// We'd like to use SortConfig to also eliminate duplicate configs.
-// This works as long as we never have two configs with different per-RGB-component layouts,
-// but the same total.
-// 5551 and 565 are different because R+G+B is different.
-// 5551 and 555 are different because bufferSize is different.
-const EGLint ConfigSet::mSortAttribs[] =
-{
-    EGL_RED_SIZE, 1,
-    EGL_GREEN_SIZE, 1,
-    EGL_BLUE_SIZE, 1,
-    EGL_LUMINANCE_SIZE, 1,
-    // BUT NOT ALPHA
-    EGL_NONE
-};
-
-ConfigSet::ConfigSet()
-    : mSet(SortConfig(mSortAttribs))
-{
-}
-
-void ConfigSet::add(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight)
-{
-    Config config(displayMode, minSwapInterval, maxSwapInterval, renderTargetFormat, depthStencilFormat, multiSample, texWidth, texHeight);
-
-    mSet.insert(config);
-}
-
-size_t ConfigSet::size() const
-{
-    return mSet.size();
-}
-
-bool ConfigSet::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig)
-{
-    vector<const Config*> passed;
-    passed.reserve(mSet.size());
-
-    for (Iterator config = mSet.begin(); config != mSet.end(); config++)
-    {
-        bool match = true;
-        const EGLint *attribute = attribList;
-
-        while (attribute[0] != EGL_NONE)
-        {
-            switch (attribute[0])
-            {
-              case EGL_BUFFER_SIZE:               match = config->mBufferSize >= attribute[1];                      break;
-              case EGL_ALPHA_SIZE:                match = config->mAlphaSize >= attribute[1];                       break;
-              case EGL_BLUE_SIZE:                 match = config->mBlueSize >= attribute[1];                        break;
-              case EGL_GREEN_SIZE:                match = config->mGreenSize >= attribute[1];                       break;
-              case EGL_RED_SIZE:                  match = config->mRedSize >= attribute[1];                         break;
-              case EGL_DEPTH_SIZE:                match = config->mDepthSize >= attribute[1];                       break;
-              case EGL_STENCIL_SIZE:              match = config->mStencilSize >= attribute[1];                     break;
-              case EGL_CONFIG_CAVEAT:             match = config->mConfigCaveat == (EGLenum) attribute[1];          break;
-              case EGL_CONFIG_ID:                 match = config->mConfigID == attribute[1];                        break;
-              case EGL_LEVEL:                     match = config->mLevel >= attribute[1];                           break;
-              case EGL_NATIVE_RENDERABLE:         match = config->mNativeRenderable == (EGLBoolean) attribute[1];   break;
-              case EGL_NATIVE_VISUAL_TYPE:        match = config->mNativeVisualType == attribute[1];                break;
-              case EGL_SAMPLES:                   match = config->mSamples >= attribute[1];                         break;
-              case EGL_SAMPLE_BUFFERS:            match = config->mSampleBuffers >= attribute[1];                   break;
-              case EGL_SURFACE_TYPE:              match = (config->mSurfaceType & attribute[1]) == attribute[1];    break;
-              case EGL_TRANSPARENT_TYPE:          match = config->mTransparentType == (EGLenum) attribute[1];       break;
-              case EGL_TRANSPARENT_BLUE_VALUE:    match = config->mTransparentBlueValue == attribute[1];            break;
-              case EGL_TRANSPARENT_GREEN_VALUE:   match = config->mTransparentGreenValue == attribute[1];           break;
-              case EGL_TRANSPARENT_RED_VALUE:     match = config->mTransparentRedValue == attribute[1];             break;
-              case EGL_BIND_TO_TEXTURE_RGB:       match = config->mBindToTextureRGB == (EGLBoolean) attribute[1];   break;
-              case EGL_BIND_TO_TEXTURE_RGBA:      match = config->mBindToTextureRGBA == (EGLBoolean) attribute[1];  break;
-              case EGL_MIN_SWAP_INTERVAL:         match = config->mMinSwapInterval == attribute[1];                 break;
-              case EGL_MAX_SWAP_INTERVAL:         match = config->mMaxSwapInterval == attribute[1];                 break;
-              case EGL_LUMINANCE_SIZE:            match = config->mLuminanceSize >= attribute[1];                   break;
-              case EGL_ALPHA_MASK_SIZE:           match = config->mAlphaMaskSize >= attribute[1];                   break;
-              case EGL_COLOR_BUFFER_TYPE:         match = config->mColorBufferType == (EGLenum) attribute[1];       break;
-              case EGL_RENDERABLE_TYPE:           match = (config->mRenderableType & attribute[1]) == attribute[1]; break;
-              case EGL_MATCH_NATIVE_PIXMAP:       match = false; UNIMPLEMENTED();                                   break;
-              case EGL_CONFORMANT:                match = (config->mConformant & attribute[1]) == attribute[1];     break;
-              case EGL_MAX_PBUFFER_WIDTH:         match = config->mMaxPBufferWidth >= attribute[1];                 break;
-              case EGL_MAX_PBUFFER_HEIGHT:        match = config->mMaxPBufferHeight >= attribute[1];                break;
-              case EGL_MAX_PBUFFER_PIXELS:        match = config->mMaxPBufferPixels >= attribute[1];                break;
-              default:
-                return false;
-            }
-
-            if (!match)
-            {
-                break;
-            }
-
-            attribute += 2;
-        }
-
-        if (match)
-        {
-            passed.push_back(&*config);
-        }
-    }
-
-    if (configs)
-    {
-        sort(passed.begin(), passed.end(), SortConfig(attribList));
-
-        EGLint index;
-        for (index = 0; index < configSize && index < static_cast<EGLint>(passed.size()); index++)
-        {
-            configs[index] = passed[index]->getHandle();
-        }
-
-        *numConfig = index;
-    }
-    else
-    {
-        *numConfig = passed.size();
-    }
-
-    return true;
-}
-
-const egl::Config *ConfigSet::get(EGLConfig configHandle)
-{
-    for (Iterator config = mSet.begin(); config != mSet.end(); config++)
-    {
-        if (config->getHandle() == configHandle)
-        {
-            return &(*config);
-        }
-    }
-
-    return NULL;
-}
-}
diff --git a/Source/ThirdParty/ANGLE/src/libEGL/Config.h b/Source/ThirdParty/ANGLE/src/libEGL/Config.h
deleted file mode 100644
index 95626ed..0000000
--- a/Source/ThirdParty/ANGLE/src/libEGL/Config.h
+++ /dev/null
@@ -1,118 +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.
-//
-
-// Config.h: Defines the egl::Config class, describing the format, type
-// and size for an egl::Surface. Implements EGLConfig and related functionality.
-// [EGL 1.4] section 3.4 page 15.
-
-#ifndef INCLUDE_CONFIG_H_
-#define INCLUDE_CONFIG_H_
-
-#define EGLAPI
-#include <EGL/egl.h>
-#include <d3d9.h>
-
-#include <set>
-
-#include "common/angleutils.h"
-
-namespace egl
-{
-class Display;
-
-class Config
-{
-  public:
-    Config(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight);
-
-    void setDefaults();
-    void set(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight);
-    EGLConfig getHandle() const;
-
-    const D3DDISPLAYMODE mDisplayMode;
-    const D3DFORMAT mRenderTargetFormat;
-    const D3DFORMAT mDepthStencilFormat;
-    const EGLint mMultiSample;
-
-    EGLint mBufferSize;              // Depth of the color buffer
-    EGLint mRedSize;                 // Bits of Red in the color buffer
-    EGLint mGreenSize;               // Bits of Green in the color buffer
-    EGLint mBlueSize;                // Bits of Blue in the color buffer
-    EGLint mLuminanceSize;           // Bits of Luminance in the color buffer
-    EGLint mAlphaSize;               // Bits of Alpha in the color buffer
-    EGLint mAlphaMaskSize;           // Bits of Alpha Mask in the mask buffer
-    EGLBoolean mBindToTextureRGB;    // True if bindable to RGB textures.
-    EGLBoolean mBindToTextureRGBA;   // True if bindable to RGBA textures.
-    EGLenum mColorBufferType;        // Color buffer type
-    EGLenum mConfigCaveat;           // Any caveats for the configuration
-    EGLint mConfigID;                // Unique EGLConfig identifier
-    EGLint mConformant;              // Whether contexts created with this config are conformant
-    EGLint mDepthSize;               // Bits of Z in the depth buffer
-    EGLint mLevel;                   // Frame buffer level
-    EGLBoolean mMatchNativePixmap;   // Match the native pixmap format
-    EGLint mMaxPBufferWidth;         // Maximum width of pbuffer
-    EGLint mMaxPBufferHeight;        // Maximum height of pbuffer
-    EGLint mMaxPBufferPixels;        // Maximum size of pbuffer
-    EGLint mMaxSwapInterval;         // Maximum swap interval
-    EGLint mMinSwapInterval;         // Minimum swap interval
-    EGLBoolean mNativeRenderable;    // EGL_TRUE if native rendering APIs can render to surface
-    EGLint mNativeVisualID;          // Handle of corresponding native visual
-    EGLint mNativeVisualType;        // Native visual type of the associated visual
-    EGLint mRenderableType;          // Which client rendering APIs are supported.
-    EGLint mSampleBuffers;           // Number of multisample buffers
-    EGLint mSamples;                 // Number of samples per pixel
-    EGLint mStencilSize;             // Bits of Stencil in the stencil buffer
-    EGLint mSurfaceType;             // Which types of EGL surfaces are supported.
-    EGLenum mTransparentType;        // Type of transparency supported
-    EGLint mTransparentRedValue;     // Transparent red value
-    EGLint mTransparentGreenValue;   // Transparent green value
-    EGLint mTransparentBlueValue;    // Transparent blue value
-};
-
-// Function object used by STL sorting routines for ordering Configs according to [EGL] section 3.4.1 page 24.
-class SortConfig
-{
-  public:
-    explicit SortConfig(const EGLint *attribList);
-
-    bool operator()(const Config *x, const Config *y) const;
-    bool operator()(const Config &x, const Config &y) const;
-
-  private:
-    void scanForWantedComponents(const EGLint *attribList);
-    EGLint wantedComponentsSize(const Config &config) const;
-
-    bool mWantRed;
-    bool mWantGreen;
-    bool mWantBlue;
-    bool mWantAlpha;
-    bool mWantLuminance;
-};
-
-class ConfigSet
-{
-    friend Display;
-
-  public:
-    ConfigSet();
-
-    void add(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight);
-    size_t size() const;
-    bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig);
-    const egl::Config *get(EGLConfig configHandle);
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(ConfigSet);
-
-    typedef std::set<Config, SortConfig> Set;
-    typedef Set::iterator Iterator;
-    Set mSet;
-
-    static const EGLint mSortAttribs[];
-};
-}
-
-#endif   // INCLUDE_CONFIG_H_
diff --git a/Source/ThirdParty/ANGLE/src/libEGL/Display.cpp b/Source/ThirdParty/ANGLE/src/libEGL/Display.cpp
deleted file mode 100644
index 0cc0b93..0000000
--- a/Source/ThirdParty/ANGLE/src/libEGL/Display.cpp
+++ /dev/null
@@ -1,1250 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Display.cpp: Implements the egl::Display class, representing the abstract
-// display on which graphics are drawn. Implements EGLDisplay.
-// [EGL 1.4] section 2.1.2 page 3.
-
-#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
-// machine, define "ANGLE_ENABLE_D3D9EX=0" in your project file.
-#if !defined(ANGLE_ENABLE_D3D9EX)
-// Enables use of the IDirect3D9Ex interface, when available
-#define ANGLE_ENABLE_D3D9EX 1
-#endif // !defined(ANGLE_ENABLE_D3D9EX)
-
-namespace egl
-{
-namespace
-{
-    typedef std::map<EGLNativeDisplayType, Display*> DisplayMap; 
-    DisplayMap displays;
-}
-
-egl::Display *Display::getDisplay(EGLNativeDisplayType displayId)
-{
-    if (displays.find(displayId) != displays.end())
-    {
-        return displays[displayId];
-    }
-
-    egl::Display *display = NULL;
-
-    if (displayId == EGL_DEFAULT_DISPLAY)
-    {
-        display = new egl::Display(displayId, (HDC)NULL, false);
-    }
-    else if (displayId == EGL_SOFTWARE_DISPLAY_ANGLE)
-    {
-        display = new egl::Display(displayId, (HDC)NULL, true);
-    }
-    else
-    {
-        // FIXME: Check if displayId is a valid display device context
-
-        display = new egl::Display(displayId, (HDC)displayId, false);
-    }
-
-    displays[displayId] = display;
-    return display;
-}
-
-Display::Display(EGLNativeDisplayType displayId, HDC deviceContext, bool software) : mDc(deviceContext)
-{
-    mD3d9Module = NULL;
-    
-    mD3d9 = NULL;
-    mD3d9Ex = NULL;
-    mDevice = NULL;
-    mDeviceEx = NULL;
-    mDeviceWindow = NULL;
-
-    mAdapter = D3DADAPTER_DEFAULT;
-
-    #if REF_RAST == 1 || defined(FORCE_REF_RAST)
-        mDeviceType = D3DDEVTYPE_REF;
-    #else
-        mDeviceType = D3DDEVTYPE_HAL;
-    #endif
-
-    mMinSwapInterval = 1;
-    mMaxSwapInterval = 1;
-    mSoftwareDevice = software;
-    mDisplayId = displayId;
-    mDeviceLost = false;
-}
-
-Display::~Display()
-{
-    terminate();
-
-    DisplayMap::iterator thisDisplay = displays.find(mDisplayId);
-
-    if (thisDisplay != displays.end())
-    {
-      displays.erase(thisDisplay);
-    }
-}
-
-bool Display::initialize()
-{
-    if (isInitialized())
-    {
-        return true;
-    }
-
-    if (mSoftwareDevice)
-    {
-      mD3d9Module = GetModuleHandle(TEXT("swiftshader_d3d9.dll"));
-    } 
-    else
-    {
-      mD3d9Module = GetModuleHandle(TEXT("d3d9.dll"));
-    }
-    if (mD3d9Module == NULL)
-    {
-        terminate();
-        return false;
-    }
-
-    typedef HRESULT (WINAPI *Direct3DCreate9ExFunc)(UINT, IDirect3D9Ex**);
-    Direct3DCreate9ExFunc Direct3DCreate9ExPtr = reinterpret_cast<Direct3DCreate9ExFunc>(GetProcAddress(mD3d9Module, "Direct3DCreate9Ex"));
-
-    // Use Direct3D9Ex if available. Among other things, this version is less
-    // inclined to report a lost context, for example when the user switches
-    // desktop. Direct3D9Ex is available in Windows Vista and later if suitable drivers are available.
-    if (ANGLE_ENABLE_D3D9EX && Direct3DCreate9ExPtr && SUCCEEDED(Direct3DCreate9ExPtr(D3D_SDK_VERSION, &mD3d9Ex)))
-    {
-        ASSERT(mD3d9Ex);
-        mD3d9Ex->QueryInterface(IID_IDirect3D9, reinterpret_cast<void**>(&mD3d9));
-        ASSERT(mD3d9);
-    }
-    else
-    {
-        mD3d9 = Direct3DCreate9(D3D_SDK_VERSION);
-    }
-
-    if (mD3d9)
-    {
-        if (mDc != NULL)
-        {
-        //  UNIMPLEMENTED();   // FIXME: Determine which adapter index the device context corresponds to
-        }
-
-        HRESULT result;
-        
-        // Give up on getting device caps after about one second.
-        for (int i = 0; i < 10; ++i)
-        {
-            result = mD3d9->GetDeviceCaps(mAdapter, mDeviceType, &mDeviceCaps);
-            
-            if (SUCCEEDED(result))
-            {
-                break;
-            }
-            else if (result == D3DERR_NOTAVAILABLE)
-            {
-                Sleep(100);   // Give the driver some time to initialize/recover
-            }
-            else if (FAILED(result))   // D3DERR_OUTOFVIDEOMEMORY, E_OUTOFMEMORY, D3DERR_INVALIDDEVICE, or another error we can't recover from
-            {
-                terminate();
-                return error(EGL_BAD_ALLOC, false);
-            }
-        }
-
-        if (mDeviceCaps.PixelShaderVersion < D3DPS_VERSION(2, 0))
-        {
-            terminate();
-            return error(EGL_NOT_INITIALIZED, false);
-        }
-
-        // When DirectX9 is running with an older DirectX8 driver, a StretchRect from a regular texture to a render target texture is not supported.
-        // This is required by Texture2D::convertToRenderTarget.
-        if ((mDeviceCaps.DevCaps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES) == 0)
-        {
-            terminate();
-            return error(EGL_NOT_INITIALIZED, false);
-        }
-
-        mMinSwapInterval = 4;
-        mMaxSwapInterval = 0;
-
-        if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_IMMEDIATE) {mMinSwapInterval = std::min(mMinSwapInterval, 0); mMaxSwapInterval = std::max(mMaxSwapInterval, 0);}
-        if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_ONE)       {mMinSwapInterval = std::min(mMinSwapInterval, 1); mMaxSwapInterval = std::max(mMaxSwapInterval, 1);}
-        if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_TWO)       {mMinSwapInterval = std::min(mMinSwapInterval, 2); mMaxSwapInterval = std::max(mMaxSwapInterval, 2);}
-        if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_THREE)     {mMinSwapInterval = std::min(mMinSwapInterval, 3); mMaxSwapInterval = std::max(mMaxSwapInterval, 3);}
-        if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_FOUR)      {mMinSwapInterval = std::min(mMinSwapInterval, 4); mMaxSwapInterval = std::max(mMaxSwapInterval, 4);}
-
-        mD3d9->GetAdapterIdentifier(mAdapter, 0, &mAdapterIdentifier);
-
-        const D3DFORMAT renderTargetFormats[] =
-        {
-            D3DFMT_A1R5G5B5,
-        //  D3DFMT_A2R10G10B10,   // The color_ramp conformance test uses ReadPixels with UNSIGNED_BYTE causing it to think that rendering skipped a colour value.
-            D3DFMT_A8R8G8B8,
-            D3DFMT_R5G6B5,
-        //  D3DFMT_X1R5G5B5,      // Has no compatible OpenGL ES renderbuffer format
-            D3DFMT_X8R8G8B8
-        };
-
-        const D3DFORMAT depthStencilFormats[] =
-        {
-            D3DFMT_UNKNOWN,
-        //  D3DFMT_D16_LOCKABLE,
-            D3DFMT_D32,
-        //  D3DFMT_D15S1,
-            D3DFMT_D24S8,
-            D3DFMT_D24X8,
-        //  D3DFMT_D24X4S4,
-            D3DFMT_D16,
-        //  D3DFMT_D32F_LOCKABLE,
-        //  D3DFMT_D24FS8
-        };
-
-        D3DDISPLAYMODE currentDisplayMode;
-        mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
-        ConfigSet configSet;
-
-        for (int formatIndex = 0; formatIndex < sizeof(renderTargetFormats) / sizeof(D3DFORMAT); formatIndex++)
-        {
-            D3DFORMAT renderTargetFormat = renderTargetFormats[formatIndex];
-
-            HRESULT result = mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET, D3DRTYPE_SURFACE, renderTargetFormat);
-
-            if (SUCCEEDED(result))
-            {
-                for (int depthStencilIndex = 0; depthStencilIndex < sizeof(depthStencilFormats) / sizeof(D3DFORMAT); depthStencilIndex++)
-                {
-                    D3DFORMAT depthStencilFormat = depthStencilFormats[depthStencilIndex];
-                    HRESULT result = D3D_OK;
-                    
-                    if(depthStencilFormat != D3DFMT_UNKNOWN)
-                    {
-                        result = mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, depthStencilFormat);
-                    }
-
-                    if (SUCCEEDED(result))
-                    {
-                        if(depthStencilFormat != D3DFMT_UNKNOWN)
-                        {
-                            result = mD3d9->CheckDepthStencilMatch(mAdapter, mDeviceType, currentDisplayMode.Format, renderTargetFormat, depthStencilFormat);
-                        }
-
-                        if (SUCCEEDED(result))
-                        {
-                            // FIXME: enumerate multi-sampling
-
-                            configSet.add(currentDisplayMode, mMinSwapInterval, mMaxSwapInterval, renderTargetFormat, depthStencilFormat, 0,
-                                          mDeviceCaps.MaxTextureWidth, mDeviceCaps.MaxTextureHeight);
-                        }
-                    }
-                }
-            }
-        }
-
-        // Give the sorted configs a unique ID and store them internally
-        EGLint index = 1;
-        for (ConfigSet::Iterator config = configSet.mSet.begin(); config != configSet.mSet.end(); config++)
-        {
-            Config configuration = *config;
-            configuration.mConfigID = index;
-            index++;
-
-            mConfigSet.mSet.insert(configuration);
-        }
-    }
-
-    if (!isInitialized())
-    {
-        terminate();
-
-        return false;
-    }
-
-    initExtensionString();
-
-    static const TCHAR windowName[] = TEXT("AngleHiddenWindow");
-    static const TCHAR className[] = TEXT("STATIC");
-
-    mDeviceWindow = CreateWindowEx(WS_EX_NOACTIVATE, className, windowName, WS_DISABLED | WS_POPUP, 0, 0, 1, 1, HWND_MESSAGE, NULL, GetModuleHandle(NULL), NULL);
-
-    if (!createDevice())
-    {
-        terminate();
-        return false;
-    }
-
-    return true;
-}
-
-void Display::terminate()
-{
-    while (!mSurfaceSet.empty())
-    {
-        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();
-        }
-
-        mDevice->Release();
-        mDevice = NULL;
-    }
-
-    if (mDeviceEx)
-    {
-        mDeviceEx->Release();
-        mDeviceEx = NULL;
-    }
-
-    if (mD3d9)
-    {
-        mD3d9->Release();
-        mD3d9 = NULL;
-    }
-
-    if (mDeviceWindow)
-    {
-        DestroyWindow(mDeviceWindow);
-        mDeviceWindow = NULL;
-    }
-    
-    if (mD3d9Ex)
-    {
-        mD3d9Ex->Release();
-        mD3d9Ex = NULL;
-    }
-
-    if (mD3d9Module)
-    {
-        mD3d9Module = NULL;
-    }
-}
-
-void Display::startScene()
-{
-    if (!mSceneStarted)
-    {
-        long result = mDevice->BeginScene();
-        if (SUCCEEDED(result)) {
-            // This is defensive checking against the device being
-            // lost at unexpected times.
-            mSceneStarted = true;
-        }
-    }
-}
-
-void Display::endScene()
-{
-    if (mSceneStarted)
-    {
-        // EndScene can fail if the device was lost, for example due
-        // to a TDR during a draw call.
-        mDevice->EndScene();
-        mSceneStarted = false;
-    }
-}
-
-bool Display::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig)
-{
-    return mConfigSet.getConfigs(configs, attribList, configSize, numConfig);
-}
-
-bool Display::getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value)
-{
-    const egl::Config *configuration = mConfigSet.get(config);
-
-    switch (attribute)
-    {
-      case EGL_BUFFER_SIZE:               *value = configuration->mBufferSize;             break;
-      case EGL_ALPHA_SIZE:                *value = configuration->mAlphaSize;              break;
-      case EGL_BLUE_SIZE:                 *value = configuration->mBlueSize;               break;
-      case EGL_GREEN_SIZE:                *value = configuration->mGreenSize;              break;
-      case EGL_RED_SIZE:                  *value = configuration->mRedSize;                break;
-      case EGL_DEPTH_SIZE:                *value = configuration->mDepthSize;              break;
-      case EGL_STENCIL_SIZE:              *value = configuration->mStencilSize;            break;
-      case EGL_CONFIG_CAVEAT:             *value = configuration->mConfigCaveat;           break;
-      case EGL_CONFIG_ID:                 *value = configuration->mConfigID;               break;
-      case EGL_LEVEL:                     *value = configuration->mLevel;                  break;
-      case EGL_NATIVE_RENDERABLE:         *value = configuration->mNativeRenderable;       break;
-      case EGL_NATIVE_VISUAL_TYPE:        *value = configuration->mNativeVisualType;       break;
-      case EGL_SAMPLES:                   *value = configuration->mSamples;                break;
-      case EGL_SAMPLE_BUFFERS:            *value = configuration->mSampleBuffers;          break;
-      case EGL_SURFACE_TYPE:              *value = configuration->mSurfaceType;            break;
-      case EGL_TRANSPARENT_TYPE:          *value = configuration->mTransparentType;        break;
-      case EGL_TRANSPARENT_BLUE_VALUE:    *value = configuration->mTransparentBlueValue;   break;
-      case EGL_TRANSPARENT_GREEN_VALUE:   *value = configuration->mTransparentGreenValue;  break;
-      case EGL_TRANSPARENT_RED_VALUE:     *value = configuration->mTransparentRedValue;    break;
-      case EGL_BIND_TO_TEXTURE_RGB:       *value = configuration->mBindToTextureRGB;       break;
-      case EGL_BIND_TO_TEXTURE_RGBA:      *value = configuration->mBindToTextureRGBA;      break;
-      case EGL_MIN_SWAP_INTERVAL:         *value = configuration->mMinSwapInterval;        break;
-      case EGL_MAX_SWAP_INTERVAL:         *value = configuration->mMaxSwapInterval;        break;
-      case EGL_LUMINANCE_SIZE:            *value = configuration->mLuminanceSize;          break;
-      case EGL_ALPHA_MASK_SIZE:           *value = configuration->mAlphaMaskSize;          break;
-      case EGL_COLOR_BUFFER_TYPE:         *value = configuration->mColorBufferType;        break;
-      case EGL_RENDERABLE_TYPE:           *value = configuration->mRenderableType;         break;
-      case EGL_MATCH_NATIVE_PIXMAP:       *value = false; UNIMPLEMENTED();                 break;
-      case EGL_CONFORMANT:                *value = configuration->mConformant;             break;
-      case EGL_MAX_PBUFFER_WIDTH:         *value = configuration->mMaxPBufferWidth;        break;
-      case EGL_MAX_PBUFFER_HEIGHT:        *value = configuration->mMaxPBufferHeight;       break;
-      case EGL_MAX_PBUFFER_PIXELS:        *value = configuration->mMaxPBufferPixels;       break;
-      default:
-        return false;
-    }
-
-    return true;
-}
-
-bool Display::createDevice()
-{
-    D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters();
-    DWORD behaviorFlags = D3DCREATE_FPU_PRESERVE | D3DCREATE_NOWINDOWCHANGES;
-
-    HRESULT result = mD3d9->CreateDevice(mAdapter, mDeviceType, mDeviceWindow, behaviorFlags | D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE, &presentParameters, &mDevice);
-
-    if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DEVICELOST)
-    {
-        return error(EGL_BAD_ALLOC, false);
-    }
-
-    if (FAILED(result))
-    {
-        result = mD3d9->CreateDevice(mAdapter, mDeviceType, mDeviceWindow, behaviorFlags | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &presentParameters, &mDevice);
-
-        if (FAILED(result))
-        {
-            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_NOTAVAILABLE || result == D3DERR_DEVICELOST);
-            return error(EGL_BAD_ALLOC, false);
-        }
-    }
-
-    if (mD3d9Ex)
-    {
-        result = mDevice->QueryInterface(IID_IDirect3DDevice9Ex, (void**) &mDeviceEx);
-        ASSERT(SUCCEEDED(result));
-    }
-
-    initializeDevice();
-
-    return true;
-}
-
-// do any one-time device initialization
-// NOTE: this is also needed after a device lost/reset
-// to reset the scene status and ensure the default states are reset.
-void Display::initializeDevice()
-{
-    // Permanent non-default states
-    mDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, TRUE);
-    mDevice->SetRenderState(D3DRS_LASTPIXEL, FALSE);
-
-    mSceneStarted = false;
-}
-
-bool Display::resetDevice()
-{
-    D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters();
-
-    HRESULT result = D3D_OK;
-    bool lost = testDeviceLost();
-    int attempts = 3;    
-
-    while (lost && attempts > 0)
-    {
-        if (mDeviceEx)
-        {
-            Sleep(500);   // Give the graphics driver some CPU time
-            result = mDeviceEx->ResetEx(&presentParameters, NULL);
-        }
-        else
-        {
-            result = mDevice->TestCooperativeLevel();
-            
-            while (result == D3DERR_DEVICELOST)
-            {
-                Sleep(100);   // Give the graphics driver some CPU time
-                result = mDevice->TestCooperativeLevel();
-            }
-
-            if (result == D3DERR_DEVICENOTRESET)
-            {
-                result = mDevice->Reset(&presentParameters);
-            }
-        }
-
-        lost = testDeviceLost();
-        attempts --;
-    }
-
-    if (FAILED(result))
-    {
-        ERR("Reset/ResetEx failed multiple times: 0x%08X", result);
-        return error(EGL_BAD_ALLOC, false);
-    }
-
-    // reset device defaults
-    initializeDevice();
-
-    return true;
-}
-
-EGLSurface Display::createWindowSurface(HWND window, EGLConfig config, const EGLint *attribList)
-{
-    const Config *configuration = mConfigSet.get(config);
-    EGLint postSubBufferSupported = EGL_FALSE;
-
-    if (attribList)
-    {
-        while (*attribList != EGL_NONE)
-        {
-            switch (attribList[0])
-            {
-              case EGL_RENDER_BUFFER:
-                switch (attribList[1])
-                {
-                  case EGL_BACK_BUFFER:
-                    break;
-                  case EGL_SINGLE_BUFFER:
-                    return error(EGL_BAD_MATCH, EGL_NO_SURFACE);   // Rendering directly to front buffer not supported
-                  default:
-                    return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
-                }
-                break;
-              case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
-                postSubBufferSupported = attribList[1];
-                break;
-              case EGL_VG_COLORSPACE:
-                return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
-              case EGL_VG_ALPHA_FORMAT:
-                return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
-              default:
-                return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
-            }
-
-            attribList += 2;
-        }
-    }
-
-    if (hasExistingWindowSurface(window))
-    {
-        return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
-    }
-
-    if (testDeviceLost()) 
-    {
-        if (!restoreLostDevice())
-            return EGL_NO_SURFACE;
-    }
-
-    Surface *surface = new Surface(this, configuration, window, postSubBufferSupported);
-
-    if (!surface->initialize())
-    {
-        delete surface;
-        return EGL_NO_SURFACE;
-    }
-
-    mSurfaceSet.insert(surface);
-
-    return success(surface);
-}
-
-EGLSurface Display::createOffscreenSurface(EGLConfig config, HANDLE shareHandle, const EGLint *attribList)
-{
-    EGLint width = 0, height = 0;
-    EGLenum textureFormat = EGL_NO_TEXTURE;
-    EGLenum textureTarget = EGL_NO_TEXTURE;
-    const Config *configuration = mConfigSet.get(config);
-
-    if (attribList)
-    {
-        while (*attribList != EGL_NONE)
-        {
-            switch (attribList[0])
-            {
-              case EGL_WIDTH:
-                width = attribList[1];
-                break;
-              case EGL_HEIGHT:
-                height = attribList[1];
-                break;
-              case EGL_LARGEST_PBUFFER:
-                if (attribList[1] != EGL_FALSE)
-                  UNIMPLEMENTED(); // FIXME
-                break;
-              case EGL_TEXTURE_FORMAT:
-                switch (attribList[1])
-                {
-                  case EGL_NO_TEXTURE:
-                  case EGL_TEXTURE_RGB:
-                  case EGL_TEXTURE_RGBA:
-                    textureFormat = attribList[1];
-                    break;
-                  default:
-                    return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
-                }
-                break;
-              case EGL_TEXTURE_TARGET:
-                switch (attribList[1])
-                {
-                  case EGL_NO_TEXTURE:
-                  case EGL_TEXTURE_2D:
-                    textureTarget = attribList[1];
-                    break;
-                  default:
-                    return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
-                }
-                break;
-              case EGL_MIPMAP_TEXTURE:
-                if (attribList[1] != EGL_FALSE)
-                  return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
-                break;
-              case EGL_VG_COLORSPACE:
-                return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
-              case EGL_VG_ALPHA_FORMAT:
-                return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
-              default:
-                return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
-            }
-
-            attribList += 2;
-        }
-    }
-
-    if (width < 0 || height < 0)
-    {
-        return error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
-    }
-
-    if (width == 0 || height == 0)
-    {
-        return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
-    }
-
-    if (textureFormat != EGL_NO_TEXTURE && !getNonPower2TextureSupport() && (!gl::isPow2(width) || !gl::isPow2(height)))
-    {
-        return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
-    }
-
-    if ((textureFormat != EGL_NO_TEXTURE && textureTarget == EGL_NO_TEXTURE) ||
-        (textureFormat == EGL_NO_TEXTURE && textureTarget != EGL_NO_TEXTURE))
-    {
-        return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
-    }
-
-    if (!(configuration->mSurfaceType & EGL_PBUFFER_BIT))
-    {
-        return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
-    }
-
-    if ((textureFormat == EGL_TEXTURE_RGB && configuration->mBindToTextureRGB != EGL_TRUE) ||
-        (textureFormat == EGL_TEXTURE_RGBA && configuration->mBindToTextureRGBA != EGL_TRUE))
-    {
-        return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
-    }
-
-    if (testDeviceLost()) 
-    {
-        if (!restoreLostDevice())
-            return EGL_NO_SURFACE;
-    }
-
-    Surface *surface = new Surface(this, configuration, shareHandle, width, height, textureFormat, textureTarget);
-
-    if (!surface->initialize())
-    {
-        delete surface;
-        return EGL_NO_SURFACE;
-    }
-
-    mSurfaceSet.insert(surface);
-
-    return success(surface);
-}
-
-EGLContext Display::createContext(EGLConfig configHandle, const gl::Context *shareContext, bool notifyResets, bool robustAccess)
-{
-    if (!mDevice)
-    {
-        if (!createDevice())
-        {
-            return NULL;
-        }
-    }
-    else if (testDeviceLost())   // Lost device
-    {
-        if (!restoreLostDevice())
-            return NULL;
-    }
-
-    const egl::Config *config = mConfigSet.get(configHandle);
-
-    gl::Context *context = glCreateContext(config, shareContext, notifyResets, robustAccess);
-    mContextSet.insert(context);
-    mDeviceLost = false;
-
-    return context;
-}
-
-bool Display::restoreLostDevice()
-{
-    for (ContextSet::iterator ctx = mContextSet.begin(); ctx != mContextSet.end(); ctx++)
-    {
-        if ((*ctx)->isResetNotificationEnabled())
-            return false;   // If reset notifications have been requested, application must delete all contexts first
-    }
- 
-    // 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++)
-    {
-        (*surface)->resetSwapChain();
-    }
-
-    return true;
-}
-
-
-void Display::destroySurface(egl::Surface *surface)
-{
-    delete surface;
-    mSurfaceSet.erase(surface);
-}
-
-void Display::destroyContext(gl::Context *context)
-{
-    glDestroyContext(context);
-    mContextSet.erase(context);
-}
-
-void Display::notifyDeviceLost()
-{
-    for (ContextSet::iterator context = mContextSet.begin(); context != mContextSet.end(); context++)
-    {
-        (*context)->markContextLost();
-    }
-    mDeviceLost = true;
-    error(EGL_CONTEXT_LOST);
-}
-
-bool Display::isDeviceLost()
-{
-    return mDeviceLost;
-}
-
-bool Display::isInitialized() const
-{
-    return mD3d9 != NULL && mConfigSet.size() > 0;
-}
-
-bool Display::isValidConfig(EGLConfig config)
-{
-    return mConfigSet.get(config) != NULL;
-}
-
-bool Display::isValidContext(gl::Context *context)
-{
-    return mContextSet.find(context) != mContextSet.end();
-}
-
-bool Display::isValidSurface(egl::Surface *surface)
-{
-    return mSurfaceSet.find(surface) != mSurfaceSet.end();
-}
-
-bool Display::hasExistingWindowSurface(HWND window)
-{
-    for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++)
-    {
-        if ((*surface)->getWindowHandle() == window)
-        {
-            return true;
-        }
-    }
-
-    return false;
-}
-
-EGLint Display::getMinSwapInterval()
-{
-    return mMinSwapInterval;
-}
-
-EGLint Display::getMaxSwapInterval()
-{
-    return mMaxSwapInterval;
-}
-
-IDirect3DDevice9 *Display::getDevice()
-{
-    if (!mDevice)
-    {
-        if (!createDevice())
-        {
-            return NULL;
-        }
-    }
-
-    return mDevice;
-}
-
-D3DCAPS9 Display::getDeviceCaps()
-{
-    return mDeviceCaps;
-}
-
-D3DADAPTER_IDENTIFIER9 *Display::getAdapterIdentifier()
-{
-    return &mAdapterIdentifier;
-}
-
-bool Display::testDeviceLost()
-{
-    if (mDeviceEx)
-    {
-        return FAILED(mDeviceEx->CheckDeviceState(NULL));
-    }
-    else if (mDevice)
-    {
-        return FAILED(mDevice->TestCooperativeLevel());
-    }
-
-    return false;   // No device yet, so no reset required
-}
-
-bool Display::testDeviceResettable()
-{
-    HRESULT status = D3D_OK;
-
-    if (mDeviceEx)
-    {
-        status = mDeviceEx->CheckDeviceState(NULL);
-    }
-    else if (mDevice)
-    {
-        status = mDevice->TestCooperativeLevel();
-    }
-
-    switch (status)
-    {
-      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);
-    }
-}
-
-bool Display::getDXT1TextureSupport()
-{
-    D3DDISPLAYMODE currentDisplayMode;
-    mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
-    return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT1));
-}
-
-bool Display::getDXT3TextureSupport()
-{
-    D3DDISPLAYMODE currentDisplayMode;
-    mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
-    return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT3));
-}
-
-bool Display::getDXT5TextureSupport()
-{
-    D3DDISPLAYMODE currentDisplayMode;
-    mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
-    return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT5));
-}
-
-// we use INTZ for depth textures in Direct3D9
-// we also want NULL texture support to ensure the we can make depth-only FBOs
-// see http://aras-p.info/texts/D3D9GPUHacks.html
-bool Display::getDepthTextureSupport() const
-{
-    D3DDISPLAYMODE currentDisplayMode;
-    mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
-    bool intz = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format,
-                                                   D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, D3DFMT_INTZ));
-    bool null = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format,
-                                                   D3DUSAGE_RENDERTARGET, D3DRTYPE_SURFACE, D3DFMT_NULL));
-
-    return intz && null;
-}
-
-bool Display::getFloat32TextureSupport(bool *filtering, bool *renderable)
-{
-    D3DDISPLAYMODE currentDisplayMode;
-    mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
-    *filtering = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER, 
-                                                    D3DRTYPE_TEXTURE, D3DFMT_A32B32G32R32F)) &&
-                 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)
-    {
-        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
-    {
-        return true;
-    }
-}
-
-bool Display::getFloat16TextureSupport(bool *filtering, bool *renderable)
-{
-    D3DDISPLAYMODE currentDisplayMode;
-    mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
-    *filtering = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER, 
-                                                    D3DRTYPE_TEXTURE, D3DFMT_A16B16G16R16F)) &&
-                 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)
-    {
-        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
-    {
-        return true;
-    }
-}
-
-bool Display::getLuminanceTextureSupport()
-{
-    D3DDISPLAYMODE currentDisplayMode;
-    mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
-    return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_L8));
-}
-
-bool Display::getLuminanceAlphaTextureSupport()
-{
-    D3DDISPLAYMODE currentDisplayMode;
-    mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
-    return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_A8L8));
-}
-
-D3DPOOL Display::getBufferPool(DWORD usage) const
-{
-    if (mD3d9Ex != NULL)
-    {
-        return D3DPOOL_DEFAULT;
-    }
-    else
-    {
-        if (!(usage & D3DUSAGE_DYNAMIC))
-        {
-            return D3DPOOL_MANAGED;
-        }
-    }
-
-    return D3DPOOL_DEFAULT;
-}
-
-D3DPOOL Display::getTexturePool(DWORD usage) const
-{
-    if (mD3d9Ex != NULL)
-    {
-        return D3DPOOL_DEFAULT;
-    }
-    else
-    {
-        if (!(usage & (D3DUSAGE_DEPTHSTENCIL | D3DUSAGE_RENDERTARGET)))
-        {
-            return D3DPOOL_MANAGED;
-        }
-    }
-
-    return D3DPOOL_DEFAULT;
-}
-
-bool Display::getEventQuerySupport()
-{
-    IDirect3DQuery9 *query = allocateEventQuery();
-    if (query)
-    {
-        freeEventQuery(query);
-        return true;
-    }
-    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;
-    presentParameters.BackBufferCount = 1;
-    presentParameters.BackBufferFormat = D3DFMT_UNKNOWN;
-    presentParameters.BackBufferWidth = 1;
-    presentParameters.BackBufferHeight = 1;
-    presentParameters.EnableAutoDepthStencil = FALSE;
-    presentParameters.Flags = 0;
-    presentParameters.hDeviceWindow = mDeviceWindow;
-    presentParameters.MultiSampleQuality = 0;
-    presentParameters.MultiSampleType = D3DMULTISAMPLE_NONE;
-    presentParameters.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
-    presentParameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
-    presentParameters.Windowed = TRUE;
-
-    return presentParameters;
-}
-
-void Display::initExtensionString()
-{
-    HMODULE swiftShader = GetModuleHandle(TEXT("swiftshader_d3d9.dll"));
-
-    mExtensionString = "";
-
-    // Multi-vendor (EXT) extensions
-    mExtensionString += "EGL_EXT_create_context_robustness ";
-
-    // ANGLE-specific extensions
-    if (shareHandleSupported())
-    {
-        mExtensionString += "EGL_ANGLE_d3d_share_handle_client_buffer ";
-    }
-
-    mExtensionString += "EGL_ANGLE_query_surface_pointer ";
-
-    if (swiftShader)
-    {
-        mExtensionString += "EGL_ANGLE_software_display ";
-    }
-
-    if (shareHandleSupported())
-    {
-        mExtensionString += "EGL_ANGLE_surface_d3d_texture_2d_share_handle ";
-    }
-
-    mExtensionString += "EGL_NV_post_sub_buffer";
-
-    std::string::size_type end = mExtensionString.find_last_not_of(' ');
-    if (end != std::string::npos)
-    {
-        mExtensionString.resize(end+1);
-    }
-}
-
-const char *Display::getExtensionString() const
-{
-    return mExtensionString.c_str();
-}
-
-bool Display::shareHandleSupported() const 
-{
-    // PIX doesn't seem to support using share handles, so disable them.
-    return isD3d9ExDevice() && !gl::perfActive();
-}
-
-// Only Direct3D 10 ready devices support all the necessary vertex texture formats.
-// We test this using D3D9 by checking support for the R16F format.
-bool Display::getVertexTextureSupport() const
-{
-    if (!isInitialized() || mDeviceCaps.PixelShaderVersion < D3DPS_VERSION(3, 0))
-    {
-        return false;
-    }
-
-    D3DDISPLAYMODE currentDisplayMode;
-    mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
-
-    HRESULT result = mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, D3DFMT_R16F);
-
-    return SUCCEEDED(result);
-}
-
-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;
-    }
-}
-
-bool Display::getInstancingSupport() const
-{
-    return mDeviceCaps.PixelShaderVersion >= D3DPS_VERSION(3, 0); 
-}
-
-}
diff --git a/Source/ThirdParty/ANGLE/src/libEGL/Display.h b/Source/ThirdParty/ANGLE/src/libEGL/Display.h
deleted file mode 100644
index 4f7dbd0..0000000
--- a/Source/ThirdParty/ANGLE/src/libEGL/Display.h
+++ /dev/null
@@ -1,145 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Display.h: Defines the egl::Display class, representing the abstract
-// display on which graphics are drawn. Implements EGLDisplay.
-// [EGL 1.4] section 2.1.2 page 3.
-
-#ifndef INCLUDE_DISPLAY_H_
-#define INCLUDE_DISPLAY_H_
-
-#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
-{
-class Display
-{
-  public:
-    ~Display();
-
-    bool initialize();
-    void terminate();
-
-    virtual void startScene();
-    virtual void endScene();
-
-    static egl::Display *getDisplay(EGLNativeDisplayType displayId);
-
-    bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig);
-    bool getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value);
-
-    EGLSurface createWindowSurface(HWND window, EGLConfig config, const EGLint *attribList);
-    EGLSurface createOffscreenSurface(EGLConfig config, HANDLE shareHandle, const EGLint *attribList);
-    EGLContext createContext(EGLConfig configHandle, const gl::Context *shareContext, bool notifyResets, bool robustAccess);
-
-    void destroySurface(egl::Surface *surface);
-    void destroyContext(gl::Context *context);
-
-    bool isInitialized() const;
-    bool isValidConfig(EGLConfig config);
-    bool isValidContext(gl::Context *context);
-    bool isValidSurface(egl::Surface *surface);
-    bool hasExistingWindowSurface(HWND window);
-
-    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 getDepthTextureSupport() const;
-    virtual bool getOcclusionQuerySupport() const;
-    virtual bool getInstancingSupport() const;
-    virtual D3DPOOL getBufferPool(DWORD usage) const;
-    virtual D3DPOOL getTexturePool(DWORD usage) const;
-
-    virtual void notifyDeviceLost();
-    bool isDeviceLost();
-
-    bool isD3d9ExDevice() const { return mD3d9Ex != NULL; }
-    const char *getExtensionString() const;
-    bool shareHandleSupported() const;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Display);
-
-    Display(EGLNativeDisplayType displayId, HDC deviceContext, bool software);
-
-    D3DPRESENT_PARAMETERS getDefaultPresentParameters();
-
-    bool restoreLostDevice();
-
-    EGLNativeDisplayType mDisplayId;
-    const HDC mDc;
-
-    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;
-    
-    typedef std::set<Surface*> SurfaceSet;
-    SurfaceSet mSurfaceSet;
-
-    ConfigSet mConfigSet;
-
-    typedef std::set<gl::Context*> ContextSet;
-    ContextSet mContextSet;
-    bool mDeviceLost;
-
-    bool createDevice();
-    void initializeDevice();
-    bool resetDevice();
-
-    void initExtensionString();
-    std::string mExtensionString;
-};
-}
-
-#endif   // INCLUDE_DISPLAY_H_
diff --git a/Source/ThirdParty/ANGLE/src/libEGL/README b/Source/ThirdParty/ANGLE/src/libEGL/README
new file mode 100644
index 0000000..e0f07c5
--- /dev/null
+++ b/Source/ThirdParty/ANGLE/src/libEGL/README
@@ -0,0 +1 @@
+This directory's contents are not synced from the ANGLE project because no platform in WebKit needs them yet.
diff --git a/Source/ThirdParty/ANGLE/src/libEGL/Surface.cpp b/Source/ThirdParty/ANGLE/src/libEGL/Surface.cpp
deleted file mode 100644
index 899b779..0000000
--- a/Source/ThirdParty/ANGLE/src/libEGL/Surface.cpp
+++ /dev/null
@@ -1,682 +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.
-//
-
-// Surface.cpp: Implements the egl::Surface class, representing a drawing surface
-// such as the client area of a window, including any back buffers.
-// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3.
-
-#include <tchar.h>
-
-#include "libEGL/Surface.h"
-
-#include "common/debug.h"
-#include "libGLESv2/Texture.h"
-
-#include "libEGL/main.h"
-#include "libEGL/Display.h"
-
-#include <dwmapi.h>
-
-namespace egl
-{
-
-namespace
-{
-const int versionWindowsVista = MAKEWORD(0x00, 0x06);
-const int versionWindows7 = MAKEWORD(0x01, 0x06);
-
-// Return the version of the operating system in a format suitable for ordering
-// comparison.
-int getComparableOSVersion()
-{
-    DWORD version = GetVersion();
-    int majorVersion = LOBYTE(LOWORD(version));
-    int minorVersion = HIBYTE(LOWORD(version));
-    return MAKEWORD(minorVersion, majorVersion);
-}
-}
-
-Surface::Surface(Display *display, const Config *config, HWND window, EGLint postSubBufferSupported) 
-    : mDisplay(display), mConfig(config), mWindow(window), mPostSubBufferSupported(postSubBufferSupported)
-{
-    mSwapChain = NULL;
-    mBackBuffer = NULL;
-    mDepthStencil = NULL;
-    mRenderTarget = NULL;
-    mOffscreenTexture = NULL;
-    mShareHandle = NULL;
-    mTexture = NULL;
-    mTextureFormat = EGL_NO_TEXTURE;
-    mTextureTarget = EGL_NO_TEXTURE;
-
-    mPixelAspectRatio = (EGLint)(1.0 * EGL_DISPLAY_SCALING);   // FIXME: Determine actual pixel aspect ratio
-    mRenderBuffer = EGL_BACK_BUFFER;
-    mSwapBehavior = EGL_BUFFER_PRESERVED;
-    mSwapInterval = -1;
-    setSwapInterval(1);
-
-    subclassWindow();
-}
-
-Surface::Surface(Display *display, const Config *config, HANDLE shareHandle, EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureType)
-    : mDisplay(display), mWindow(NULL), mConfig(config), mShareHandle(shareHandle), mWidth(width), mHeight(height), mPostSubBufferSupported(EGL_FALSE)
-{
-    mSwapChain = NULL;
-    mBackBuffer = NULL;
-    mDepthStencil = NULL;
-    mRenderTarget = NULL;
-    mOffscreenTexture = NULL;
-    mWindowSubclassed = false;
-    mTexture = NULL;
-    mTextureFormat = textureFormat;
-    mTextureTarget = textureType;
-
-    mPixelAspectRatio = (EGLint)(1.0 * EGL_DISPLAY_SCALING);   // FIXME: Determine actual pixel aspect ratio
-    mRenderBuffer = EGL_BACK_BUFFER;
-    mSwapBehavior = EGL_BUFFER_PRESERVED;
-    mSwapInterval = -1;
-    setSwapInterval(1);
-}
-
-Surface::~Surface()
-{
-    unsubclassWindow();
-    release();
-}
-
-bool Surface::initialize()
-{
-    ASSERT(!mSwapChain && !mOffscreenTexture && !mDepthStencil);
-
-    if (!resetSwapChain())
-      return false;
-
-    // Modify present parameters for this window, if we are composited,
-    // to minimize the amount of queuing done by DWM between our calls to
-    // present and the actual screen.
-    if (mWindow && (getComparableOSVersion() >= versionWindowsVista)) {
-      BOOL isComposited;
-      HRESULT result = DwmIsCompositionEnabled(&isComposited);
-      if (SUCCEEDED(result) && isComposited) {
-        DWM_PRESENT_PARAMETERS presentParams;
-        memset(&presentParams, 0, sizeof(presentParams));
-        presentParams.cbSize = sizeof(DWM_PRESENT_PARAMETERS);
-        presentParams.cBuffer = 2;
-
-        result = DwmSetPresentParameters(mWindow, &presentParams);
-        if (FAILED(result))
-          ERR("Unable to set present parameters: 0x%08X", result);
-      }
-    }
-
-    return true;
-}
-
-void Surface::release()
-{
-    if (mSwapChain)
-    {
-        mSwapChain->Release();
-        mSwapChain = NULL;
-    }
-
-    if (mBackBuffer)
-    {
-        mBackBuffer->Release();
-        mBackBuffer = NULL;
-    }
-
-    if (mDepthStencil)
-    {
-        mDepthStencil->Release();
-        mDepthStencil = NULL;
-    }
-
-    if (mRenderTarget)
-    {
-        mRenderTarget->Release();
-        mRenderTarget = NULL;
-    }
-
-    if (mOffscreenTexture)
-    {
-        mOffscreenTexture->Release();
-        mOffscreenTexture = NULL;
-    }
-
-    if (mTexture)
-    {
-        mTexture->releaseTexImage();
-        mTexture = NULL;
-    }
-
-    mShareHandle = NULL;
-}
-
-bool Surface::resetSwapChain()
-{
-    if (!mWindow)
-    {
-        return resetSwapChain(mWidth, mHeight);
-    }
-
-    RECT windowRect;
-    if (!GetClientRect(getWindowHandle(), &windowRect))
-    {
-        ASSERT(false);
-
-        ERR("Could not retrieve the window dimensions");
-        return false;
-    }
-
-    return resetSwapChain(windowRect.right - windowRect.left, windowRect.bottom - windowRect.top);
-}
-
-bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
-{
-    IDirect3DDevice9 *device = mDisplay->getDevice();
-
-    if (device == NULL)
-    {
-        return false;
-    }
-
-    // Evict all non-render target textures to system memory and release all resources
-    // before reallocating them to free up as much video memory as possible.
-    device->EvictManagedResources();
-
-    D3DPRESENT_PARAMETERS presentParameters = {0};
-    HRESULT result;
-
-    presentParameters.AutoDepthStencilFormat = mConfig->mDepthStencilFormat;
-    // We set BackBufferCount = 1 even when we use D3DSWAPEFFECT_FLIPEX.
-    // We do this because DirectX docs are a bit vague whether to set this to 1
-    // or 2. The runtime seems to accept 1, so we speculate that either it is
-    // forcing it to 2 without telling us, or better, doing something smart
-    // behind the scenes knowing that we don't need more.
-    presentParameters.BackBufferCount = 1;
-    presentParameters.BackBufferFormat = mConfig->mRenderTargetFormat;
-    presentParameters.EnableAutoDepthStencil = FALSE;
-    presentParameters.Flags = 0;
-    presentParameters.hDeviceWindow = getWindowHandle();
-    presentParameters.MultiSampleQuality = 0;                  // FIXME: Unimplemented
-    presentParameters.MultiSampleType = D3DMULTISAMPLE_NONE;   // FIXME: Unimplemented
-    presentParameters.PresentationInterval = mPresentInterval;
-    presentParameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
-    presentParameters.Windowed = TRUE;
-    presentParameters.BackBufferWidth = backbufferWidth;
-    presentParameters.BackBufferHeight = backbufferHeight;
-
-    // Release specific resources to free up memory for the new render target, while the
-    // old render target still exists for the purpose of preserving its contents.
-    if (mSwapChain)
-    {
-        mSwapChain->Release();
-        mSwapChain = NULL;
-    }
-
-    if (mBackBuffer)
-    {
-        mBackBuffer->Release();
-        mBackBuffer = NULL;
-    }
-
-    if (mOffscreenTexture)
-    {
-        mOffscreenTexture->Release();
-        mOffscreenTexture = NULL;
-    }
-
-    if (mDepthStencil)
-    {
-        mDepthStencil->Release();
-        mDepthStencil = NULL;
-    }
-
-    mShareHandle = NULL;
-    HANDLE *pShareHandle = NULL;
-    if (!mWindow && mDisplay->shareHandleSupported())
-    {
-        pShareHandle = &mShareHandle;
-    }
-
-    result = device->CreateTexture(presentParameters.BackBufferWidth, presentParameters.BackBufferHeight, 1, D3DUSAGE_RENDERTARGET,
-                                   presentParameters.BackBufferFormat, D3DPOOL_DEFAULT, &mOffscreenTexture, pShareHandle);
-    if (FAILED(result))
-    {
-        ERR("Could not create offscreen texture: %08lX", result);
-        release();
-
-        if(isDeviceLostError(result))
-        {
-            mDisplay->notifyDeviceLost();
-            return false;
-        }
-        else
-        {
-            return error(EGL_BAD_ALLOC, false);
-        }
-    }
-
-    IDirect3DSurface9 *oldRenderTarget = mRenderTarget;
-
-    result = mOffscreenTexture->GetSurfaceLevel(0, &mRenderTarget);
-    ASSERT(SUCCEEDED(result));
-
-    if (oldRenderTarget)
-    {
-        RECT rect =
-        {
-            0, 0,
-            mWidth, mHeight
-        };
-
-        if (rect.right > static_cast<LONG>(presentParameters.BackBufferWidth))
-        {
-            rect.right = presentParameters.BackBufferWidth;
-        }
-
-        if (rect.bottom > static_cast<LONG>(presentParameters.BackBufferHeight))
-        {
-            rect.bottom = presentParameters.BackBufferHeight;
-        }
-
-        mDisplay->endScene();
-
-        result = device->StretchRect(oldRenderTarget, &rect, mRenderTarget, &rect, D3DTEXF_NONE);
-        ASSERT(SUCCEEDED(result));
-
-        oldRenderTarget->Release();
-    }
-
-    if (mWindow)
-    {
-        result = device->CreateAdditionalSwapChain(&presentParameters, &mSwapChain);
-
-        if (FAILED(result))
-        {
-            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_INVALIDCALL || result == D3DERR_DEVICELOST);
-
-            ERR("Could not create additional swap chains or offscreen surfaces: %08lX", result);
-            release();
-
-            if(isDeviceLostError(result))
-            {
-                mDisplay->notifyDeviceLost();
-                return false;
-            }
-            else
-            {
-                return error(EGL_BAD_ALLOC, false);
-            }
-        }
-
-        result = mSwapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &mBackBuffer);
-        ASSERT(SUCCEEDED(result));
-    }
-
-    if (mConfig->mDepthStencilFormat != D3DFMT_UNKNOWN)
-    {
-        result = device->CreateDepthStencilSurface(presentParameters.BackBufferWidth, presentParameters.BackBufferHeight,
-                                                   presentParameters.AutoDepthStencilFormat, presentParameters.MultiSampleType,
-                                                   presentParameters.MultiSampleQuality, FALSE, &mDepthStencil, NULL);
-
-        if (FAILED(result))
-        {
-            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_INVALIDCALL);
-
-            ERR("Could not create depthstencil surface for new swap chain: 0x%08X", result);
-            release();
-
-            if(isDeviceLostError(result))
-            {
-                mDisplay->notifyDeviceLost();
-                return false;
-            }
-            else
-            {
-                return error(EGL_BAD_ALLOC, false);
-            }
-        }
-    }
-
-    mWidth = presentParameters.BackBufferWidth;
-    mHeight = presentParameters.BackBufferHeight;
-
-    mPresentIntervalDirty = false;
-    return true;
-}
-
-bool Surface::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
-{
-    if (!mSwapChain)
-    {
-        return true;
-    }
-
-    if (x + width > mWidth)
-    {
-        width = mWidth - x;
-    }
-
-    if (y + height > mHeight)
-    {
-        height = mHeight - y;
-    }
-
-    if (width == 0 || height == 0)
-    {
-        return true;
-    }
-
-    IDirect3DDevice9 *device = mDisplay->getDevice();
-
-    // Disable all pipeline operations
-    device->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
-    device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
-    device->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
-    device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
-    device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
-    device->SetRenderState(D3DRS_STENCILENABLE, FALSE);
-    device->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
-    device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED);
-    device->SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE);
-    device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
-    device->SetPixelShader(NULL);
-    device->SetVertexShader(NULL);
-
-    device->SetRenderTarget(0, mBackBuffer);
-    device->SetDepthStencilSurface(NULL);
-
-    device->SetTexture(0, mOffscreenTexture);
-    device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
-    device->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
-    device->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
-    device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
-    device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
-    device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
-    device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
-    device->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1);
-
-    D3DVIEWPORT9 viewport = {0, 0, mWidth, mHeight, 0.0f, 1.0f};
-    device->SetViewport(&viewport);
-
-    float x1 = x - 0.5f;
-    float y1 = (mHeight - y - height) - 0.5f;
-    float x2 = (x + width) - 0.5f;
-    float y2 = (mHeight - y) - 0.5f;
-
-    float u1 = x / float(mWidth);
-    float v1 = y / float(mHeight);
-    float u2 = (x + width) / float(mWidth);
-    float v2 = (y + height) / float(mHeight);
-
-    float quad[4][6] = {{x1, y1, 0.0f, 1.0f, u1, v2},
-                        {x2, y1, 0.0f, 1.0f, u2, v2},
-                        {x2, y2, 0.0f, 1.0f, u2, v1},
-                        {x1, y2, 0.0f, 1.0f, u1, v1}};   // x, y, z, rhw, u, v
-
-    mDisplay->startScene();
-    device->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, quad, 6 * sizeof(float));
-    mDisplay->endScene();
-
-    device->SetTexture(0, NULL);
-
-    RECT rect =
-    {
-        x, mHeight - y - height,
-        x + width, mHeight - y
-    };
-
-    HRESULT result = mSwapChain->Present(&rect, &rect, NULL, NULL, 0);
-
-    gl::Context *context = static_cast<gl::Context*>(glGetCurrentContext());
-    if (context)
-    {
-        context->markAllStateDirty();
-    }
-
-    if (isDeviceLostError(result))
-    {
-        mDisplay->notifyDeviceLost();
-        return false;
-    }
-
-    if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DRIVERINTERNALERROR)
-    {
-        return error(EGL_BAD_ALLOC, false);
-    }
-
-    ASSERT(SUCCEEDED(result));
-
-    checkForOutOfDateSwapChain();
-
-    return true;
-}
-
-HWND Surface::getWindowHandle()
-{
-    return mWindow;
-}
-
-
-#define kSurfaceProperty _TEXT("Egl::SurfaceOwner")
-#define kParentWndProc _TEXT("Egl::SurfaceParentWndProc")
-
-static LRESULT CALLBACK SurfaceWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
-{
-  if (message == WM_SIZE)
-  {
-      Surface* surf = reinterpret_cast<Surface*>(GetProp(hwnd, kSurfaceProperty));
-      if(surf)
-      {
-          surf->checkForOutOfDateSwapChain();
-      }
-  }
-  WNDPROC prevWndFunc = reinterpret_cast<WNDPROC >(GetProp(hwnd, kParentWndProc));
-  return CallWindowProc(prevWndFunc, hwnd, message, wparam, lparam);
-}
-
-void Surface::subclassWindow()
-{
-    if (!mWindow)
-    {
-        return;
-    }
-
-    DWORD processId;
-    DWORD threadId = GetWindowThreadProcessId(mWindow, &processId);
-    if (processId != GetCurrentProcessId() || threadId != GetCurrentThreadId())
-    {
-        return;
-    }
-
-    SetLastError(0);
-    LONG_PTR oldWndProc = SetWindowLongPtr(mWindow, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(SurfaceWindowProc));
-    if(oldWndProc == 0 && GetLastError() != ERROR_SUCCESS)
-    {
-        mWindowSubclassed = false;
-        return;
-    }
-
-    SetProp(mWindow, kSurfaceProperty, reinterpret_cast<HANDLE>(this));
-    SetProp(mWindow, kParentWndProc, reinterpret_cast<HANDLE>(oldWndProc));
-    mWindowSubclassed = true;
-}
-
-void Surface::unsubclassWindow()
-{
-    if(!mWindowSubclassed)
-    {
-        return;
-    }
-
-    // un-subclass
-    LONG_PTR parentWndFunc = reinterpret_cast<LONG_PTR>(GetProp(mWindow, kParentWndProc));
-
-    // Check the windowproc is still SurfaceWindowProc.
-    // If this assert fails, then it is likely the application has subclassed the
-    // hwnd as well and did not unsubclass before destroying its EGL context. The
-    // application should be modified to either subclass before initializing the
-    // EGL context, or to unsubclass before destroying the EGL context.
-    if(parentWndFunc)
-    {
-        LONG_PTR prevWndFunc = SetWindowLongPtr(mWindow, GWLP_WNDPROC, parentWndFunc);
-        ASSERT(prevWndFunc == reinterpret_cast<LONG_PTR>(SurfaceWindowProc));
-    }
-
-    RemoveProp(mWindow, kSurfaceProperty);
-    RemoveProp(mWindow, kParentWndProc);
-    mWindowSubclassed = false;
-}
-
-bool Surface::checkForOutOfDateSwapChain()
-{
-    RECT client;
-    if (!GetClientRect(getWindowHandle(), &client))
-    {
-        ASSERT(false);
-        return false;
-    }
-
-    // Grow the buffer now, if the window has grown. We need to grow now to avoid losing information.
-    int clientWidth = client.right - client.left;
-    int clientHeight = client.bottom - client.top;
-    bool sizeDirty = clientWidth != getWidth() || clientHeight != getHeight();
-
-    if (sizeDirty || mPresentIntervalDirty)
-    {
-        resetSwapChain(clientWidth, clientHeight);
-        if (static_cast<egl::Surface*>(getCurrentDrawSurface()) == this)
-        {
-            glMakeCurrent(glGetCurrentContext(), static_cast<egl::Display*>(getCurrentDisplay()), this);
-        }
-
-        return true;
-    }
-    return false;
-}
-
-DWORD Surface::convertInterval(EGLint interval)
-{
-    switch(interval)
-    {
-      case 0: return D3DPRESENT_INTERVAL_IMMEDIATE;
-      case 1: return D3DPRESENT_INTERVAL_ONE;
-      case 2: return D3DPRESENT_INTERVAL_TWO;
-      case 3: return D3DPRESENT_INTERVAL_THREE;
-      case 4: return D3DPRESENT_INTERVAL_FOUR;
-      default: UNREACHABLE();
-    }
-
-    return D3DPRESENT_INTERVAL_DEFAULT;
-}
-
-bool Surface::swap()
-{
-    return swapRect(0, 0, mWidth, mHeight);
-}
-
-bool Surface::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height)
-{
-    if (!mPostSubBufferSupported)
-    {
-        // Spec is not clear about how this should be handled.
-        return true;
-    }
-    
-    return swapRect(x, y, width, height);
-}
-
-EGLint Surface::getWidth() const
-{
-    return mWidth;
-}
-
-EGLint Surface::getHeight() const
-{
-    return mHeight;
-}
-
-EGLint Surface::isPostSubBufferSupported() const
-{
-    return mPostSubBufferSupported;
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *Surface::getRenderTarget()
-{
-    if (mRenderTarget)
-    {
-        mRenderTarget->AddRef();
-    }
-
-    return mRenderTarget;
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *Surface::getDepthStencil()
-{
-    if (mDepthStencil)
-    {
-        mDepthStencil->AddRef();
-    }
-
-    return mDepthStencil;
-}
-
-IDirect3DTexture9 *Surface::getOffscreenTexture()
-{
-    if (mOffscreenTexture)
-    {
-        mOffscreenTexture->AddRef();
-    }
-
-    return mOffscreenTexture;
-}
-
-void Surface::setSwapInterval(EGLint interval)
-{
-    if (mSwapInterval == interval)
-    {
-        return;
-    }
-    
-    mSwapInterval = interval;
-    mSwapInterval = std::max(mSwapInterval, mDisplay->getMinSwapInterval());
-    mSwapInterval = std::min(mSwapInterval, mDisplay->getMaxSwapInterval());
-
-    mPresentInterval = convertInterval(mSwapInterval);
-    mPresentIntervalDirty = true;
-}
-
-EGLenum Surface::getTextureFormat() const
-{
-    return mTextureFormat;
-}
-
-EGLenum Surface::getTextureTarget() const
-{
-    return mTextureTarget;
-}
-
-void Surface::setBoundTexture(gl::Texture2D *texture)
-{
-    mTexture = texture;
-}
-
-gl::Texture2D *Surface::getBoundTexture() const
-{
-    return mTexture;
-}
-
-D3DFORMAT Surface::getFormat() const
-{
-    return mConfig->mRenderTargetFormat;
-}
-}
diff --git a/Source/ThirdParty/ANGLE/src/libEGL/Surface.h b/Source/ThirdParty/ANGLE/src/libEGL/Surface.h
deleted file mode 100644
index 40bd702..0000000
--- a/Source/ThirdParty/ANGLE/src/libEGL/Surface.h
+++ /dev/null
@@ -1,112 +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.
-//
-
-// Surface.h: Defines the egl::Surface class, representing a drawing surface
-// such as the client area of a window, including any back buffers.
-// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3.
-
-#ifndef INCLUDE_SURFACE_H_
-#define INCLUDE_SURFACE_H_
-
-#define EGLAPI
-#include <EGL/egl.h>
-#include <d3d9.h>
-
-#include "common/angleutils.h"
-
-namespace gl
-{
-class Texture2D;
-}
-
-namespace egl
-{
-class Display;
-class Config;
-
-class Surface
-{
-  public:
-    Surface(Display *display, const egl::Config *config, HWND window, EGLint postSubBufferSupported);
-    Surface(Display *display, const egl::Config *config, HANDLE shareHandle, EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureTarget);
-
-    ~Surface();
-
-    bool initialize();
-    void release();
-    bool resetSwapChain();
-
-    HWND getWindowHandle();
-    bool swap();
-    bool postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height);
-
-    virtual EGLint getWidth() const;
-    virtual EGLint getHeight() const;
-
-    virtual EGLint isPostSubBufferSupported() const;
-
-    virtual IDirect3DSurface9 *getRenderTarget();
-    virtual IDirect3DSurface9 *getDepthStencil();
-    virtual IDirect3DTexture9 *getOffscreenTexture();
-
-    HANDLE getShareHandle() { return mShareHandle; }
-
-    void setSwapInterval(EGLint interval);
-    bool checkForOutOfDateSwapChain();   // Returns true if swapchain changed due to resize or interval update
-
-    virtual EGLenum getTextureFormat() const;
-    virtual EGLenum getTextureTarget() const;
-    virtual D3DFORMAT getFormat() const;
-
-    virtual void setBoundTexture(gl::Texture2D *texture);
-    virtual gl::Texture2D *getBoundTexture() const;
-
-private:
-    DISALLOW_COPY_AND_ASSIGN(Surface);
-
-    Display *const mDisplay;
-    IDirect3DSwapChain9 *mSwapChain;
-    IDirect3DSurface9 *mBackBuffer;
-    IDirect3DSurface9 *mDepthStencil;
-    IDirect3DSurface9* mRenderTarget;
-    IDirect3DTexture9* mOffscreenTexture;
-
-    HANDLE mShareHandle;
-
-    void subclassWindow();
-    void unsubclassWindow();
-    bool resetSwapChain(int backbufferWidth, int backbufferHeight);
-    bool swapRect(EGLint x, EGLint y, EGLint width, EGLint height);
-    static DWORD convertInterval(EGLint interval);
-
-    const HWND mWindow;            // Window that the surface is created for.
-    bool mWindowSubclassed;        // Indicates whether we successfully subclassed mWindow for WM_RESIZE hooking
-    const egl::Config *mConfig;    // EGL config surface was created with
-    EGLint mHeight;                // Height of surface
-    EGLint mWidth;                 // Width of surface
-//  EGLint horizontalResolution;   // Horizontal dot pitch
-//  EGLint verticalResolution;     // Vertical dot pitch
-//  EGLBoolean largestPBuffer;     // If true, create largest pbuffer possible
-//  EGLBoolean mipmapTexture;      // True if texture has mipmaps
-//  EGLint mipmapLevel;            // Mipmap level to render to
-//  EGLenum multisampleResolve;    // Multisample resolve behavior
-    EGLint mPixelAspectRatio;      // Display aspect ratio
-    EGLenum mRenderBuffer;         // Render buffer
-    EGLenum mSwapBehavior;         // Buffer swap behavior
-    EGLenum mTextureFormat;        // Format of texture: RGB, RGBA, or no texture
-    EGLenum mTextureTarget;        // Type of texture: 2D or no texture
-//  EGLenum vgAlphaFormat;         // Alpha format for OpenVG
-//  EGLenum vgColorSpace;          // Color space for OpenVG
-    EGLint mSwapInterval;
-    EGLint mPostSubBufferSupported;
-    
-    DWORD mPresentInterval;
-    bool mPresentIntervalDirty;
-    gl::Texture2D *mTexture;
-};
-}
-
-#endif   // INCLUDE_SURFACE_H_
diff --git a/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp b/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp
deleted file mode 100644
index 5089d2c..0000000
--- a/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp
+++ /dev/null
@@ -1,1181 +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.
-//
-
-// libEGL.cpp: Implements the exported EGL functions.
-
-#include <exception>
-
-#include "common/debug.h"
-#include "common/version.h"
-#include "libGLESv2/Context.h"
-#include "libGLESv2/Texture.h"
-
-#include "libEGL/main.h"
-#include "libEGL/Display.h"
-
-
-bool validateDisplay(egl::Display *display)
-{
-    if (display == EGL_NO_DISPLAY)
-    {
-        return error(EGL_BAD_DISPLAY, false);
-    }
-
-    if (!display->isInitialized())
-    {
-        return error(EGL_NOT_INITIALIZED, false);
-    }
-
-    return true;
-}
-
-bool validateConfig(egl::Display *display, EGLConfig config)
-{
-    if (!validateDisplay(display))
-    {
-        return false;
-    }
-
-    if (!display->isValidConfig(config))
-    {
-        return error(EGL_BAD_CONFIG, false);
-    }
-
-    return true;
-}
-
-bool validateContext(egl::Display *display, gl::Context *context)
-{
-    if (!validateDisplay(display))
-    {
-        return false;
-    }
-
-    if (!display->isValidContext(context))
-    {
-        return error(EGL_BAD_CONTEXT, false);
-    }
-
-    return true;
-}
-
-bool validateSurface(egl::Display *display, egl::Surface *surface)
-{
-    if (!validateDisplay(display))
-    {
-        return false;
-    }
-
-    if (!display->isValidSurface(surface))
-    {
-        return error(EGL_BAD_SURFACE, false);
-    }
-
-    return true;
-}
-
-extern "C"
-{
-EGLint __stdcall eglGetError(void)
-{
-    EVENT("()");
-
-    EGLint error = egl::getCurrentError();
-
-    if (error != EGL_SUCCESS)
-    {
-        egl::setCurrentError(EGL_SUCCESS);
-    }
-
-    return error;
-}
-
-EGLDisplay __stdcall eglGetDisplay(EGLNativeDisplayType display_id)
-{
-    EVENT("(EGLNativeDisplayType display_id = 0x%0.8p)", display_id);
-
-    try
-    {
-        return egl::Display::getDisplay(display_id);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_NO_DISPLAY);
-    }
-}
-
-EGLBoolean __stdcall eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLint *major = 0x%0.8p, EGLint *minor = 0x%0.8p)",
-          dpy, major, minor);
-
-    try
-    {
-        if (dpy == EGL_NO_DISPLAY)
-        {
-            return error(EGL_BAD_DISPLAY, EGL_FALSE);
-        }
-
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-
-        if (!display->initialize())
-        {
-            return error(EGL_NOT_INITIALIZED, EGL_FALSE);
-        }
-
-        if (major) *major = 1;
-        if (minor) *minor = 4;
-
-        return success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLBoolean __stdcall eglTerminate(EGLDisplay dpy)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p)", dpy);
-
-    try
-    {
-        if (dpy == EGL_NO_DISPLAY)
-        {
-            return error(EGL_BAD_DISPLAY, EGL_FALSE);
-        }
-
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-
-        display->terminate();
-
-        return success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-const char *__stdcall eglQueryString(EGLDisplay dpy, EGLint name)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLint name = %d)", dpy, name);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-
-        if (!validateDisplay(display))
-        {
-            return NULL;
-        }
-
-        switch (name)
-        {
-          case EGL_CLIENT_APIS:
-            return success("OpenGL_ES");
-          case EGL_EXTENSIONS:
-            return display->getExtensionString();
-          case EGL_VENDOR:
-            return success("Google Inc.");
-          case EGL_VERSION:
-            return success("1.4 (ANGLE "VERSION_STRING")");
-        }
-
-        return error(EGL_BAD_PARAMETER, (const char*)NULL);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, (const char*)NULL);
-    }
-}
-
-EGLBoolean __stdcall eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig *configs = 0x%0.8p, "
-          "EGLint config_size = %d, EGLint *num_config = 0x%0.8p)",
-          dpy, configs, config_size, num_config);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-
-        if (!validateDisplay(display))
-        {
-            return EGL_FALSE;
-        }
-
-        if (!num_config)
-        {
-            return error(EGL_BAD_PARAMETER, EGL_FALSE);
-        }
-
-        const EGLint attribList[] =    {EGL_NONE};
-
-        if (!display->getConfigs(configs, attribList, config_size, num_config))
-        {
-            return error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
-        }
-
-        return success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLBoolean __stdcall eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p, "
-          "EGLConfig *configs = 0x%0.8p, EGLint config_size = %d, EGLint *num_config = 0x%0.8p)",
-          dpy, attrib_list, configs, config_size, num_config);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-
-        if (!validateDisplay(display))
-        {
-            return EGL_FALSE;
-        }
-
-        if (!num_config)
-        {
-            return error(EGL_BAD_PARAMETER, EGL_FALSE);
-        }
-
-        const EGLint attribList[] =    {EGL_NONE};
-
-        if (!attrib_list)
-        {
-            attrib_list = attribList;
-        }
-
-        display->getConfigs(configs, attrib_list, config_size, num_config);
-
-        return success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLBoolean __stdcall eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLint attribute = %d, EGLint *value = 0x%0.8p)",
-          dpy, config, attribute, value);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-
-        if (!validateConfig(display, config))
-        {
-            return EGL_FALSE;
-        }
-
-        if (!display->getConfigAttrib(config, attribute, value))
-        {
-            return error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
-        }
-
-        return success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLSurface __stdcall eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLNativeWindowType win = 0x%0.8p, "
-          "const EGLint *attrib_list = 0x%0.8p)", dpy, config, win, attrib_list);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-
-        if (!validateConfig(display, config))
-        {
-            return EGL_NO_SURFACE;
-        }
-
-        HWND window = (HWND)win;
-
-        if (!IsWindow(window))
-        {
-            return error(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
-        }
-
-        return display->createWindowSurface(window, config, attrib_list);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
-    }
-}
-
-EGLSurface __stdcall eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p)",
-          dpy, config, attrib_list);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-
-        if (!validateConfig(display, config))
-        {
-            return EGL_NO_SURFACE;
-        }
-
-        return display->createOffscreenSurface(config, NULL, attrib_list);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
-    }
-}
-
-EGLSurface __stdcall eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLNativePixmapType pixmap = 0x%0.8p, "
-          "const EGLint *attrib_list = 0x%0.8p)", dpy, config, pixmap, attrib_list);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-
-        if (!validateConfig(display, config))
-        {
-            return EGL_NO_SURFACE;
-        }
-
-        UNIMPLEMENTED();   // FIXME
-
-        return success(EGL_NO_SURFACE);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
-    }
-}
-
-EGLBoolean __stdcall eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p)", dpy, surface);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-        egl::Surface *eglSurface = static_cast<egl::Surface*>(surface);
-
-        if (!validateSurface(display, eglSurface))
-        {
-            return EGL_FALSE;
-        }
-
-        if (surface == EGL_NO_SURFACE)
-        {
-            return error(EGL_BAD_SURFACE, EGL_FALSE);
-        }
-
-        display->destroySurface((egl::Surface*)surface);
-
-        return success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLBoolean __stdcall eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, EGLint *value = 0x%0.8p)",
-          dpy, surface, attribute, value);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-        egl::Surface *eglSurface = (egl::Surface*)surface;
-
-        if (!validateSurface(display, eglSurface))
-        {
-            return EGL_FALSE;
-        }
-
-        if (surface == EGL_NO_SURFACE)
-        {
-            return error(EGL_BAD_SURFACE, EGL_FALSE);
-        }
-
-        switch (attribute)
-        {
-          case EGL_VG_ALPHA_FORMAT:
-            UNIMPLEMENTED();   // FIXME
-            break;
-          case EGL_VG_COLORSPACE:
-            UNIMPLEMENTED();   // FIXME
-            break;
-          case EGL_CONFIG_ID:
-            UNIMPLEMENTED();   // FIXME
-            break;
-          case EGL_HEIGHT:
-            *value = eglSurface->getHeight();
-            break;
-          case EGL_HORIZONTAL_RESOLUTION:
-            UNIMPLEMENTED();   // FIXME
-            break;
-          case EGL_LARGEST_PBUFFER:
-            UNIMPLEMENTED();   // FIXME
-            break;
-          case EGL_MIPMAP_TEXTURE:
-            UNIMPLEMENTED();   // FIXME
-            break;
-          case EGL_MIPMAP_LEVEL:
-            UNIMPLEMENTED();   // FIXME
-            break;
-          case EGL_MULTISAMPLE_RESOLVE:
-            UNIMPLEMENTED();   // FIXME
-            break;
-          case EGL_PIXEL_ASPECT_RATIO:
-            UNIMPLEMENTED();   // FIXME
-            break;
-          case EGL_RENDER_BUFFER:
-            UNIMPLEMENTED();   // FIXME
-            break;
-          case EGL_SWAP_BEHAVIOR:
-            UNIMPLEMENTED();   // FIXME
-            break;
-          case EGL_TEXTURE_FORMAT:
-            UNIMPLEMENTED();   // FIXME
-            break;
-          case EGL_TEXTURE_TARGET:
-            UNIMPLEMENTED();   // FIXME
-            break;
-          case EGL_VERTICAL_RESOLUTION:
-            UNIMPLEMENTED();   // FIXME
-            break;
-          case EGL_WIDTH:
-            *value = eglSurface->getWidth();
-            break;
-          case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
-            *value = eglSurface->isPostSubBufferSupported();
-            break;
-          default:
-            return error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
-        }
-
-        return success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLBoolean __stdcall eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value)
-{
-    TRACE("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, void **value = 0x%0.8p)",
-          dpy, surface, attribute, value);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-        egl::Surface *eglSurface = (egl::Surface*)surface;
-
-        if (!validateSurface(display, eglSurface))
-        {
-            return EGL_FALSE;
-        }
-
-        if (surface == EGL_NO_SURFACE)
-        {
-            return error(EGL_BAD_SURFACE, EGL_FALSE);
-        }
-
-        switch (attribute)
-        {
-          case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
-            *value = (void*) eglSurface->getShareHandle();
-            break;
-          default:
-            return error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
-        }
-
-        return success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLBoolean __stdcall eglBindAPI(EGLenum api)
-{
-    EVENT("(EGLenum api = 0x%X)", api);
-
-    try
-    {
-        switch (api)
-        {
-          case EGL_OPENGL_API:
-          case EGL_OPENVG_API:
-            return error(EGL_BAD_PARAMETER, EGL_FALSE);   // Not supported by this implementation
-          case EGL_OPENGL_ES_API:
-            break;
-          default:
-            return error(EGL_BAD_PARAMETER, EGL_FALSE);
-        }
-
-        egl::setCurrentAPI(api);
-
-        return success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLenum __stdcall eglQueryAPI(void)
-{
-    EVENT("()");
-
-    try
-    {
-        EGLenum API = egl::getCurrentAPI();
-
-        return success(API);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLBoolean __stdcall eglWaitClient(void)
-{
-    EVENT("()");
-
-    try
-    {
-        UNIMPLEMENTED();   // FIXME
-
-        return success(0);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLBoolean __stdcall eglReleaseThread(void)
-{
-    EVENT("()");
-
-    try
-    {
-        eglMakeCurrent(EGL_NO_DISPLAY, EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_SURFACE);
-
-        return success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLSurface __stdcall eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLenum buftype = 0x%X, EGLClientBuffer buffer = 0x%0.8p, "
-          "EGLConfig config = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p)",
-          dpy, buftype, buffer, config, attrib_list);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-
-        if (!validateConfig(display, config))
-        {
-            return EGL_NO_SURFACE;
-        }
-
-        if (buftype != EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE || !buffer)
-        {
-            return error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
-        }
-
-        return display->createOffscreenSurface(config, (HANDLE)buffer, attrib_list);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
-    }
-}
-
-EGLBoolean __stdcall eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, EGLint value = %d)",
-          dpy, surface, attribute, value);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-        egl::Surface *eglSurface = static_cast<egl::Surface*>(surface);
-
-        if (!validateSurface(display, eglSurface))
-        {
-            return EGL_FALSE;
-        }
-
-        UNIMPLEMENTED();   // FIXME
-
-        return success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLBoolean __stdcall eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint buffer = %d)", dpy, surface, buffer);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-        egl::Surface *eglSurface = static_cast<egl::Surface*>(surface);
-
-        if (!validateSurface(display, eglSurface))
-        {
-            return EGL_FALSE;
-        }
-
-        if (buffer != EGL_BACK_BUFFER)
-        {
-            return error(EGL_BAD_PARAMETER, EGL_FALSE);
-        }
-
-        if (surface == EGL_NO_SURFACE || eglSurface->getWindowHandle())
-        {
-            return error(EGL_BAD_SURFACE, EGL_FALSE);
-        }
-
-        if (eglSurface->getBoundTexture())
-        {
-            return error(EGL_BAD_ACCESS, EGL_FALSE);
-        }
-
-        if (eglSurface->getTextureFormat() == EGL_NO_TEXTURE)
-        {
-            return error(EGL_BAD_MATCH, EGL_FALSE);
-        }
-
-        if (!glBindTexImage(eglSurface))
-        {
-            return error(EGL_BAD_MATCH, EGL_FALSE);
-        }
-
-        return success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLBoolean __stdcall eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint buffer = %d)", dpy, surface, buffer);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-        egl::Surface *eglSurface = static_cast<egl::Surface*>(surface);
-
-        if (!validateSurface(display, eglSurface))
-        {
-            return EGL_FALSE;
-        }
-
-        if (buffer != EGL_BACK_BUFFER)
-        {
-            return error(EGL_BAD_PARAMETER, EGL_FALSE);
-        }
-
-        if (surface == EGL_NO_SURFACE || eglSurface->getWindowHandle())
-        {
-            return error(EGL_BAD_SURFACE, EGL_FALSE);
-        }
-
-        if (eglSurface->getTextureFormat() == EGL_NO_TEXTURE)
-        {
-            return error(EGL_BAD_MATCH, EGL_FALSE);
-        }
-
-        gl::Texture2D *texture = eglSurface->getBoundTexture();
-
-        if (texture)
-        {
-            texture->releaseTexImage();
-        }
-
-        return success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLBoolean __stdcall eglSwapInterval(EGLDisplay dpy, EGLint interval)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLint interval = %d)", dpy, interval);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-
-        if (!validateDisplay(display))
-        {
-            return EGL_FALSE;
-        }
-
-        egl::Surface *draw_surface = static_cast<egl::Surface*>(egl::getCurrentDrawSurface());
-
-        if (draw_surface == NULL)
-        {
-            return error(EGL_BAD_SURFACE, EGL_FALSE);
-        }
-        
-        draw_surface->setSwapInterval(interval);
-
-        return success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLContext __stdcall eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLContext share_context = 0x%0.8p, "
-          "const EGLint *attrib_list = 0x%0.8p)", dpy, config, share_context, attrib_list);
-
-    try
-    {
-        // Get the requested client version (default is 1) and check it is two.
-        EGLint client_version = 1;
-        bool reset_notification = false;
-        bool robust_access = false;
-
-        if (attrib_list)
-        {
-            for (const EGLint* attribute = attrib_list; attribute[0] != EGL_NONE; attribute += 2)
-            {
-                switch (attribute[0])
-                {
-                  case EGL_CONTEXT_CLIENT_VERSION:
-                    client_version = attribute[1];
-                    break;
-                  case EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT:
-                    if (attribute[1] == EGL_TRUE)
-                    {
-                        return error(EGL_BAD_CONFIG, EGL_NO_CONTEXT);   // Unimplemented
-                        // robust_access = true;
-                    }
-                    else if (attribute[1] != EGL_FALSE)
-                        return error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
-                    break;
-                  case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT:
-                    if (attribute[1] == EGL_LOSE_CONTEXT_ON_RESET_EXT)
-                        reset_notification = true;
-                    else if (attribute[1] != EGL_NO_RESET_NOTIFICATION_EXT)
-                        return error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
-                    break;
-                  default:
-                    return error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
-                }
-            }
-        }
-
-        if (client_version != 2)
-        {
-            return error(EGL_BAD_CONFIG, EGL_NO_CONTEXT);
-        }
-
-        if (share_context && static_cast<gl::Context*>(share_context)->isResetNotificationEnabled() != reset_notification)
-        {
-            return error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
-        }
-
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-
-        if (!validateConfig(display, config))
-        {
-            return EGL_NO_CONTEXT;
-        }
-
-        EGLContext context = display->createContext(config, static_cast<gl::Context*>(share_context), reset_notification, robust_access);
-
-        if (context)
-            return success(context);
-        else
-            return error(EGL_CONTEXT_LOST, EGL_NO_CONTEXT);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
-    }
-}
-
-EGLBoolean __stdcall eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p)", dpy, ctx);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-        gl::Context *context = static_cast<gl::Context*>(ctx);
-
-        if (!validateContext(display, context))
-        {
-            return EGL_FALSE;
-        }
-
-        if (ctx == EGL_NO_CONTEXT)
-        {
-            return error(EGL_BAD_CONTEXT, EGL_FALSE);
-        }
-
-        display->destroyContext(context);
-
-        return success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLBoolean __stdcall eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface draw = 0x%0.8p, EGLSurface read = 0x%0.8p, EGLContext ctx = 0x%0.8p)",
-          dpy, draw, read, ctx);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-        gl::Context *context = static_cast<gl::Context*>(ctx);
-        IDirect3DDevice9 *device = display->getDevice();
-
-        if (!device || display->testDeviceLost())
-        {
-            display->notifyDeviceLost();
-            return EGL_FALSE;
-        }
-
-        if (display->isDeviceLost())
-        {
-            return error(EGL_CONTEXT_LOST, EGL_FALSE);
-        }
-
-        if (ctx != EGL_NO_CONTEXT && !validateContext(display, context))
-        {
-            return EGL_FALSE;
-        }
-
-        if ((draw != EGL_NO_SURFACE && !validateSurface(display, static_cast<egl::Surface*>(draw))) ||
-            (read != EGL_NO_SURFACE && !validateSurface(display, static_cast<egl::Surface*>(read))))
-        {
-            return EGL_FALSE;
-        }
-
-        if (draw != read)
-        {
-            UNIMPLEMENTED();   // FIXME
-        }
-
-        egl::setCurrentDisplay(dpy);
-        egl::setCurrentDrawSurface(draw);
-        egl::setCurrentReadSurface(read);
-
-        glMakeCurrent(context, display, static_cast<egl::Surface*>(draw));
-
-        return success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLContext __stdcall eglGetCurrentContext(void)
-{
-    EVENT("()");
-
-    try
-    {
-        EGLContext context = glGetCurrentContext();
-
-        return success(context);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
-    }
-}
-
-EGLSurface __stdcall eglGetCurrentSurface(EGLint readdraw)
-{
-    EVENT("(EGLint readdraw = %d)", readdraw);
-
-    try
-    {
-        if (readdraw == EGL_READ)
-        {
-            EGLSurface read = egl::getCurrentReadSurface();
-            return success(read);
-        }
-        else if (readdraw == EGL_DRAW)
-        {
-            EGLSurface draw = egl::getCurrentDrawSurface();
-            return success(draw);
-        }
-        else
-        {
-            return error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
-    }
-}
-
-EGLDisplay __stdcall eglGetCurrentDisplay(void)
-{
-    EVENT("()");
-
-    try
-    {
-        EGLDisplay dpy = egl::getCurrentDisplay();
-
-        return success(dpy);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_NO_DISPLAY);
-    }
-}
-
-EGLBoolean __stdcall eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p, EGLint attribute = %d, EGLint *value = 0x%0.8p)",
-          dpy, ctx, attribute, value);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-        gl::Context *context = static_cast<gl::Context*>(ctx);
-
-        if (!validateContext(display, context))
-        {
-            return EGL_FALSE;
-        }
-
-        UNIMPLEMENTED();   // FIXME
-
-        return success(0);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLBoolean __stdcall eglWaitGL(void)
-{
-    EVENT("()");
-
-    try
-    {
-        UNIMPLEMENTED();   // FIXME
-
-        return success(0);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLBoolean __stdcall eglWaitNative(EGLint engine)
-{
-    EVENT("(EGLint engine = %d)", engine);
-
-    try
-    {
-        UNIMPLEMENTED();   // FIXME
-
-        return success(0);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLBoolean __stdcall eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p)", dpy, surface);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-        egl::Surface *eglSurface = (egl::Surface*)surface;
-
-        if (!validateSurface(display, eglSurface))
-        {
-            return EGL_FALSE;
-        }
-
-        if (display->isDeviceLost())
-        {
-            return error(EGL_CONTEXT_LOST, EGL_FALSE);
-        }
-
-        if (surface == EGL_NO_SURFACE)
-        {
-            return error(EGL_BAD_SURFACE, EGL_FALSE);
-        }
-
-        if (eglSurface->swap())
-        {
-            return success(EGL_TRUE);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-
-    return EGL_FALSE;
-}
-
-EGLBoolean __stdcall eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLNativePixmapType target = 0x%0.8p)", dpy, surface, target);
-
-    try
-    {
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-        egl::Surface *eglSurface = static_cast<egl::Surface*>(surface);
-
-        if (!validateSurface(display, eglSurface))
-        {
-            return EGL_FALSE;
-        }
-
-        if (display->isDeviceLost())
-        {
-            return error(EGL_CONTEXT_LOST, EGL_FALSE);
-        }
-
-        UNIMPLEMENTED();   // FIXME
-
-        return success(0);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-}
-
-EGLBoolean __stdcall eglPostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height)
-{
-    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint x = %d, EGLint y = %d, EGLint width = %d, EGLint height = %d)", dpy, surface, x, y, width, height);
-
-    try
-    {
-        if (x < 0 || y < 0 || width < 0 || height < 0)
-        {
-            return error(EGL_BAD_PARAMETER, EGL_FALSE);
-        }
-
-        egl::Display *display = static_cast<egl::Display*>(dpy);
-        egl::Surface *eglSurface = static_cast<egl::Surface*>(surface);
-
-        if (!validateSurface(display, eglSurface))
-        {
-            return EGL_FALSE;
-        }
-
-        if (display->isDeviceLost())
-        {
-            return error(EGL_CONTEXT_LOST, EGL_FALSE);
-        }
-
-        if (surface == EGL_NO_SURFACE)
-        {
-            return error(EGL_BAD_SURFACE, EGL_FALSE);
-        }
-
-        if (eglSurface->postSubBuffer(x, y, width, height))
-        {
-            return success(EGL_TRUE);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-
-    return EGL_FALSE;
-}
-
-__eglMustCastToProperFunctionPointerType __stdcall eglGetProcAddress(const char *procname)
-{
-    EVENT("(const char *procname = \"%s\")", procname);
-
-    try
-    {
-        struct Extension
-        {
-            const char *name;
-            __eglMustCastToProperFunctionPointerType address;
-        };
-
-        static const Extension eglExtensions[] =
-        {
-            {"eglQuerySurfacePointerANGLE", (__eglMustCastToProperFunctionPointerType)eglQuerySurfacePointerANGLE},
-            {"eglPostSubBufferNV", (__eglMustCastToProperFunctionPointerType)eglPostSubBufferNV},
-            {"", NULL},
-        };
-
-        for (int ext = 0; ext < sizeof(eglExtensions) / sizeof(Extension); ext++)
-        {
-            if (strcmp(procname, eglExtensions[ext].name) == 0)
-            {
-                return (__eglMustCastToProperFunctionPointerType)eglExtensions[ext].address;
-            }
-        }
-
-        return glGetProcAddress(procname);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(EGL_BAD_ALLOC, (__eglMustCastToProperFunctionPointerType)NULL);
-    }
-}
-}
diff --git a/Source/ThirdParty/ANGLE/src/libEGL/libEGL.def b/Source/ThirdParty/ANGLE/src/libEGL/libEGL.def
deleted file mode 100644
index 71a5e67..0000000
--- a/Source/ThirdParty/ANGLE/src/libEGL/libEGL.def
+++ /dev/null
@@ -1,36 +0,0 @@
-LIBRARY	libEGL
-EXPORTS
-	eglBindAPI                      @14
-	eglBindTexImage                 @20
-	eglChooseConfig                 @7
-	eglCopyBuffers                  @33
-	eglCreateContext                @23
-	eglCreatePbufferFromClientBuffer        @18
-	eglCreatePbufferSurface         @10
-	eglCreatePixmapSurface          @11
-	eglCreateWindowSurface          @9
-	eglDestroyContext               @24
-	eglDestroySurface               @12
-	eglGetConfigAttrib              @8
-	eglGetConfigs                   @6
-	eglGetCurrentContext            @26
-	eglGetCurrentDisplay            @28
-	eglGetCurrentSurface            @27
-	eglGetDisplay                   @2
-	eglGetError                     @1
-	eglGetProcAddress               @34
-	eglInitialize                   @3
-	eglMakeCurrent                  @25
-	eglQueryAPI                     @15
-	eglQueryContext                 @29
-	eglQueryString                  @5
-	eglQuerySurface                 @13
-	eglReleaseTexImage              @21
-	eglReleaseThread                @17
-	eglSurfaceAttrib                @19
-	eglSwapBuffers                  @32
-	eglSwapInterval                 @22
-	eglTerminate                    @4
-	eglWaitClient                   @16
-	eglWaitGL                       @30
-	eglWaitNative                   @31
\ No newline at end of file
diff --git a/Source/ThirdParty/ANGLE/src/libEGL/libEGL.rc b/Source/ThirdParty/ANGLE/src/libEGL/libEGL.rc
deleted file mode 100644
index 5d1f32f..0000000
--- a/Source/ThirdParty/ANGLE/src/libEGL/libEGL.rc
+++ /dev/null
@@ -1,102 +0,0 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include <windows.h>
-#include "../common/version.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE 
-BEGIN
-    "resource.h\0"
-END
-
-2 TEXTINCLUDE 
-BEGIN
-    "#include ""afxres.h""\r\n"
-    "#include ""../common/version.h""\0"
-END
-
-3 TEXTINCLUDE 
-BEGIN
-    "\r\n"
-    "\0"
-END
-
-#endif    // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
- PRODUCTVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040904b0"
-        BEGIN
-            VALUE "FileDescription", "ANGLE libEGL Dynamic Link Library"
-            VALUE "FileVersion", VERSION_STRING
-            VALUE "InternalName", "libEGL"
-            VALUE "LegalCopyright", "Copyright (C) 2011 Google Inc."
-            VALUE "OriginalFilename", "libEGL.dll"
-            VALUE "PrivateBuild", VERSION_STRING
-            VALUE "ProductName", "ANGLE libEGL Dynamic Link Library"
-            VALUE "ProductVersion", VERSION_STRING
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x409, 1200
-    END
-END
-
-#endif    // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
diff --git a/Source/ThirdParty/ANGLE/src/libEGL/libEGL.vcproj b/Source/ThirdParty/ANGLE/src/libEGL/libEGL.vcproj
deleted file mode 100644
index d02d292..0000000
--- a/Source/ThirdParty/ANGLE/src/libEGL/libEGL.vcproj
+++ /dev/null
@@ -1,443 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="9.00"
-	Name="libEGL"
-	ProjectGUID="{E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}"
-	RootNamespace="libEGL"
-	Keyword="Win32Proj"
-	TargetFrameworkVersion="131072"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-		<Platform
-			Name="x64"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			CharacterSet="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="$(ProjectDir)/..; $(ProjectDir)/../../include"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBEGL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="0"
-				WarningLevel="4"
-				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702"
-				Detect64BitPortabilityProblems="false"
-				DebugInformationFormat="4"
-				WarnAsError="true"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/SAFESEH"
-				AdditionalDependencies="d3d9.lib dxguid.lib dwmapi.lib"
-				LinkIncremental="2"
-				ModuleDefinitionFile="libEGL.def"
-				DelayLoadDLLs="dwmapi.dll"
-				GenerateDebugInformation="true"
-				SubSystem="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="@echo on&#x0D;&#x0A;mkdir &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libEGL.dll&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libEGL.lib&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;@echo off&#x0D;&#x0A;"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			CharacterSet="1"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				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="4"
-				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702"
-				Detect64BitPortabilityProblems="false"
-				DebugInformationFormat="3"
-				WarnAsError="true"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/SAFESEH"
-				AdditionalDependencies="d3d9.lib dxguid.lib dwmapi.lib"
-				LinkIncremental="1"
-				ModuleDefinitionFile="libEGL.def"
-				DelayLoadDLLs="dwmapi.dll"
-				GenerateDebugInformation="true"
-				SubSystem="2"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="@echo on&#x0D;&#x0A;mkdir &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libEGL.dll&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libEGL.lib&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;@echo off&#x0D;&#x0A;"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug|x64"
-			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="2"
-			CharacterSet="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				TargetEnvironment="3"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="$(ProjectDir)/..; $(ProjectDir)/../../include"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBEGL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="0"
-				WarningLevel="4"
-				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702"
-				Detect64BitPortabilityProblems="false"
-				DebugInformationFormat="3"
-				WarnAsError="true"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/SAFESEH"
-				AdditionalDependencies="d3d9.lib dxguid.lib dwmapi.lib"
-				LinkIncremental="2"
-				ModuleDefinitionFile="libEGL.def"
-				DelayLoadDLLs="dwmapi.dll"
-				GenerateDebugInformation="true"
-				SubSystem="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="17"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="@echo on&#x0D;&#x0A;mkdir &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libEGL.dll&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libEGL.lib&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;@echo off&#x0D;&#x0A;"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|x64"
-			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="2"
-			CharacterSet="1"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				TargetEnvironment="3"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				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="4"
-				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702"
-				Detect64BitPortabilityProblems="false"
-				DebugInformationFormat="3"
-				WarnAsError="true"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/SAFESEH"
-				AdditionalDependencies="d3d9.lib dxguid.lib dwmapi.lib"
-				LinkIncremental="1"
-				ModuleDefinitionFile="libEGL.def"
-				DelayLoadDLLs="dwmapi.dll"
-				GenerateDebugInformation="true"
-				SubSystem="2"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="17"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="@echo on&#x0D;&#x0A;mkdir &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libEGL.dll&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libEGL.lib&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;@echo off&#x0D;&#x0A;"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<File
-				RelativePath=".\Config.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\Common\debug.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Display.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\libEGL.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\main.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Surface.cpp"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<File
-				RelativePath=".\Config.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Display.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\EGL\egl.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\EGL\eglext.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\EGL\eglplatform.h"
-				>
-			</File>
-			<File
-				RelativePath=".\main.h"
-				>
-			</File>
-			<File
-				RelativePath=".\resource.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Surface.h"
-				>
-			</File>
-			<File
-				RelativePath="..\common\version.h"
-				>
-			</File>
-		</Filter>
-		<File
-			RelativePath=".\libEGL.def"
-			>
-		</File>
-		<File
-			RelativePath=".\libEGL.rc"
-			>
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
diff --git a/Source/ThirdParty/ANGLE/src/libEGL/main.cpp b/Source/ThirdParty/ANGLE/src/libEGL/main.cpp
deleted file mode 100644
index 1c107bf..0000000
--- a/Source/ThirdParty/ANGLE/src/libEGL/main.cpp
+++ /dev/null
@@ -1,161 +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.
-//
-
-// main.cpp: DLL entry point and management of thread-local data.
-
-#include "libEGL/main.h"
-
-#include "common/debug.h"
-
-static DWORD currentTLS = TLS_OUT_OF_INDEXES;
-
-BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
-{
-    switch (reason)
-    {
-      case DLL_PROCESS_ATTACH:
-        {
-#if !defined(ANGLE_DISABLE_TRACE)
-            FILE *debug = fopen(TRACE_OUTPUT_FILE, "rt");
-
-            if (debug)
-            {
-                fclose(debug);
-                debug = fopen(TRACE_OUTPUT_FILE, "wt");   // Erase
-                fclose(debug);
-            }
-#endif
-
-            currentTLS = TlsAlloc();
-
-            if (currentTLS == TLS_OUT_OF_INDEXES)
-            {
-                return FALSE;
-            }
-        }
-        // Fall throught to initialize index
-      case DLL_THREAD_ATTACH:
-        {
-            egl::Current *current = (egl::Current*)LocalAlloc(LPTR, sizeof(egl::Current));
-
-            if (current)
-            {
-                TlsSetValue(currentTLS, current);
-
-                current->error = EGL_SUCCESS;
-                current->API = EGL_OPENGL_ES_API;
-                current->display = EGL_NO_DISPLAY;
-                current->drawSurface = EGL_NO_SURFACE;
-                current->readSurface = EGL_NO_SURFACE;
-            }
-        }
-        break;
-      case DLL_THREAD_DETACH:
-        {
-            void *current = TlsGetValue(currentTLS);
-
-            if (current)
-            {
-                LocalFree((HLOCAL)current);
-            }
-        }
-        break;
-      case DLL_PROCESS_DETACH:
-        {
-            void *current = TlsGetValue(currentTLS);
-
-            if (current)
-            {
-                LocalFree((HLOCAL)current);
-            }
-
-            TlsFree(currentTLS);
-        }
-        break;
-      default:
-        break;
-    }
-
-    return TRUE;
-}
-
-namespace egl
-{
-void setCurrentError(EGLint error)
-{
-    Current *current = (Current*)TlsGetValue(currentTLS);
-
-    current->error = error;
-}
-
-EGLint getCurrentError()
-{
-    Current *current = (Current*)TlsGetValue(currentTLS);
-
-    return current->error;
-}
-
-void setCurrentAPI(EGLenum API)
-{
-    Current *current = (Current*)TlsGetValue(currentTLS);
-
-    current->API = API;
-}
-
-EGLenum getCurrentAPI()
-{
-    Current *current = (Current*)TlsGetValue(currentTLS);
-
-    return current->API;
-}
-
-void setCurrentDisplay(EGLDisplay dpy)
-{
-    Current *current = (Current*)TlsGetValue(currentTLS);
-
-    current->display = dpy;
-}
-
-EGLDisplay getCurrentDisplay()
-{
-    Current *current = (Current*)TlsGetValue(currentTLS);
-
-    return current->display;
-}
-
-void setCurrentDrawSurface(EGLSurface surface)
-{
-    Current *current = (Current*)TlsGetValue(currentTLS);
-
-    current->drawSurface = surface;
-}
-
-EGLSurface getCurrentDrawSurface()
-{
-    Current *current = (Current*)TlsGetValue(currentTLS);
-
-    return current->drawSurface;
-}
-
-void setCurrentReadSurface(EGLSurface surface)
-{
-    Current *current = (Current*)TlsGetValue(currentTLS);
-
-    current->readSurface = surface;
-}
-
-EGLSurface getCurrentReadSurface()
-{
-    Current *current = (Current*)TlsGetValue(currentTLS);
-
-    return current->readSurface;
-}
-}
-
-void error(EGLint errorCode)
-{
-    egl::setCurrentError(errorCode);
-}
diff --git a/Source/ThirdParty/ANGLE/src/libEGL/main.h b/Source/ThirdParty/ANGLE/src/libEGL/main.h
deleted file mode 100644
index d09d9e6..0000000
--- a/Source/ThirdParty/ANGLE/src/libEGL/main.h
+++ /dev/null
@@ -1,61 +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.
-//
-
-// main.h: Management of thread-local data.
-
-#ifndef LIBEGL_MAIN_H_
-#define LIBEGL_MAIN_H_
-
-#define EGLAPI
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-namespace egl
-{
-struct Current
-{
-    EGLint error;
-    EGLenum API;
-    EGLDisplay display;
-    EGLSurface drawSurface;
-    EGLSurface readSurface;
-};
-
-void setCurrentError(EGLint error);
-EGLint getCurrentError();
-
-void setCurrentAPI(EGLenum API);
-EGLenum getCurrentAPI();
-
-void setCurrentDisplay(EGLDisplay dpy);
-EGLDisplay getCurrentDisplay();
-
-void setCurrentDrawSurface(EGLSurface surface);
-EGLSurface getCurrentDrawSurface();
-
-void setCurrentReadSurface(EGLSurface surface);
-EGLSurface getCurrentReadSurface();
-}
-
-void error(EGLint errorCode);
-
-template<class T>
-const T &error(EGLint errorCode, const T &returnValue)
-{
-    error(errorCode);
-
-    return returnValue;
-}
-
-template<class T>
-const T &success(const T &returnValue)
-{
-    egl::setCurrentError(EGL_SUCCESS);
-
-    return returnValue;
-}
-
-#endif  // LIBEGL_MAIN_H_
diff --git a/Source/ThirdParty/ANGLE/src/libEGL/resource.h b/Source/ThirdParty/ANGLE/src/libEGL/resource.h
deleted file mode 100644
index 3921f4c..0000000
--- a/Source/ThirdParty/ANGLE/src/libEGL/resource.h
+++ /dev/null
@@ -1,14 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by libEGL.rc
-
-// Next default values for new objects
-// 
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        101
-#define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1001
-#define _APS_NEXT_SYMED_VALUE           101
-#endif
-#endif
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Blit.cpp b/Source/ThirdParty/ANGLE/src/libGLESv2/Blit.cpp
deleted file mode 100644
index a248d69..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Blit.cpp
+++ /dev/null
@@ -1,604 +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.
-//
-
-// Blit.cpp: Surface copy utility class.
-
-#include "libGLESv2/Blit.h"
-
-#include <d3dx9.h>
-
-#include "common/debug.h"
-
-#include "libGLESv2/main.h"
-
-namespace
-{
-// Standard Vertex Shader
-// Input 0 is the homogenous position.
-// Outputs the homogenous position as-is.
-// Outputs a tex coord with (0,0) in the upper-left corner of the screen and (1,1) in the bottom right.
-// C0.X must be negative half-pixel width, C0.Y must be half-pixel height. C0.ZW must be 0.
-const char standardvs[] =
-"struct VS_OUTPUT\n"
-"{\n"
-"    float4 position : POSITION;\n"
-"    float4 texcoord : TEXCOORD0;\n"
-"};\n"
-"\n"
-"uniform float4 halfPixelSize : c0;\n"
-"\n"
-"VS_OUTPUT main(in float4 position : POSITION)\n"
-"{\n"
-"    VS_OUTPUT Out;\n"
-"\n"
-"    Out.position = position + halfPixelSize;\n"
-"    Out.texcoord = position * float4(0.5, -0.5, 1.0, 1.0) + float4(0.5, 0.5, 0, 0);\n"
-"\n"
-"    return Out;\n"
-"}\n";
-
-// Flip Y Vertex Shader
-// Input 0 is the homogenous position.
-// Outputs the homogenous position as-is.
-// Outputs a tex coord with (0,1) in the upper-left corner of the screen and (1,0) in the bottom right.
-// C0.XY must be the half-pixel width and height. C0.ZW must be 0.
-const char flipyvs[] =
-"struct VS_OUTPUT\n"
-"{\n"
-"    float4 position : POSITION;\n"
-"    float4 texcoord : TEXCOORD0;\n"
-"};\n"
-"\n"
-"uniform float4 halfPixelSize : c0;\n"
-"\n"
-"VS_OUTPUT main(in float4 position : POSITION)\n"
-"{\n"
-"    VS_OUTPUT Out;\n"
-"\n"
-"    Out.position = position + halfPixelSize;\n"
-"    Out.texcoord = position * float4(0.5, 0.5, 1.0, 1.0) + float4(0.5, 0.5, 0, 0);\n"
-"\n"
-"    return Out;\n"
-"}\n";
-
-// Passthrough Pixel Shader
-// Outputs texture 0 sampled at texcoord 0.
-const char passthroughps[] =
-"sampler2D tex : s0;\n"
-"\n"
-"float4 main(float4 texcoord : TEXCOORD0) : COLOR\n"
-"{\n"
-"	return tex2D(tex, texcoord.xy);\n"
-"}\n";
-
-// Luminance Conversion Pixel Shader
-// Outputs sample(tex0, tc0).rrra.
-// For LA output (pass A) set C0.X = 1, C0.Y = 0.
-// For L output (A = 1) set C0.X = 0, C0.Y = 1.
-const char luminanceps[] =
-"sampler2D tex : s0;\n"
-"\n"
-"uniform float4 mode : c0;\n"
-"\n"
-"float4 main(float4 texcoord : TEXCOORD0) : COLOR\n"
-"{\n"
-"	float4 tmp = tex2D(tex, texcoord.xy);\n"
-"	tmp.w = tmp.w * mode.x + mode.y;\n"
-"	return tmp.xxxw;\n"
-"}\n";
-
-// RGB/A Component Mask Pixel Shader
-// Outputs sample(tex0, tc0) with options to force RGB = 0 and/or A = 1.
-// To force RGB = 0, set C0.X = 0, otherwise C0.X = 1.
-// To force A = 1, set C0.Z = 0, C0.W = 1, otherwise C0.Z = 1, C0.W = 0.
-const char componentmaskps[] =
-"sampler2D tex : s0;\n"
-"\n"
-"uniform float4 mode : c0;\n"
-"\n"
-"float4 main(float4 texcoord : TEXCOORD0) : COLOR\n"
-"{\n"
-"	float4 tmp = tex2D(tex, texcoord.xy);\n"
-"	tmp.xyz = tmp.xyz * mode.x;\n"
-"	tmp.w = tmp.w * mode.z + mode.w;\n"
-"	return tmp;\n"
-"}\n";
-
-}
-
-namespace gl
-{
-
-const char * const Blit::mShaderSource[] =
-{
-    standardvs,
-    flipyvs,
-    passthroughps,
-    luminanceps,
-    componentmaskps
-};
-
-Blit::Blit(Context *context)
-  : mContext(context), mQuadVertexBuffer(NULL), mQuadVertexDeclaration(NULL), mSavedRenderTarget(NULL), mSavedDepthStencil(NULL), mSavedStateBlock(NULL)
-{
-    initGeometry();
-    memset(mCompiledShaders, 0, sizeof(mCompiledShaders));
-}
-
-Blit::~Blit()
-{
-    if (mSavedStateBlock) mSavedStateBlock->Release();
-    if (mQuadVertexBuffer) mQuadVertexBuffer->Release();
-    if (mQuadVertexDeclaration) mQuadVertexDeclaration->Release();
-
-    for (int i = 0; i < SHADER_COUNT; i++)
-    {
-        if (mCompiledShaders[i])
-        {
-            mCompiledShaders[i]->Release();
-        }
-    }
-}
-
-void Blit::initGeometry()
-{
-    static const float quad[] =
-    {
-        -1, -1,
-        -1,  1,
-         1, -1,
-         1,  1
-    };
-
-    IDirect3DDevice9 *device = getDevice();
-
-    HRESULT result = device->CreateVertexBuffer(sizeof(quad), D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &mQuadVertexBuffer, NULL);
-
-    if (FAILED(result))
-    {
-        ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
-        return error(GL_OUT_OF_MEMORY);
-    }
-
-    void *lockPtr = NULL;
-    result = mQuadVertexBuffer->Lock(0, 0, &lockPtr, 0);
-
-    if (FAILED(result) || lockPtr == NULL)
-    {
-        ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
-        return error(GL_OUT_OF_MEMORY);
-    }
-
-    memcpy(lockPtr, quad, sizeof(quad));
-    mQuadVertexBuffer->Unlock();
-
-    static const D3DVERTEXELEMENT9 elements[] =
-    {
-        { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
-        D3DDECL_END()
-    };
-
-    result = device->CreateVertexDeclaration(elements, &mQuadVertexDeclaration);
-
-    if (FAILED(result))
-    {
-        ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-template <class D3DShaderType>
-bool Blit::setShader(ShaderId source, const char *profile,
-                     HRESULT (WINAPI IDirect3DDevice9::*createShader)(const DWORD *, D3DShaderType**),
-                     HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType*))
-{
-    IDirect3DDevice9 *device = getDevice();
-
-    D3DShaderType *shader;
-
-    if (mCompiledShaders[source] != NULL)
-    {
-        shader = static_cast<D3DShaderType*>(mCompiledShaders[source]);
-    }
-    else
-    {
-        ID3DXBuffer *shaderCode;
-        HRESULT hr = D3DXCompileShader(mShaderSource[source], strlen(mShaderSource[source]), NULL, NULL, "main", profile, 0, &shaderCode, NULL, NULL);
-
-        if (FAILED(hr))
-        {
-            ERR("Failed to compile %s shader for blit operation %d, error 0x%08X.", profile, (int)source, hr);
-            return false;
-        }
-
-        hr = (device->*createShader)(static_cast<const DWORD*>(shaderCode->GetBufferPointer()), &shader);
-        if (FAILED(hr))
-        {
-            shaderCode->Release();
-            ERR("Failed to create %s shader for blit operation %d, error 0x%08X.", profile, (int)source, hr);
-            return false;
-        }
-
-        shaderCode->Release();
-
-        mCompiledShaders[source] = shader;
-    }
-
-    HRESULT hr = (device->*setShader)(shader);
-
-    if (FAILED(hr))
-    {
-        ERR("Failed to set %s shader for blit operation %d, error 0x%08X.", profile, (int)source, hr);
-        return false;
-    }
-
-    return true;
-}
-
-bool Blit::setVertexShader(ShaderId shader)
-{
-    return setShader<IDirect3DVertexShader9>(shader, mContext->supportsShaderModel3() ? "vs_3_0" : "vs_2_0", &IDirect3DDevice9::CreateVertexShader, &IDirect3DDevice9::SetVertexShader);
-}
-
-bool Blit::setPixelShader(ShaderId shader)
-{
-    return setShader<IDirect3DPixelShader9>(shader, mContext->supportsShaderModel3() ? "ps_3_0" : "ps_2_0", &IDirect3DDevice9::CreatePixelShader, &IDirect3DDevice9::SetPixelShader);
-}
-
-RECT Blit::getSurfaceRect(IDirect3DSurface9 *surface) const
-{
-    D3DSURFACE_DESC desc;
-    surface->GetDesc(&desc);
-
-    RECT rect;
-    rect.left = 0;
-    rect.top = 0;
-    rect.right = desc.Width;
-    rect.bottom = desc.Height;
-
-    return rect;
-}
-
-bool Blit::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
-{
-    IDirect3DTexture9 *texture = copySurfaceToTexture(source, getSurfaceRect(source));
-    if (!texture)
-    {
-        return false;
-    }
-
-    IDirect3DDevice9 *device = getDevice();
-
-    saveState();
-
-    device->SetTexture(0, texture);
-    device->SetRenderTarget(0, dest);
-
-    setVertexShader(SHADER_VS_STANDARD);
-    setPixelShader(SHADER_PS_PASSTHROUGH);
-
-    setCommonBlitState();
-    device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
-    device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
-
-    setViewport(getSurfaceRect(dest), 0, 0);
-
-    render();
-
-    texture->Release();
-
-    restoreState();
-
-    return true;
-}
-
-bool Blit::copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest)
-{
-    IDirect3DDevice9 *device = getDevice();
-
-    D3DSURFACE_DESC sourceDesc;
-    D3DSURFACE_DESC destDesc;
-    source->GetDesc(&sourceDesc);
-    dest->GetDesc(&destDesc);
-
-    if (sourceDesc.Format == destDesc.Format && destDesc.Usage & D3DUSAGE_RENDERTARGET)   // Can use StretchRect
-    {
-        RECT destRect = {xoffset, yoffset, xoffset + (sourceRect.right - sourceRect.left), yoffset + (sourceRect.bottom - sourceRect.top)};
-        HRESULT result = device->StretchRect(source, &sourceRect, dest, &destRect, D3DTEXF_POINT);
-
-        if (FAILED(result))
-        {
-            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
-            return error(GL_OUT_OF_MEMORY, false);
-        }
-    }
-    else
-    {
-        return formatConvert(source, sourceRect, destFormat, xoffset, yoffset, dest);
-    }
-
-    return true;
-}
-
-bool Blit::formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest)
-{
-    IDirect3DTexture9 *texture = copySurfaceToTexture(source, sourceRect);
-    if (!texture)
-    {
-        return false;
-    }
-
-    IDirect3DDevice9 *device = getDevice();
-
-    saveState();
-
-    device->SetTexture(0, texture);
-    device->SetRenderTarget(0, dest);
-
-    setViewport(sourceRect, xoffset, yoffset);
-
-    setCommonBlitState();
-    if (setFormatConvertShaders(destFormat))
-    {
-        render();
-    }
-
-    texture->Release();
-
-    restoreState();
-
-    return true;
-}
-
-bool Blit::setFormatConvertShaders(GLenum destFormat)
-{
-    bool okay = setVertexShader(SHADER_VS_STANDARD);
-
-    switch (destFormat)
-    {
-      default: UNREACHABLE();
-      case GL_RGBA:
-      case GL_BGRA_EXT:
-      case GL_RGB:
-      case GL_ALPHA:
-        okay = okay && setPixelShader(SHADER_PS_COMPONENTMASK);
-        break;
-
-      case GL_LUMINANCE:
-      case GL_LUMINANCE_ALPHA:
-        okay = okay && setPixelShader(SHADER_PS_LUMINANCE);
-        break;
-    }
-
-    if (!okay)
-    {
-        return false;
-    }
-
-    enum { X = 0, Y = 1, Z = 2, W = 3 };
-
-    // The meaning of this constant depends on the shader that was selected.
-    // See the shader assembly code above for details.
-    float psConst0[4] = { 0, 0, 0, 0 };
-
-    switch (destFormat)
-    {
-      default: UNREACHABLE();
-      case GL_RGBA:
-      case GL_BGRA_EXT:
-        psConst0[X] = 1;
-        psConst0[Z] = 1;
-        break;
-
-      case GL_RGB:
-        psConst0[X] = 1;
-        psConst0[W] = 1;
-        break;
-
-      case GL_ALPHA:
-        psConst0[Z] = 1;
-        break;
-
-      case GL_LUMINANCE:
-        psConst0[Y] = 1;
-        break;
-
-      case GL_LUMINANCE_ALPHA:
-        psConst0[X] = 1;
-        break;
-    }
-
-    getDevice()->SetPixelShaderConstantF(0, psConst0, 1);
-
-    return true;
-}
-
-IDirect3DTexture9 *Blit::copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &sourceRect)
-{
-    if (!surface)
-    {
-        return NULL;
-    }
-
-    egl::Display *display = getDisplay();
-    IDirect3DDevice9 *device = getDevice();
-
-    D3DSURFACE_DESC sourceDesc;
-    surface->GetDesc(&sourceDesc);
-
-    // Copy the render target into a texture
-    IDirect3DTexture9 *texture;
-    HRESULT result = device->CreateTexture(sourceRect.right - sourceRect.left, sourceRect.bottom - sourceRect.top, 1, D3DUSAGE_RENDERTARGET, sourceDesc.Format, D3DPOOL_DEFAULT, &texture, NULL);
-
-    if (FAILED(result))
-    {
-        ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
-        return error(GL_OUT_OF_MEMORY, (IDirect3DTexture9*)NULL);
-    }
-
-    IDirect3DSurface9 *textureSurface;
-    result = texture->GetSurfaceLevel(0, &textureSurface);
-
-    if (FAILED(result))
-    {
-        ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
-        texture->Release();
-        return error(GL_OUT_OF_MEMORY, (IDirect3DTexture9*)NULL);
-    }
-
-    display->endScene();
-    result = device->StretchRect(surface, &sourceRect, textureSurface, NULL, D3DTEXF_NONE);
-
-    textureSurface->Release();
-
-    if (FAILED(result))
-    {
-        ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
-        texture->Release();
-        return error(GL_OUT_OF_MEMORY, (IDirect3DTexture9*)NULL);
-    }
-
-    return texture;
-}
-
-void Blit::setViewport(const RECT &sourceRect, GLint xoffset, GLint yoffset)
-{
-    IDirect3DDevice9 *device = getDevice();
-
-    D3DVIEWPORT9 vp;
-    vp.X      = xoffset;
-    vp.Y      = yoffset;
-    vp.Width  = sourceRect.right - sourceRect.left;
-    vp.Height = sourceRect.bottom - sourceRect.top;
-    vp.MinZ   = 0.0f;
-    vp.MaxZ   = 1.0f;
-    device->SetViewport(&vp);
-
-    float halfPixelAdjust[4] = { -1.0f/vp.Width, 1.0f/vp.Height, 0, 0 };
-    device->SetVertexShaderConstantF(0, halfPixelAdjust, 1);
-}
-
-void Blit::setCommonBlitState()
-{
-    IDirect3DDevice9 *device = getDevice();
-
-    device->SetDepthStencilSurface(NULL);
-
-    device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
-    device->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
-    device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
-    device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
-    device->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
-    device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED);
-    device->SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE);
-    device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
-
-    device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
-    device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
-    device->SetSamplerState(0, D3DSAMP_SRGBTEXTURE, FALSE);
-    device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
-    device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
-
-    RECT scissorRect = {0};   // Scissoring is disabled for flipping, but we need this to capture and restore the old rectangle
-    device->SetScissorRect(&scissorRect);
-
-    for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
-    {
-        device->SetStreamSourceFreq(i, 1);
-    }
-}
-
-void Blit::render()
-{
-    egl::Display *display = getDisplay();
-    IDirect3DDevice9 *device = getDevice();
-
-    HRESULT hr = device->SetStreamSource(0, mQuadVertexBuffer, 0, 2 * sizeof(float));
-    hr = device->SetVertexDeclaration(mQuadVertexDeclaration);
-
-    display->startScene();
-    hr = device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
-}
-
-void Blit::saveState()
-{
-    IDirect3DDevice9 *device = getDevice();
-
-    HRESULT hr;
-
-    device->GetDepthStencilSurface(&mSavedDepthStencil);
-    device->GetRenderTarget(0, &mSavedRenderTarget);
-
-    if (mSavedStateBlock == NULL)
-    {
-        hr = device->BeginStateBlock();
-        ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
-
-        setCommonBlitState();
-
-        static const float dummyConst[4] = { 0, 0, 0, 0 };
-
-        device->SetVertexShader(NULL);
-        device->SetVertexShaderConstantF(0, dummyConst, 1);
-        device->SetPixelShader(NULL);
-        device->SetPixelShaderConstantF(0, dummyConst, 1);
-
-        D3DVIEWPORT9 dummyVp;
-        dummyVp.X = 0;
-        dummyVp.Y = 0;
-        dummyVp.Width = 1;
-        dummyVp.Height = 1;
-        dummyVp.MinZ = 0;
-        dummyVp.MaxZ = 1;
-
-        device->SetViewport(&dummyVp);
-
-        device->SetTexture(0, NULL);
-
-        device->SetStreamSource(0, mQuadVertexBuffer, 0, 0);
-
-        device->SetVertexDeclaration(mQuadVertexDeclaration);
-
-        hr = device->EndStateBlock(&mSavedStateBlock);
-        ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
-    }
-
-    ASSERT(mSavedStateBlock != NULL);
-
-    if (mSavedStateBlock != NULL)
-    {
-        hr = mSavedStateBlock->Capture();
-        ASSERT(SUCCEEDED(hr));
-    }
-}
-
-void Blit::restoreState()
-{
-    IDirect3DDevice9 *device = getDevice();
-
-    device->SetDepthStencilSurface(mSavedDepthStencil);
-    if (mSavedDepthStencil != NULL)
-    {
-        mSavedDepthStencil->Release();
-        mSavedDepthStencil = NULL;
-    }
-
-    device->SetRenderTarget(0, mSavedRenderTarget);
-    if (mSavedRenderTarget != NULL)
-    {
-        mSavedRenderTarget->Release();
-        mSavedRenderTarget = NULL;
-    }
-
-    ASSERT(mSavedStateBlock != NULL);
-
-    if (mSavedStateBlock != NULL)
-    {
-        mSavedStateBlock->Apply();
-    }
-}
-
-}
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Blit.h b/Source/ThirdParty/ANGLE/src/libGLESv2/Blit.h
deleted file mode 100644
index 8928ecd..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Blit.h
+++ /dev/null
@@ -1,94 +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.
-//
-
-// Blit.cpp: Surface copy utility class.
-
-#ifndef LIBGLESV2_BLIT_H_
-#define LIBGLESV2_BLIT_H_
-
-#include <map>
-
-#define GL_APICALL
-#include <GLES2/gl2.h>
-
-#include <d3d9.h>
-
-#include "common/angleutils.h"
-
-namespace gl
-{
-class Context;
-
-class Blit
-{
-  public:
-    explicit Blit(Context *context);
-    ~Blit();
-
-    // Copy from source surface to dest surface.
-    // sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left)
-    bool copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest);
-
-    // Copy from source surface to dest surface.
-    // sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left)
-    // source is interpreted as RGBA and destFormat specifies the desired result format. For example, if destFormat = GL_RGB, the alpha channel will be forced to 0.
-    bool formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest);
-
-    // 2x2 box filter sample from source to dest.
-    // Requires that source is RGB(A) and dest has the same format as source.
-    bool boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest);
-
-  private:
-    Context *mContext;
-
-    IDirect3DVertexBuffer9 *mQuadVertexBuffer;
-    IDirect3DVertexDeclaration9 *mQuadVertexDeclaration;
-
-    void initGeometry();
-
-    bool setFormatConvertShaders(GLenum destFormat);
-
-    IDirect3DTexture9 *copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &sourceRect);
-    void setViewport(const RECT &sourceRect, GLint xoffset, GLint yoffset);
-    void setCommonBlitState();
-    RECT getSurfaceRect(IDirect3DSurface9 *surface) const;
-
-    // This enum is used to index mCompiledShaders and mShaderSource.
-    enum ShaderId
-    {
-        SHADER_VS_STANDARD,
-        SHADER_VS_FLIPY,
-        SHADER_PS_PASSTHROUGH,
-        SHADER_PS_LUMINANCE,
-        SHADER_PS_COMPONENTMASK,
-        SHADER_COUNT
-    };
-
-    static const char * const mShaderSource[];
-
-    // This actually contains IDirect3DVertexShader9 or IDirect3DPixelShader9 casted to IUnknown.
-    IUnknown *mCompiledShaders[SHADER_COUNT];
-
-    template <class D3DShaderType>
-    bool setShader(ShaderId source, const char *profile,
-                   HRESULT (WINAPI IDirect3DDevice9::*createShader)(const DWORD *, D3DShaderType **),
-                   HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType*));
-
-    bool setVertexShader(ShaderId shader);
-    bool setPixelShader(ShaderId shader);
-    void render();
-
-    void saveState();
-    void restoreState();
-    IDirect3DStateBlock9 *mSavedStateBlock;
-    IDirect3DSurface9 *mSavedRenderTarget;
-    IDirect3DSurface9 *mSavedDepthStencil;
-
-    DISALLOW_COPY_AND_ASSIGN(Blit);
-};
-}
-
-#endif   // LIBGLESV2_BLIT_H_
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.cpp b/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.cpp
deleted file mode 100644
index dd12e3c..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.cpp
+++ /dev/null
@@ -1,117 +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.
-//
-
-// Buffer.cpp: Implements the gl::Buffer class, representing storage of vertex and/or
-// index data. Implements GL buffer objects and related functionality.
-// [OpenGL ES 2.0.24] section 2.9 page 21.
-
-#include "libGLESv2/Buffer.h"
-
-#include "libGLESv2/main.h"
-#include "libGLESv2/VertexDataManager.h"
-#include "libGLESv2/IndexDataManager.h"
-
-namespace gl
-{
-
-Buffer::Buffer(GLuint id) : RefCountObject(id)
-{
-    mContents = NULL;
-    mSize = 0;
-    mUsage = GL_DYNAMIC_DRAW;
-
-    mStaticVertexBuffer = NULL;
-    mStaticIndexBuffer = NULL;
-    mUnmodifiedDataUse = 0;
-}
-
-Buffer::~Buffer()
-{
-    delete[] mContents;
-    delete mStaticVertexBuffer;
-    delete mStaticIndexBuffer;
-}
-
-void Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage)
-{
-    if (size == 0)
-    {
-        delete[] mContents;
-        mContents = NULL;
-    }
-    else if (size != mSize)
-    {
-        delete[] mContents;
-        mContents = new GLubyte[size];
-        memset(mContents, 0, size);
-    }
-
-    if (data != NULL && size > 0)
-    {
-        memcpy(mContents, data, size);
-    }
-
-    mSize = size;
-    mUsage = usage;
-
-    invalidateStaticData();
-
-    if (usage == GL_STATIC_DRAW)
-    {
-        mStaticVertexBuffer = new StaticVertexBuffer(getDevice());
-        mStaticIndexBuffer = new StaticIndexBuffer(getDevice());
-    }
-}
-
-void Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset)
-{
-    memcpy(mContents + offset, data, size);
-    
-    if ((mStaticVertexBuffer && mStaticVertexBuffer->size() != 0) || (mStaticIndexBuffer && mStaticIndexBuffer->size() != 0))
-    {
-        invalidateStaticData();
-    }
-
-    mUnmodifiedDataUse = 0;
-}
-
-StaticVertexBuffer *Buffer::getStaticVertexBuffer()
-{
-    return mStaticVertexBuffer;
-}
-
-StaticIndexBuffer *Buffer::getStaticIndexBuffer()
-{
-    return mStaticIndexBuffer;
-}
-
-void Buffer::invalidateStaticData()
-{
-    delete mStaticVertexBuffer;
-    mStaticVertexBuffer = NULL;
-
-    delete mStaticIndexBuffer;
-    mStaticIndexBuffer = NULL;
-
-    mUnmodifiedDataUse = 0;
-}
-
-// Creates static buffers if sufficient used data has been left unmodified
-void Buffer::promoteStaticUsage(int dataSize)
-{
-    if (!mStaticVertexBuffer && !mStaticIndexBuffer)
-    {
-        mUnmodifiedDataUse += dataSize;
-
-        if (mUnmodifiedDataUse > 3 * mSize)
-        {
-            mStaticVertexBuffer = new StaticVertexBuffer(getDevice());
-            mStaticIndexBuffer = new StaticIndexBuffer(getDevice());
-        }
-    }
-}
-
-}
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.h b/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.h
deleted file mode 100644
index 7019c4e..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.h
+++ /dev/null
@@ -1,61 +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.
-//
-
-// Buffer.h: Defines the gl::Buffer class, representing storage of vertex and/or
-// index data. Implements GL buffer objects and related functionality.
-// [OpenGL ES 2.0.24] section 2.9 page 21.
-
-#ifndef LIBGLESV2_BUFFER_H_
-#define LIBGLESV2_BUFFER_H_
-
-#include <cstddef>
-#include <vector>
-
-#define GL_APICALL
-#include <GLES2/gl2.h>
-
-#include "common/angleutils.h"
-#include "common/RefCountObject.h"
-
-namespace gl
-{
-class StaticVertexBuffer;
-class StaticIndexBuffer;
-
-class Buffer : public RefCountObject
-{
-  public:
-    explicit Buffer(GLuint id);
-
-    virtual ~Buffer();
-
-    void bufferData(const void *data, GLsizeiptr size, GLenum usage);
-    void bufferSubData(const void *data, GLsizeiptr size, GLintptr offset);
-
-    void *data() { return mContents; }
-    size_t size() const { return mSize; }
-    GLenum usage() const { return mUsage; }
-
-    StaticVertexBuffer *getStaticVertexBuffer();
-    StaticIndexBuffer *getStaticIndexBuffer();
-    void invalidateStaticData();
-    void promoteStaticUsage(int dataSize);
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Buffer);
-
-    GLubyte *mContents;
-    GLsizeiptr mSize;
-    GLenum mUsage;
-
-    StaticVertexBuffer *mStaticVertexBuffer;
-    StaticIndexBuffer *mStaticIndexBuffer;
-    GLsizeiptr mUnmodifiedDataUse;
-};
-
-}
-
-#endif   // LIBGLESV2_BUFFER_H_
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Context.cpp b/Source/ThirdParty/ANGLE/src/libGLESv2/Context.cpp
deleted file mode 100644
index 6ec6077..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Context.cpp
+++ /dev/null
@@ -1,4339 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Context.cpp: Implements the gl::Context class, managing all GL state and performing
-// rendering operations. It is the GLES2 specific implementation of EGLContext.
-
-#include "libGLESv2/Context.h"
-
-#include <algorithm>
-
-#include "libEGL/Display.h"
-
-#include "libGLESv2/main.h"
-#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/ProgramBinary.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
-
-namespace gl
-{
-Context::Context(const egl::Config *config, const gl::Context *shareContext, bool notifyResets, bool robustAccess) : mConfig(config)
-{
-    ASSERT(robustAccess == false);   // Unimplemented
-
-    mDisplay = NULL;
-    mDevice = NULL;
-
-    mFenceHandleAllocator.setBaseHandle(0);
-
-    setClearColor(0.0f, 0.0f, 0.0f, 0.0f);
-
-    mState.depthClearValue = 1.0f;
-    mState.stencilClearValue = 0;
-
-    mState.cullFace = false;
-    mState.cullMode = GL_BACK;
-    mState.frontFace = GL_CCW;
-    mState.depthTest = false;
-    mState.depthFunc = GL_LESS;
-    mState.blend = false;
-    mState.sourceBlendRGB = GL_ONE;
-    mState.sourceBlendAlpha = GL_ONE;
-    mState.destBlendRGB = GL_ZERO;
-    mState.destBlendAlpha = GL_ZERO;
-    mState.blendEquationRGB = GL_FUNC_ADD;
-    mState.blendEquationAlpha = GL_FUNC_ADD;
-    mState.blendColor.red = 0;
-    mState.blendColor.green = 0;
-    mState.blendColor.blue = 0;
-    mState.blendColor.alpha = 0;
-    mState.stencilTest = false;
-    mState.stencilFunc = GL_ALWAYS;
-    mState.stencilRef = 0;
-    mState.stencilMask = -1;
-    mState.stencilWritemask = -1;
-    mState.stencilBackFunc = GL_ALWAYS;
-    mState.stencilBackRef = 0;
-    mState.stencilBackMask = - 1;
-    mState.stencilBackWritemask = -1;
-    mState.stencilFail = GL_KEEP;
-    mState.stencilPassDepthFail = GL_KEEP;
-    mState.stencilPassDepthPass = GL_KEEP;
-    mState.stencilBackFail = GL_KEEP;
-    mState.stencilBackPassDepthFail = GL_KEEP;
-    mState.stencilBackPassDepthPass = GL_KEEP;
-    mState.polygonOffsetFill = false;
-    mState.polygonOffsetFactor = 0.0f;
-    mState.polygonOffsetUnits = 0.0f;
-    mState.sampleAlphaToCoverage = false;
-    mState.sampleCoverage = false;
-    mState.sampleCoverageValue = 1.0f;
-    mState.sampleCoverageInvert = false;
-    mState.scissorTest = false;
-    mState.dither = true;
-    mState.generateMipmapHint = GL_DONT_CARE;
-    mState.fragmentShaderDerivativeHint = GL_DONT_CARE;
-
-    mState.lineWidth = 1.0f;
-
-    mState.viewportX = 0;
-    mState.viewportY = 0;
-    mState.viewportWidth = config->mDisplayMode.Width;
-    mState.viewportHeight = config->mDisplayMode.Height;
-    mState.zNear = 0.0f;
-    mState.zFar = 1.0f;
-
-    mState.scissorX = 0;
-    mState.scissorY = 0;
-    mState.scissorWidth = config->mDisplayMode.Width;
-    mState.scissorHeight = config->mDisplayMode.Height;
-
-    mState.colorMaskRed = true;
-    mState.colorMaskGreen = true;
-    mState.colorMaskBlue = true;
-    mState.colorMaskAlpha = true;
-    mState.depthMask = true;
-
-    if (shareContext != NULL)
-    {
-        mResourceManager = shareContext->mResourceManager;
-        mResourceManager->addRef();
-    }
-    else
-    {
-        mResourceManager = new ResourceManager();
-    }
-
-    // [OpenGL ES 2.0.24] section 3.7 page 83:
-    // In the initial state, TEXTURE_2D and TEXTURE_CUBE_MAP have twodimensional
-    // and cube map texture state vectors respectively associated with them.
-    // In order that access to these initial textures not be lost, they are treated as texture
-    // objects all of whose names are 0.
-
-    mTexture2DZero.set(new Texture2D(0));
-    mTextureCubeMapZero.set(new TextureCubeMap(0));
-
-    mState.activeSampler = 0;
-    bindArrayBuffer(0);
-    bindElementArrayBuffer(0);
-    bindTextureCubeMap(0);
-    bindTexture2D(0);
-    bindReadFramebuffer(0);
-    bindDrawFramebuffer(0);
-    bindRenderbuffer(0);
-
-    mState.currentProgram = 0;
-
-    mState.packAlignment = 4;
-    mState.unpackAlignment = 4;
-    mState.packReverseRowOrder = false;
-
-    mVertexDataManager = NULL;
-    mIndexDataManager = NULL;
-    mBlit = NULL;
-    mLineLoopIB = NULL;
-
-    mInvalidEnum = false;
-    mInvalidValue = false;
-    mInvalidOperation = false;
-    mOutOfMemory = false;
-    mInvalidFramebufferOperation = false;
-
-    mHasBeenCurrent = false;
-    mContextLost = false;
-    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()
-{
-    if (mState.currentProgram != 0)
-    {
-        Program *programObject = mResourceManager->getProgram(mState.currentProgram);
-        if (programObject)
-        {
-            programObject->release();
-        }
-        mState.currentProgram = 0;
-    }
-
-    while (!mFramebufferMap.empty())
-    {
-        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++)
-    {
-        for (int sampler = 0; sampler < MAX_COMBINED_TEXTURE_IMAGE_UNITS_VTF; sampler++)
-        {
-            mState.samplerTexture[type][sampler].set(NULL);
-        }
-    }
-
-    for (int type = 0; type < TEXTURE_TYPE_COUNT; type++)
-    {
-        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;
-    delete mIndexDataManager;
-    delete mBlit;
-    delete mLineLoopIB;
-
-    if (mMaskedClearSavedState)
-    {
-        mMaskedClearSavedState->Release();
-    }
-
-    mResourceManager->release();
-}
-
-void Context::makeCurrent(egl::Display *display, egl::Surface *surface)
-{
-    mDisplay = display;
-    mDevice = mDisplay->getDevice();
-
-    if (!mHasBeenCurrent)
-    {
-        mDeviceCaps = mDisplay->getDeviceCaps();
-
-        mVertexDataManager = new VertexDataManager(this, mDevice);
-        mIndexDataManager = new IndexDataManager(this, mDevice);
-        mBlit = new Blit(this);
-
-        mSupportsShaderModel3 = mDeviceCaps.PixelShaderVersion >= D3DPS_VERSION(3, 0);
-        mSupportsVertexTexture = mDisplay->getVertexTextureSupport();
-        mSupportsNonPower2Texture = mDisplay->getNonPower2TextureSupport();
-        mSupportsInstancing = mDisplay->getInstancingSupport();
-
-        mMaxTextureDimension = std::min(std::min((int)mDeviceCaps.MaxTextureWidth, (int)mDeviceCaps.MaxTextureHeight),
-                                        (int)gl::IMPLEMENTATION_MAX_TEXTURE_SIZE);
-        mMaxCubeTextureDimension = std::min(mMaxTextureDimension, (int)gl::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE);
-        mMaxRenderbufferDimension = mMaxTextureDimension;
-        mMaxTextureLevel = log2(mMaxTextureDimension) + 1;
-        TRACE("MaxTextureDimension=%d, MaxCubeTextureDimension=%d, MaxRenderbufferDimension=%d, MaxTextureLevel=%d",
-              mMaxTextureDimension, mMaxCubeTextureDimension, mMaxRenderbufferDimension, mMaxTextureLevel);
-
-        const D3DFORMAT renderBufferFormats[] =
-        {
-            D3DFMT_A8R8G8B8,
-            D3DFMT_X8R8G8B8,
-            D3DFMT_R5G6B5,
-            D3DFMT_D24S8
-        };
-
-        int max = 0;
-        for (int i = 0; i < sizeof(renderBufferFormats) / sizeof(D3DFORMAT); ++i)
-        {
-            bool *multisampleArray = new bool[D3DMULTISAMPLE_16_SAMPLES + 1];
-            mDisplay->getMultiSampleSupport(renderBufferFormats[i], multisampleArray);
-            mMultiSampleSupport[renderBufferFormats[i]] = multisampleArray;
-
-            for (int j = D3DMULTISAMPLE_16_SAMPLES; j >= 0; --j)
-            {
-                if (multisampleArray[j] && j != D3DMULTISAMPLE_NONMASKABLE && j > max)
-                {
-                    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();
-        mSupportsDepthTextures = mDisplay->getDepthTextureSupport();
-
-        mSupports32bitIndices = mDeviceCaps.MaxVertexIndex >= (1 << 16);
-
-        mNumCompressedTextureFormats = 0;
-        if (supportsDXT1Textures())
-        {
-            mNumCompressedTextureFormats += 2;
-        }
-        if (supportsDXT3Textures())
-        {
-            mNumCompressedTextureFormats += 1;
-        }
-        if (supportsDXT5Textures())
-        {
-            mNumCompressedTextureFormats += 1;
-        }
-
-        initExtensionString();
-        initRendererString();
-
-        mState.viewportX = 0;
-        mState.viewportY = 0;
-        mState.viewportWidth = surface->getWidth();
-        mState.viewportHeight = surface->getHeight();
-
-        mState.scissorX = 0;
-        mState.scissorY = 0;
-        mState.scissorWidth = surface->getWidth();
-        mState.scissorHeight = surface->getHeight();
-
-        mHasBeenCurrent = true;
-    }
-
-    // Wrap the existing Direct3D 9 resources into GL objects and assign them to the '0' names
-    IDirect3DSurface9 *defaultRenderTarget = surface->getRenderTarget();
-    IDirect3DSurface9 *depthStencil = surface->getDepthStencil();
-
-    Colorbuffer *colorbufferZero = new Colorbuffer(defaultRenderTarget);
-    DepthStencilbuffer *depthStencilbufferZero = new DepthStencilbuffer(depthStencil);
-    Framebuffer *framebufferZero = new DefaultFramebuffer(colorbufferZero, depthStencilbufferZero);
-
-    setFramebufferZero(framebufferZero);
-
-    if (defaultRenderTarget)
-    {
-        defaultRenderTarget->Release();
-    }
-
-    if (depthStencil)
-    {
-        depthStencil->Release();
-    }
-    
-    markAllStateDirty();
-}
-
-// This function will set all of the state-related dirty flags, so that all state is set during next pre-draw.
-void Context::markAllStateDirty()
-{
-    for (int t = 0; t < MAX_TEXTURE_IMAGE_UNITS; t++)
-    {
-        mAppliedTextureSerialPS[t] = 0;
-    }
-
-    for (int t = 0; t < MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF; t++)
-    {
-        mAppliedTextureSerialVS[t] = 0;
-    }
-
-    mAppliedProgramSerial = 0;
-    mAppliedRenderTargetSerial = 0;
-    mAppliedDepthbufferSerial = 0;
-    mAppliedStencilbufferSerial = 0;
-    mAppliedIBSerial = 0;
-    mDepthStencilInitialized = false;
-    mViewportInitialized = false;
-    mRenderTargetDescInitialized = false;
-
-    mVertexDeclarationCache.markStateDirty();
-
-    mClearStateDirty = true;
-    mCullStateDirty = true;
-    mDepthStateDirty = true;
-    mMaskStateDirty = true;
-    mBlendStateDirty = true;
-    mStencilStateDirty = true;
-    mPolygonOffsetStateDirty = true;
-    mScissorStateDirty = true;
-    mSampleStateDirty = true;
-    mDitherStateDirty = true;
-    mFrontFaceDirty = true;
-    mDxUniformsDirty = true;
-    mCachedCurrentProgram = NULL;
-}
-
-void Context::markDxUniformsDirty()
-{
-    mDxUniformsDirty = true;
-}
-
-void Context::markContextLost()
-{
-    if (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT)
-        mResetStatus = GL_UNKNOWN_CONTEXT_RESET_EXT;
-    mContextLost = true;
-}
-
-bool Context::isContextLost()
-{
-    return mContextLost;
-}
-
-void Context::setClearColor(float red, float green, float blue, float alpha)
-{
-    mState.colorClearValue.red = red;
-    mState.colorClearValue.green = green;
-    mState.colorClearValue.blue = blue;
-    mState.colorClearValue.alpha = alpha;
-}
-
-void Context::setClearDepth(float depth)
-{
-    mState.depthClearValue = depth;
-}
-
-void Context::setClearStencil(int stencil)
-{
-    mState.stencilClearValue = stencil;
-}
-
-void Context::setCullFace(bool enabled)
-{
-    if (mState.cullFace != enabled)
-    {
-        mState.cullFace = enabled;
-        mCullStateDirty = true;
-    }
-}
-
-bool Context::isCullFaceEnabled() const
-{
-    return mState.cullFace;
-}
-
-void Context::setCullMode(GLenum mode)
-{
-    if (mState.cullMode != mode)
-    {
-        mState.cullMode = mode;
-        mCullStateDirty = true;
-    }
-}
-
-void Context::setFrontFace(GLenum front)
-{
-    if (mState.frontFace != front)
-    {
-        mState.frontFace = front;
-        mFrontFaceDirty = true;
-    }
-}
-
-void Context::setDepthTest(bool enabled)
-{
-    if (mState.depthTest != enabled)
-    {
-        mState.depthTest = enabled;
-        mDepthStateDirty = true;
-    }
-}
-
-bool Context::isDepthTestEnabled() const
-{
-    return mState.depthTest;
-}
-
-void Context::setDepthFunc(GLenum depthFunc)
-{
-    if (mState.depthFunc != depthFunc)
-    {
-        mState.depthFunc = depthFunc;
-        mDepthStateDirty = true;
-    }
-}
-
-void Context::setDepthRange(float zNear, float zFar)
-{
-    mState.zNear = zNear;
-    mState.zFar = zFar;
-}
-
-void Context::setBlend(bool enabled)
-{
-    if (mState.blend != enabled)
-    {
-        mState.blend = enabled;
-        mBlendStateDirty = true;
-    }
-}
-
-bool Context::isBlendEnabled() const
-{
-    return mState.blend;
-}
-
-void Context::setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha)
-{
-    if (mState.sourceBlendRGB != sourceRGB ||
-        mState.sourceBlendAlpha != sourceAlpha ||
-        mState.destBlendRGB != destRGB ||
-        mState.destBlendAlpha != destAlpha)
-    {
-        mState.sourceBlendRGB = sourceRGB;
-        mState.destBlendRGB = destRGB;
-        mState.sourceBlendAlpha = sourceAlpha;
-        mState.destBlendAlpha = destAlpha;
-        mBlendStateDirty = true;
-    }
-}
-
-void Context::setBlendColor(float red, float green, float blue, float alpha)
-{
-    if (mState.blendColor.red != red ||
-        mState.blendColor.green != green ||
-        mState.blendColor.blue != blue ||
-        mState.blendColor.alpha != alpha)
-    {
-        mState.blendColor.red = red;
-        mState.blendColor.green = green;
-        mState.blendColor.blue = blue;
-        mState.blendColor.alpha = alpha;
-        mBlendStateDirty = true;
-    }
-}
-
-void Context::setBlendEquation(GLenum rgbEquation, GLenum alphaEquation)
-{
-    if (mState.blendEquationRGB != rgbEquation ||
-        mState.blendEquationAlpha != alphaEquation)
-    {
-        mState.blendEquationRGB = rgbEquation;
-        mState.blendEquationAlpha = alphaEquation;
-        mBlendStateDirty = true;
-    }
-}
-
-void Context::setStencilTest(bool enabled)
-{
-    if (mState.stencilTest != enabled)
-    {
-        mState.stencilTest = enabled;
-        mStencilStateDirty = true;
-    }
-}
-
-bool Context::isStencilTestEnabled() const
-{
-    return mState.stencilTest;
-}
-
-void Context::setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask)
-{
-    if (mState.stencilFunc != stencilFunc ||
-        mState.stencilRef != stencilRef ||
-        mState.stencilMask != stencilMask)
-    {
-        mState.stencilFunc = stencilFunc;
-        mState.stencilRef = (stencilRef > 0) ? stencilRef : 0;
-        mState.stencilMask = stencilMask;
-        mStencilStateDirty = true;
-    }
-}
-
-void Context::setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask)
-{
-    if (mState.stencilBackFunc != stencilBackFunc ||
-        mState.stencilBackRef != stencilBackRef ||
-        mState.stencilBackMask != stencilBackMask)
-    {
-        mState.stencilBackFunc = stencilBackFunc;
-        mState.stencilBackRef = (stencilBackRef > 0) ? stencilBackRef : 0;
-        mState.stencilBackMask = stencilBackMask;
-        mStencilStateDirty = true;
-    }
-}
-
-void Context::setStencilWritemask(GLuint stencilWritemask)
-{
-    if (mState.stencilWritemask != stencilWritemask)
-    {
-        mState.stencilWritemask = stencilWritemask;
-        mStencilStateDirty = true;
-    }
-}
-
-void Context::setStencilBackWritemask(GLuint stencilBackWritemask)
-{
-    if (mState.stencilBackWritemask != stencilBackWritemask)
-    {
-        mState.stencilBackWritemask = stencilBackWritemask;
-        mStencilStateDirty = true;
-    }
-}
-
-void Context::setStencilOperations(GLenum stencilFail, GLenum stencilPassDepthFail, GLenum stencilPassDepthPass)
-{
-    if (mState.stencilFail != stencilFail ||
-        mState.stencilPassDepthFail != stencilPassDepthFail ||
-        mState.stencilPassDepthPass != stencilPassDepthPass)
-    {
-        mState.stencilFail = stencilFail;
-        mState.stencilPassDepthFail = stencilPassDepthFail;
-        mState.stencilPassDepthPass = stencilPassDepthPass;
-        mStencilStateDirty = true;
-    }
-}
-
-void Context::setStencilBackOperations(GLenum stencilBackFail, GLenum stencilBackPassDepthFail, GLenum stencilBackPassDepthPass)
-{
-    if (mState.stencilBackFail != stencilBackFail ||
-        mState.stencilBackPassDepthFail != stencilBackPassDepthFail ||
-        mState.stencilBackPassDepthPass != stencilBackPassDepthPass)
-    {
-        mState.stencilBackFail = stencilBackFail;
-        mState.stencilBackPassDepthFail = stencilBackPassDepthFail;
-        mState.stencilBackPassDepthPass = stencilBackPassDepthPass;
-        mStencilStateDirty = true;
-    }
-}
-
-void Context::setPolygonOffsetFill(bool enabled)
-{
-    if (mState.polygonOffsetFill != enabled)
-    {
-        mState.polygonOffsetFill = enabled;
-        mPolygonOffsetStateDirty = true;
-    }
-}
-
-bool Context::isPolygonOffsetFillEnabled() const
-{
-    return mState.polygonOffsetFill;
-
-}
-
-void Context::setPolygonOffsetParams(GLfloat factor, GLfloat units)
-{
-    if (mState.polygonOffsetFactor != factor ||
-        mState.polygonOffsetUnits != units)
-    {
-        mState.polygonOffsetFactor = factor;
-        mState.polygonOffsetUnits = units;
-        mPolygonOffsetStateDirty = true;
-    }
-}
-
-void Context::setSampleAlphaToCoverage(bool enabled)
-{
-    if (mState.sampleAlphaToCoverage != enabled)
-    {
-        mState.sampleAlphaToCoverage = enabled;
-        mSampleStateDirty = true;
-    }
-}
-
-bool Context::isSampleAlphaToCoverageEnabled() const
-{
-    return mState.sampleAlphaToCoverage;
-}
-
-void Context::setSampleCoverage(bool enabled)
-{
-    if (mState.sampleCoverage != enabled)
-    {
-        mState.sampleCoverage = enabled;
-        mSampleStateDirty = true;
-    }
-}
-
-bool Context::isSampleCoverageEnabled() const
-{
-    return mState.sampleCoverage;
-}
-
-void Context::setSampleCoverageParams(GLclampf value, bool invert)
-{
-    if (mState.sampleCoverageValue != value ||
-        mState.sampleCoverageInvert != invert)
-    {
-        mState.sampleCoverageValue = value;
-        mState.sampleCoverageInvert = invert;
-        mSampleStateDirty = true;
-    }
-}
-
-void Context::setScissorTest(bool enabled)
-{
-    if (mState.scissorTest != enabled)
-    {
-        mState.scissorTest = enabled;
-        mScissorStateDirty = true;
-    }
-}
-
-bool Context::isScissorTestEnabled() const
-{
-    return mState.scissorTest;
-}
-
-void Context::setDither(bool enabled)
-{
-    if (mState.dither != enabled)
-    {
-        mState.dither = enabled;
-        mDitherStateDirty = true;
-    }
-}
-
-bool Context::isDitherEnabled() const
-{
-    return mState.dither;
-}
-
-void Context::setLineWidth(GLfloat width)
-{
-    mState.lineWidth = width;
-}
-
-void Context::setGenerateMipmapHint(GLenum hint)
-{
-    mState.generateMipmapHint = hint;
-}
-
-void Context::setFragmentShaderDerivativeHint(GLenum hint)
-{
-    mState.fragmentShaderDerivativeHint = hint;
-    // TODO: Propagate the hint to shader translator so we can write
-    // ddx, ddx_coarse, or ddx_fine depending on the hint.
-    // Ignore for now. It is valid for implementations to ignore hint.
-}
-
-void Context::setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height)
-{
-    mState.viewportX = x;
-    mState.viewportY = y;
-    mState.viewportWidth = width;
-    mState.viewportHeight = height;
-}
-
-void Context::setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height)
-{
-    if (mState.scissorX != x || mState.scissorY != y || 
-        mState.scissorWidth != width || mState.scissorHeight != height)
-    {
-        mState.scissorX = x;
-        mState.scissorY = y;
-        mState.scissorWidth = width;
-        mState.scissorHeight = height;
-        mScissorStateDirty = true;
-    }
-}
-
-void Context::setColorMask(bool red, bool green, bool blue, bool alpha)
-{
-    if (mState.colorMaskRed != red || mState.colorMaskGreen != green ||
-        mState.colorMaskBlue != blue || mState.colorMaskAlpha != alpha)
-    {
-        mState.colorMaskRed = red;
-        mState.colorMaskGreen = green;
-        mState.colorMaskBlue = blue;
-        mState.colorMaskAlpha = alpha;
-        mMaskStateDirty = true;
-    }
-}
-
-void Context::setDepthMask(bool mask)
-{
-    if (mState.depthMask != mask)
-    {
-        mState.depthMask = mask;
-        mMaskStateDirty = true;
-    }
-}
-
-void Context::setActiveSampler(unsigned int active)
-{
-    mState.activeSampler = active;
-}
-
-GLuint Context::getReadFramebufferHandle() const
-{
-    return mState.readFramebuffer;
-}
-
-GLuint Context::getDrawFramebufferHandle() const
-{
-    return mState.drawFramebuffer;
-}
-
-GLuint Context::getRenderbufferHandle() const
-{
-    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];
-}
-
-void Context::setVertexAttribState(unsigned int attribNum, Buffer *boundBuffer, GLint size, GLenum type, bool normalized,
-                                   GLsizei stride, const void *pointer)
-{
-    mState.vertexAttribute[attribNum].mBoundBuffer.set(boundBuffer);
-    mState.vertexAttribute[attribNum].mSize = size;
-    mState.vertexAttribute[attribNum].mType = type;
-    mState.vertexAttribute[attribNum].mNormalized = normalized;
-    mState.vertexAttribute[attribNum].mStride = stride;
-    mState.vertexAttribute[attribNum].mPointer = pointer;
-}
-
-const void *Context::getVertexAttribPointer(unsigned int attribNum) const
-{
-    return mState.vertexAttribute[attribNum].mPointer;
-}
-
-const VertexAttributeArray &Context::getVertexAttributes()
-{
-    return mState.vertexAttribute;
-}
-
-void Context::setPackAlignment(GLint alignment)
-{
-    mState.packAlignment = alignment;
-}
-
-GLint Context::getPackAlignment() const
-{
-    return mState.packAlignment;
-}
-
-void Context::setUnpackAlignment(GLint alignment)
-{
-    mState.unpackAlignment = alignment;
-}
-
-GLint Context::getUnpackAlignment() const
-{
-    return mState.unpackAlignment;
-}
-
-void Context::setPackReverseRowOrder(bool reverseRowOrder)
-{
-    mState.packReverseRowOrder = reverseRowOrder;
-}
-
-bool Context::getPackReverseRowOrder() const
-{
-    return mState.packReverseRowOrder;
-}
-
-GLuint Context::createBuffer()
-{
-    return mResourceManager->createBuffer();
-}
-
-GLuint Context::createProgram()
-{
-    return mResourceManager->createProgram();
-}
-
-GLuint Context::createShader(GLenum type)
-{
-    return mResourceManager->createShader(type);
-}
-
-GLuint Context::createTexture()
-{
-    return mResourceManager->createTexture();
-}
-
-GLuint Context::createRenderbuffer()
-{
-    return mResourceManager->createRenderbuffer();
-}
-
-// Returns an unused framebuffer name
-GLuint Context::createFramebuffer()
-{
-    GLuint handle = mFramebufferHandleAllocator.allocate();
-
-    mFramebufferMap[handle] = NULL;
-
-    return handle;
-}
-
-GLuint Context::createFence()
-{
-    GLuint handle = mFenceHandleAllocator.allocate();
-
-    mFenceMap[handle] = new Fence(mDisplay);
-
-    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);
-}
-
-void Context::deleteShader(GLuint shader)
-{
-    mResourceManager->deleteShader(shader);
-}
-
-void Context::deleteProgram(GLuint program)
-{
-    mResourceManager->deleteProgram(program);
-    mCachedCurrentProgram = NULL;
-}
-
-void Context::deleteTexture(GLuint texture)
-{
-    if (mResourceManager->getTexture(texture))
-    {
-        detachTexture(texture);
-    }
-
-    mResourceManager->deleteTexture(texture);
-}
-
-void Context::deleteRenderbuffer(GLuint renderbuffer)
-{
-    if (mResourceManager->getRenderbuffer(renderbuffer))
-    {
-        detachRenderbuffer(renderbuffer);
-    }
-    
-    mResourceManager->deleteRenderbuffer(renderbuffer);
-}
-
-void Context::deleteFramebuffer(GLuint framebuffer)
-{
-    FramebufferMap::iterator framebufferObject = mFramebufferMap.find(framebuffer);
-
-    if (framebufferObject != mFramebufferMap.end())
-    {
-        detachFramebuffer(framebuffer);
-
-        mFramebufferHandleAllocator.release(framebufferObject->first);
-        delete framebufferObject->second;
-        mFramebufferMap.erase(framebufferObject);
-    }
-}
-
-void Context::deleteFence(GLuint fence)
-{
-    FenceMap::iterator fenceObject = mFenceMap.find(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);
-}
-
-Program *Context::getProgram(GLuint handle)
-{
-    return mResourceManager->getProgram(handle);
-}
-
-Texture *Context::getTexture(GLuint handle)
-{
-    return mResourceManager->getTexture(handle);
-}
-
-Renderbuffer *Context::getRenderbuffer(GLuint handle)
-{
-    return mResourceManager->getRenderbuffer(handle);
-}
-
-Framebuffer *Context::getReadFramebuffer()
-{
-    return getFramebuffer(mState.readFramebuffer);
-}
-
-Framebuffer *Context::getDrawFramebuffer()
-{
-    return mBoundDrawFramebuffer;
-}
-
-void Context::bindArrayBuffer(unsigned int buffer)
-{
-    mResourceManager->checkBufferAllocation(buffer);
-
-    mState.arrayBuffer.set(getBuffer(buffer));
-}
-
-void Context::bindElementArrayBuffer(unsigned int buffer)
-{
-    mResourceManager->checkBufferAllocation(buffer);
-
-    mState.elementArrayBuffer.set(getBuffer(buffer));
-}
-
-void Context::bindTexture2D(GLuint texture)
-{
-    mResourceManager->checkTextureAllocation(texture, TEXTURE_2D);
-
-    mState.samplerTexture[TEXTURE_2D][mState.activeSampler].set(getTexture(texture));
-}
-
-void Context::bindTextureCubeMap(GLuint texture)
-{
-    mResourceManager->checkTextureAllocation(texture, TEXTURE_CUBE);
-
-    mState.samplerTexture[TEXTURE_CUBE][mState.activeSampler].set(getTexture(texture));
-}
-
-void Context::bindReadFramebuffer(GLuint framebuffer)
-{
-    if (!getFramebuffer(framebuffer))
-    {
-        mFramebufferMap[framebuffer] = new Framebuffer();
-    }
-
-    mState.readFramebuffer = framebuffer;
-}
-
-void Context::bindDrawFramebuffer(GLuint framebuffer)
-{
-    if (!getFramebuffer(framebuffer))
-    {
-        mFramebufferMap[framebuffer] = new Framebuffer();
-    }
-
-    mState.drawFramebuffer = framebuffer;
-
-    mBoundDrawFramebuffer = getFramebuffer(framebuffer);
-}
-
-void Context::bindRenderbuffer(GLuint renderbuffer)
-{
-    mResourceManager->checkRenderbufferAllocation(renderbuffer);
-
-    mState.renderbuffer.set(getRenderbuffer(renderbuffer));
-}
-
-void Context::useProgram(GLuint program)
-{
-    GLuint priorProgram = mState.currentProgram;
-    mState.currentProgram = program;               // Must switch before trying to delete, otherwise it only gets flagged.
-
-    if (priorProgram != program)
-    {
-        Program *newProgram = mResourceManager->getProgram(program);
-        Program *oldProgram = mResourceManager->getProgram(priorProgram);
-        mCachedCurrentProgram = NULL;
-        mDxUniformsDirty = true;
-
-        if (newProgram)
-        {
-            newProgram->addRef();
-        }
-        
-        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);
-        return;
-    }
-
-    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);
-        return;
-    }
-
-    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;
-    }
-}
-
-void Context::setRenderbufferStorage(RenderbufferStorage *renderbuffer)
-{
-    Renderbuffer *renderbufferObject = mState.renderbuffer.get();
-    renderbufferObject->setStorage(renderbuffer);
-}
-
-Framebuffer *Context::getFramebuffer(unsigned int handle)
-{
-    FramebufferMap::iterator framebuffer = mFramebufferMap.find(handle);
-
-    if (framebuffer == mFramebufferMap.end())
-    {
-        return NULL;
-    }
-    else
-    {
-        return framebuffer->second;
-    }
-}
-
-Fence *Context::getFence(unsigned int handle)
-{
-    FenceMap::iterator fence = mFenceMap.find(handle);
-
-    if (fence == mFenceMap.end())
-    {
-        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();
-}
-
-Program *Context::getCurrentProgram()
-{
-    if (!mCachedCurrentProgram)
-    {
-        mCachedCurrentProgram = mResourceManager->getProgram(mState.currentProgram);
-    }
-    return mCachedCurrentProgram;
-}
-
-Texture2D *Context::getTexture2D()
-{
-    return static_cast<Texture2D*>(getSamplerTexture(mState.activeSampler, TEXTURE_2D));
-}
-
-TextureCubeMap *Context::getTextureCubeMap()
-{
-    return static_cast<TextureCubeMap*>(getSamplerTexture(mState.activeSampler, TEXTURE_CUBE));
-}
-
-Texture *Context::getSamplerTexture(unsigned int sampler, TextureType type)
-{
-    GLuint texid = mState.samplerTexture[type][sampler].id();
-
-    if (texid == 0)   // Special case: 0 refers to different initial textures based on the target
-    {
-        switch (type)
-        {
-          default: UNREACHABLE();
-          case TEXTURE_2D: return mTexture2DZero.get();
-          case TEXTURE_CUBE: return mTextureCubeMapZero.get();
-        }
-    }
-
-    return mState.samplerTexture[type][sampler].get();
-}
-
-bool Context::getBooleanv(GLenum pname, GLboolean *params)
-{
-    switch (pname)
-    {
-      case GL_SHADER_COMPILER:           *params = GL_TRUE;                            break;
-      case GL_SAMPLE_COVERAGE_INVERT:    *params = mState.sampleCoverageInvert;        break;
-      case GL_DEPTH_WRITEMASK:           *params = mState.depthMask;                   break;
-      case GL_COLOR_WRITEMASK:
-        params[0] = mState.colorMaskRed;
-        params[1] = mState.colorMaskGreen;
-        params[2] = mState.colorMaskBlue;
-        params[3] = mState.colorMaskAlpha;
-        break;
-      case GL_CULL_FACE:                 *params = mState.cullFace;                    break;
-      case GL_POLYGON_OFFSET_FILL:       *params = mState.polygonOffsetFill;           break;
-      case GL_SAMPLE_ALPHA_TO_COVERAGE:  *params = mState.sampleAlphaToCoverage;       break;
-      case GL_SAMPLE_COVERAGE:           *params = mState.sampleCoverage;              break;
-      case GL_SCISSOR_TEST:              *params = mState.scissorTest;                 break;
-      case GL_STENCIL_TEST:              *params = mState.stencilTest;                 break;
-      case GL_DEPTH_TEST:                *params = mState.depthTest;                   break;
-      case GL_BLEND:                     *params = mState.blend;                       break;
-      case GL_DITHER:                    *params = mState.dither;                      break;
-      case GL_CONTEXT_ROBUST_ACCESS_EXT: *params = mRobustAccess ? GL_TRUE : GL_FALSE; break;
-      default:
-        return false;
-    }
-
-    return true;
-}
-
-bool Context::getFloatv(GLenum pname, GLfloat *params)
-{
-    // Please note: DEPTH_CLEAR_VALUE is included in our internal getFloatv implementation
-    // because it is stored as a float, despite the fact that the GL ES 2.0 spec names
-    // GetIntegerv as its native query function. As it would require conversion in any
-    // case, this should make no difference to the calling application.
-    switch (pname)
-    {
-      case GL_LINE_WIDTH:               *params = mState.lineWidth;            break;
-      case GL_SAMPLE_COVERAGE_VALUE:    *params = mState.sampleCoverageValue;  break;
-      case GL_DEPTH_CLEAR_VALUE:        *params = mState.depthClearValue;      break;
-      case GL_POLYGON_OFFSET_FACTOR:    *params = mState.polygonOffsetFactor;  break;
-      case GL_POLYGON_OFFSET_UNITS:     *params = mState.polygonOffsetUnits;   break;
-      case GL_ALIASED_LINE_WIDTH_RANGE:
-        params[0] = gl::ALIASED_LINE_WIDTH_RANGE_MIN;
-        params[1] = gl::ALIASED_LINE_WIDTH_RANGE_MAX;
-        break;
-      case GL_ALIASED_POINT_SIZE_RANGE:
-        params[0] = gl::ALIASED_POINT_SIZE_RANGE_MIN;
-        params[1] = supportsShaderModel3() ? gl::ALIASED_POINT_SIZE_RANGE_MAX_SM3 : gl::ALIASED_POINT_SIZE_RANGE_MAX_SM2;
-        break;
-      case GL_DEPTH_RANGE:
-        params[0] = mState.zNear;
-        params[1] = mState.zFar;
-        break;
-      case GL_COLOR_CLEAR_VALUE:
-        params[0] = mState.colorClearValue.red;
-        params[1] = mState.colorClearValue.green;
-        params[2] = mState.colorClearValue.blue;
-        params[3] = mState.colorClearValue.alpha;
-        break;
-      case GL_BLEND_COLOR:
-        params[0] = mState.blendColor.red;
-        params[1] = mState.blendColor.green;
-        params[2] = mState.blendColor.blue;
-        params[3] = mState.blendColor.alpha;
-        break;
-      default:
-        return false;
-    }
-
-    return true;
-}
-
-bool Context::getIntegerv(GLenum pname, GLint *params)
-{
-    // Please note: DEPTH_CLEAR_VALUE is not included in our internal getIntegerv implementation
-    // because it is stored as a float, despite the fact that the GL ES 2.0 spec names
-    // GetIntegerv as its native query function. As it would require conversion in any
-    // case, this should make no difference to the calling application. You may find it in 
-    // Context::getFloatv.
-    switch (pname)
-    {
-      case GL_MAX_VERTEX_ATTRIBS:               *params = gl::MAX_VERTEX_ATTRIBS;               break;
-      case GL_MAX_VERTEX_UNIFORM_VECTORS:       *params = gl::MAX_VERTEX_UNIFORM_VECTORS;       break;
-      case GL_MAX_VARYING_VECTORS:              *params = getMaximumVaryingVectors();           break;
-      case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: *params = getMaximumCombinedTextureImageUnits(); break;
-      case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:   *params = getMaximumVertexTextureImageUnits();  break;
-      case GL_MAX_TEXTURE_IMAGE_UNITS:          *params = gl::MAX_TEXTURE_IMAGE_UNITS;          break;
-      case GL_MAX_FRAGMENT_UNIFORM_VECTORS:     *params = getMaximumFragmentUniformVectors();   break;
-      case GL_MAX_RENDERBUFFER_SIZE:            *params = getMaximumRenderbufferDimension();    break;
-      case GL_NUM_SHADER_BINARY_FORMATS:        *params = 0;                                    break;
-      case GL_SHADER_BINARY_FORMATS:      /* no shader binary formats are supported */          break;
-      case GL_ARRAY_BUFFER_BINDING:             *params = mState.arrayBuffer.id();              break;
-      case GL_ELEMENT_ARRAY_BUFFER_BINDING:     *params = mState.elementArrayBuffer.id();       break;
-      //case GL_FRAMEBUFFER_BINDING:            // now equivalent to GL_DRAW_FRAMEBUFFER_BINDING_ANGLE
-      case GL_DRAW_FRAMEBUFFER_BINDING_ANGLE:   *params = mState.drawFramebuffer;               break;
-      case GL_READ_FRAMEBUFFER_BINDING_ANGLE:   *params = mState.readFramebuffer;               break;
-      case GL_RENDERBUFFER_BINDING:             *params = mState.renderbuffer.id();             break;
-      case GL_CURRENT_PROGRAM:                  *params = mState.currentProgram;                break;
-      case GL_PACK_ALIGNMENT:                   *params = mState.packAlignment;                 break;
-      case GL_PACK_REVERSE_ROW_ORDER_ANGLE:     *params = mState.packReverseRowOrder;           break;
-      case GL_UNPACK_ALIGNMENT:                 *params = mState.unpackAlignment;               break;
-      case GL_GENERATE_MIPMAP_HINT:             *params = mState.generateMipmapHint;            break;
-      case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: *params = mState.fragmentShaderDerivativeHint; break;
-      case GL_ACTIVE_TEXTURE:                   *params = (mState.activeSampler + GL_TEXTURE0); break;
-      case GL_STENCIL_FUNC:                     *params = mState.stencilFunc;                   break;
-      case GL_STENCIL_REF:                      *params = mState.stencilRef;                    break;
-      case GL_STENCIL_VALUE_MASK:               *params = mState.stencilMask;                   break;
-      case GL_STENCIL_BACK_FUNC:                *params = mState.stencilBackFunc;               break;
-      case GL_STENCIL_BACK_REF:                 *params = mState.stencilBackRef;                break;
-      case GL_STENCIL_BACK_VALUE_MASK:          *params = mState.stencilBackMask;               break;
-      case GL_STENCIL_FAIL:                     *params = mState.stencilFail;                   break;
-      case GL_STENCIL_PASS_DEPTH_FAIL:          *params = mState.stencilPassDepthFail;          break;
-      case GL_STENCIL_PASS_DEPTH_PASS:          *params = mState.stencilPassDepthPass;          break;
-      case GL_STENCIL_BACK_FAIL:                *params = mState.stencilBackFail;               break;
-      case GL_STENCIL_BACK_PASS_DEPTH_FAIL:     *params = mState.stencilBackPassDepthFail;      break;
-      case GL_STENCIL_BACK_PASS_DEPTH_PASS:     *params = mState.stencilBackPassDepthPass;      break;
-      case GL_DEPTH_FUNC:                       *params = mState.depthFunc;                     break;
-      case GL_BLEND_SRC_RGB:                    *params = mState.sourceBlendRGB;                break;
-      case GL_BLEND_SRC_ALPHA:                  *params = mState.sourceBlendAlpha;              break;
-      case GL_BLEND_DST_RGB:                    *params = mState.destBlendRGB;                  break;
-      case GL_BLEND_DST_ALPHA:                  *params = mState.destBlendAlpha;                break;
-      case GL_BLEND_EQUATION_RGB:               *params = mState.blendEquationRGB;              break;
-      case GL_BLEND_EQUATION_ALPHA:             *params = mState.blendEquationAlpha;            break;
-      case GL_STENCIL_WRITEMASK:                *params = mState.stencilWritemask;              break;
-      case GL_STENCIL_BACK_WRITEMASK:           *params = mState.stencilBackWritemask;          break;
-      case GL_STENCIL_CLEAR_VALUE:              *params = mState.stencilClearValue;             break;
-      case GL_SUBPIXEL_BITS:                    *params = 4;                                    break;
-      case GL_MAX_TEXTURE_SIZE:                 *params = getMaximumTextureDimension();         break;
-      case GL_MAX_CUBE_MAP_TEXTURE_SIZE:        *params = getMaximumCubeTextureDimension();     break;
-      case GL_NUM_COMPRESSED_TEXTURE_FORMATS:   
-        params[0] = mNumCompressedTextureFormats;
-        break;
-      case GL_MAX_SAMPLES_ANGLE:
-        {
-            GLsizei maxSamples = getMaxSupportedSamples();
-            if (maxSamples != 0)
-            {
-                *params = maxSamples;
-            }
-            else
-            {
-                return false;
-            }
-
-            break;
-        }
-      case GL_SAMPLE_BUFFERS:                   
-      case GL_SAMPLES:
-        {
-            gl::Framebuffer *framebuffer = getDrawFramebuffer();
-            if (framebuffer->completeness() == GL_FRAMEBUFFER_COMPLETE)
-            {
-                switch (pname)
-                {
-                  case GL_SAMPLE_BUFFERS:
-                    if (framebuffer->getSamples() != 0)
-                    {
-                        *params = 1;
-                    }
-                    else
-                    {
-                        *params = 0;
-                    }
-                    break;
-                  case GL_SAMPLES:
-                    *params = framebuffer->getSamples();
-                    break;
-                }
-            }
-            else 
-            {
-                *params = 0;
-            }
-        }
-        break;
-      case GL_IMPLEMENTATION_COLOR_READ_TYPE:   *params = gl::IMPLEMENTATION_COLOR_READ_TYPE;   break;
-      case GL_IMPLEMENTATION_COLOR_READ_FORMAT: *params = gl::IMPLEMENTATION_COLOR_READ_FORMAT; break;
-      case GL_MAX_VIEWPORT_DIMS:
-        {
-            int maxDimension = std::max(getMaximumRenderbufferDimension(), getMaximumTextureDimension());
-            params[0] = maxDimension;
-            params[1] = maxDimension;
-        }
-        break;
-      case GL_COMPRESSED_TEXTURE_FORMATS:
-        {
-            if (supportsDXT1Textures())
-            {
-                *params++ = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
-                *params++ = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
-            }
-            if (supportsDXT3Textures())
-            {
-                *params++ = GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE;
-            }
-            if (supportsDXT5Textures())
-            {
-                *params++ = GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE;
-            }
-        }
-        break;
-      case GL_VIEWPORT:
-        params[0] = mState.viewportX;
-        params[1] = mState.viewportY;
-        params[2] = mState.viewportWidth;
-        params[3] = mState.viewportHeight;
-        break;
-      case GL_SCISSOR_BOX:
-        params[0] = mState.scissorX;
-        params[1] = mState.scissorY;
-        params[2] = mState.scissorWidth;
-        params[3] = mState.scissorHeight;
-        break;
-      case GL_CULL_FACE_MODE:                   *params = mState.cullMode;                 break;
-      case GL_FRONT_FACE:                       *params = mState.frontFace;                break;
-      case GL_RED_BITS:
-      case GL_GREEN_BITS:
-      case GL_BLUE_BITS:
-      case GL_ALPHA_BITS:
-        {
-            gl::Framebuffer *framebuffer = getDrawFramebuffer();
-            gl::Renderbuffer *colorbuffer = framebuffer->getColorbuffer();
-
-            if (colorbuffer)
-            {
-                switch (pname)
-                {
-                  case GL_RED_BITS:   *params = colorbuffer->getRedSize();   break;
-                  case GL_GREEN_BITS: *params = colorbuffer->getGreenSize(); break;
-                  case GL_BLUE_BITS:  *params = colorbuffer->getBlueSize();  break;
-                  case GL_ALPHA_BITS: *params = colorbuffer->getAlphaSize(); break;
-                }
-            }
-            else
-            {
-                *params = 0;
-            }
-        }
-        break;
-      case GL_DEPTH_BITS:
-        {
-            gl::Framebuffer *framebuffer = getDrawFramebuffer();
-            gl::Renderbuffer *depthbuffer = framebuffer->getDepthbuffer();
-
-            if (depthbuffer)
-            {
-                *params = depthbuffer->getDepthSize();
-            }
-            else
-            {
-                *params = 0;
-            }
-        }
-        break;
-      case GL_STENCIL_BITS:
-        {
-            gl::Framebuffer *framebuffer = getDrawFramebuffer();
-            gl::Renderbuffer *stencilbuffer = framebuffer->getStencilbuffer();
-
-            if (stencilbuffer)
-            {
-                *params = stencilbuffer->getStencilSize();
-            }
-            else
-            {
-                *params = 0;
-            }
-        }
-        break;
-      case GL_TEXTURE_BINDING_2D:
-        {
-            if (mState.activeSampler < 0 || mState.activeSampler > getMaximumCombinedTextureImageUnits() - 1)
-            {
-                error(GL_INVALID_OPERATION);
-                return false;
-            }
-
-            *params = mState.samplerTexture[TEXTURE_2D][mState.activeSampler].id();
-        }
-        break;
-      case GL_TEXTURE_BINDING_CUBE_MAP:
-        {
-            if (mState.activeSampler < 0 || mState.activeSampler > getMaximumCombinedTextureImageUnits() - 1)
-            {
-                error(GL_INVALID_OPERATION);
-                return false;
-            }
-
-            *params = mState.samplerTexture[TEXTURE_CUBE][mState.activeSampler].id();
-        }
-        break;
-      case GL_RESET_NOTIFICATION_STRATEGY_EXT:
-        *params = mResetStrategy;
-        break;
-      case GL_NUM_PROGRAM_BINARY_FORMATS_OES:
-        *params = 1;
-        break;
-      case GL_PROGRAM_BINARY_FORMATS_OES:
-        *params = GL_PROGRAM_BINARY_ANGLE;
-        break;
-      default:
-        return false;
-    }
-
-    return true;
-}
-
-bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams)
-{
-    // Please note: the query type returned for DEPTH_CLEAR_VALUE in this implementation
-    // is FLOAT rather than INT, as would be suggested by the GL ES 2.0 spec. This is due
-    // to the fact that it is stored internally as a float, and so would require conversion
-    // if returned from Context::getIntegerv. Since this conversion is already implemented 
-    // in the case that one calls glGetIntegerv to retrieve a float-typed state variable, we
-    // place DEPTH_CLEAR_VALUE with the floats. This should make no difference to the calling
-    // application.
-    switch (pname)
-    {
-      case GL_COMPRESSED_TEXTURE_FORMATS:
-        {
-            *type = GL_INT;
-            *numParams = mNumCompressedTextureFormats;
-        }
-        break;
-      case GL_SHADER_BINARY_FORMATS:
-        {
-            *type = GL_INT;
-            *numParams = 0;
-        }
-        break;
-      case GL_MAX_VERTEX_ATTRIBS:
-      case GL_MAX_VERTEX_UNIFORM_VECTORS:
-      case GL_MAX_VARYING_VECTORS:
-      case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
-      case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
-      case GL_MAX_TEXTURE_IMAGE_UNITS:
-      case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
-      case GL_MAX_RENDERBUFFER_SIZE:
-      case GL_NUM_SHADER_BINARY_FORMATS:
-      case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
-      case GL_ARRAY_BUFFER_BINDING:
-      case GL_FRAMEBUFFER_BINDING:
-      case GL_RENDERBUFFER_BINDING:
-      case GL_CURRENT_PROGRAM:
-      case GL_PACK_ALIGNMENT:
-      case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
-      case GL_UNPACK_ALIGNMENT:
-      case GL_GENERATE_MIPMAP_HINT:
-      case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
-      case GL_RED_BITS:
-      case GL_GREEN_BITS:
-      case GL_BLUE_BITS:
-      case GL_ALPHA_BITS:
-      case GL_DEPTH_BITS:
-      case GL_STENCIL_BITS:
-      case GL_ELEMENT_ARRAY_BUFFER_BINDING:
-      case GL_CULL_FACE_MODE:
-      case GL_FRONT_FACE:
-      case GL_ACTIVE_TEXTURE:
-      case GL_STENCIL_FUNC:
-      case GL_STENCIL_VALUE_MASK:
-      case GL_STENCIL_REF:
-      case GL_STENCIL_FAIL:
-      case GL_STENCIL_PASS_DEPTH_FAIL:
-      case GL_STENCIL_PASS_DEPTH_PASS:
-      case GL_STENCIL_BACK_FUNC:
-      case GL_STENCIL_BACK_VALUE_MASK:
-      case GL_STENCIL_BACK_REF:
-      case GL_STENCIL_BACK_FAIL:
-      case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
-      case GL_STENCIL_BACK_PASS_DEPTH_PASS:
-      case GL_DEPTH_FUNC:
-      case GL_BLEND_SRC_RGB:
-      case GL_BLEND_SRC_ALPHA:
-      case GL_BLEND_DST_RGB:
-      case GL_BLEND_DST_ALPHA:
-      case GL_BLEND_EQUATION_RGB:
-      case GL_BLEND_EQUATION_ALPHA:
-      case GL_STENCIL_WRITEMASK:
-      case GL_STENCIL_BACK_WRITEMASK:
-      case GL_STENCIL_CLEAR_VALUE:
-      case GL_SUBPIXEL_BITS:
-      case GL_MAX_TEXTURE_SIZE:
-      case GL_MAX_CUBE_MAP_TEXTURE_SIZE:
-      case GL_SAMPLE_BUFFERS:
-      case GL_SAMPLES:
-      case GL_IMPLEMENTATION_COLOR_READ_TYPE:
-      case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
-      case GL_TEXTURE_BINDING_2D:
-      case GL_TEXTURE_BINDING_CUBE_MAP:
-      case GL_RESET_NOTIFICATION_STRATEGY_EXT:
-      case GL_NUM_PROGRAM_BINARY_FORMATS_OES:
-      case GL_PROGRAM_BINARY_FORMATS_OES:
-        {
-            *type = GL_INT;
-            *numParams = 1;
-        }
-        break;
-      case GL_MAX_SAMPLES_ANGLE:
-        {
-            if (getMaxSupportedSamples() != 0)
-            {
-                *type = GL_INT;
-                *numParams = 1;
-            }
-            else
-            {
-                return false;
-            }
-        }
-        break;
-      case GL_MAX_VIEWPORT_DIMS:
-        {
-            *type = GL_INT;
-            *numParams = 2;
-        }
-        break;
-      case GL_VIEWPORT:
-      case GL_SCISSOR_BOX:
-        {
-            *type = GL_INT;
-            *numParams = 4;
-        }
-        break;
-      case GL_SHADER_COMPILER:
-      case GL_SAMPLE_COVERAGE_INVERT:
-      case GL_DEPTH_WRITEMASK:
-      case GL_CULL_FACE:                // CULL_FACE through DITHER are natural to IsEnabled,
-      case GL_POLYGON_OFFSET_FILL:      // but can be retrieved through the Get{Type}v queries.
-      case GL_SAMPLE_ALPHA_TO_COVERAGE: // For this purpose, they are treated here as bool-natural
-      case GL_SAMPLE_COVERAGE:
-      case GL_SCISSOR_TEST:
-      case GL_STENCIL_TEST:
-      case GL_DEPTH_TEST:
-      case GL_BLEND:
-      case GL_DITHER:
-      case GL_CONTEXT_ROBUST_ACCESS_EXT:
-        {
-            *type = GL_BOOL;
-            *numParams = 1;
-        }
-        break;
-      case GL_COLOR_WRITEMASK:
-        {
-            *type = GL_BOOL;
-            *numParams = 4;
-        }
-        break;
-      case GL_POLYGON_OFFSET_FACTOR:
-      case GL_POLYGON_OFFSET_UNITS:
-      case GL_SAMPLE_COVERAGE_VALUE:
-      case GL_DEPTH_CLEAR_VALUE:
-      case GL_LINE_WIDTH:
-        {
-            *type = GL_FLOAT;
-            *numParams = 1;
-        }
-        break;
-      case GL_ALIASED_LINE_WIDTH_RANGE:
-      case GL_ALIASED_POINT_SIZE_RANGE:
-      case GL_DEPTH_RANGE:
-        {
-            *type = GL_FLOAT;
-            *numParams = 2;
-        }
-        break;
-      case GL_COLOR_CLEAR_VALUE:
-      case GL_BLEND_COLOR:
-        {
-            *type = GL_FLOAT;
-            *numParams = 4;
-        }
-        break;
-      default:
-        return false;
-    }
-
-    return true;
-}
-
-// Applies the render target surface, depth stencil surface, viewport rectangle and
-// scissor rectangle to the Direct3D 9 device
-bool Context::applyRenderTarget(bool ignoreViewport)
-{
-    Framebuffer *framebufferObject = getDrawFramebuffer();
-
-    if (!framebufferObject || framebufferObject->completeness() != GL_FRAMEBUFFER_COMPLETE)
-    {
-        return error(GL_INVALID_FRAMEBUFFER_OPERATION, false);
-    }
-
-    // if there is no color attachment we must synthesize a NULL colorattachment
-    // to keep the D3D runtime happy.  This should only be possible if depth texturing.
-    Renderbuffer *renderbufferObject = NULL;
-    if (framebufferObject->getColorbufferType() != GL_NONE)
-    {
-        renderbufferObject = framebufferObject->getColorbuffer();
-    }
-    else
-    {
-        renderbufferObject = framebufferObject->getNullColorbuffer();
-    }
-    if (!renderbufferObject)
-    {
-        ERR("unable to locate renderbuffer for FBO.");
-        return false;
-    }
-
-    bool renderTargetChanged = false;
-    unsigned int renderTargetSerial = renderbufferObject->getSerial();
-    if (renderTargetSerial != mAppliedRenderTargetSerial)
-    {
-        IDirect3DSurface9 *renderTarget = renderbufferObject->getRenderTarget();
-        if (!renderTarget)
-        {
-            ERR("render target pointer unexpectedly null.");
-            return false;   // Context must be lost
-        }
-        mDevice->SetRenderTarget(0, renderTarget);
-        mAppliedRenderTargetSerial = renderTargetSerial;
-        mScissorStateDirty = true; // Scissor area must be clamped to render target's size-- this is different for different render targets.
-        renderTargetChanged = true;
-        renderTarget->Release();
-    }
-
-    IDirect3DSurface9 *depthStencil = NULL;
-    unsigned int depthbufferSerial = 0;
-    unsigned int stencilbufferSerial = 0;
-    if (framebufferObject->getDepthbufferType() != GL_NONE)
-    {
-        Renderbuffer *depthbuffer = framebufferObject->getDepthbuffer();
-        depthStencil = depthbuffer->getDepthStencil();
-        if (!depthStencil)
-        {
-            ERR("Depth stencil pointer unexpectedly null.");
-            return false;
-        }
-        
-        depthbufferSerial = depthbuffer->getSerial();
-    }
-    else if (framebufferObject->getStencilbufferType() != GL_NONE)
-    {
-        Renderbuffer *stencilbuffer = framebufferObject->getStencilbuffer();
-        depthStencil = stencilbuffer->getDepthStencil();
-        if (!depthStencil)
-        {
-            ERR("Depth stencil pointer unexpectedly null.");
-            return false;
-        }
-        
-        stencilbufferSerial = stencilbuffer->getSerial();
-    }
-
-    if (depthbufferSerial != mAppliedDepthbufferSerial ||
-        stencilbufferSerial != mAppliedStencilbufferSerial ||
-        !mDepthStencilInitialized)
-    {
-        mDevice->SetDepthStencilSurface(depthStencil);
-        mAppliedDepthbufferSerial = depthbufferSerial;
-        mAppliedStencilbufferSerial = stencilbufferSerial;
-        mDepthStencilInitialized = true;
-    }
-
-    if (depthStencil)
-    {
-        depthStencil->Release();
-    }
-
-    if (!mRenderTargetDescInitialized || renderTargetChanged)
-    {
-        IDirect3DSurface9 *renderTarget = renderbufferObject->getRenderTarget();
-        if (!renderTarget)
-        {
-            return false;   // Context must be lost
-        }
-        renderTarget->GetDesc(&mRenderTargetDesc);
-        mRenderTargetDescInitialized = true;
-        renderTarget->Release();
-    }
-
-    D3DVIEWPORT9 viewport;
-
-    float zNear = clamp01(mState.zNear);
-    float zFar = clamp01(mState.zFar);
-
-    if (ignoreViewport)
-    {
-        viewport.X = 0;
-        viewport.Y = 0;
-        viewport.Width = mRenderTargetDesc.Width;
-        viewport.Height = mRenderTargetDesc.Height;
-        viewport.MinZ = 0.0f;
-        viewport.MaxZ = 1.0f;
-    }
-    else
-    {
-        viewport.X = clamp(mState.viewportX, 0L, static_cast<LONG>(mRenderTargetDesc.Width));
-        viewport.Y = clamp(mState.viewportY, 0L, static_cast<LONG>(mRenderTargetDesc.Height));
-        viewport.Width = clamp(mState.viewportWidth, 0L, static_cast<LONG>(mRenderTargetDesc.Width) - static_cast<LONG>(viewport.X));
-        viewport.Height = clamp(mState.viewportHeight, 0L, static_cast<LONG>(mRenderTargetDesc.Height) - static_cast<LONG>(viewport.Y));
-        viewport.MinZ = zNear;
-        viewport.MaxZ = zFar;
-    }
-
-    if (viewport.Width <= 0 || viewport.Height <= 0)
-    {
-        return false;   // Nothing to render
-    }
-
-    if (renderTargetChanged || !mViewportInitialized || memcmp(&viewport, &mSetViewport, sizeof mSetViewport) != 0)
-    {
-        mDevice->SetViewport(&viewport);
-        mSetViewport = viewport;
-        mViewportInitialized = true;
-        mDxUniformsDirty = true;
-    }
-
-    if (mScissorStateDirty)
-    {
-        if (mState.scissorTest)
-        {
-            RECT rect;
-            rect.left = clamp(mState.scissorX, 0L, static_cast<LONG>(mRenderTargetDesc.Width));
-            rect.top = clamp(mState.scissorY, 0L, static_cast<LONG>(mRenderTargetDesc.Height));
-            rect.right = clamp(mState.scissorX + mState.scissorWidth, 0L, static_cast<LONG>(mRenderTargetDesc.Width));
-            rect.bottom = clamp(mState.scissorY + mState.scissorHeight, 0L, static_cast<LONG>(mRenderTargetDesc.Height));
-            mDevice->SetScissorRect(&rect);
-            mDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE);
-        }
-        else
-        {
-            mDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
-        }
-
-        mScissorStateDirty = false;
-    }
-
-    if (mState.currentProgram && mDxUniformsDirty)
-    {
-        Program *programObject = getCurrentProgram();
-        ProgramBinary *programBinary = programObject->getProgramBinary();
-
-        GLint halfPixelSize = programBinary->getDxHalfPixelSizeLocation();
-        GLfloat xy[2] = {1.0f / viewport.Width, -1.0f / viewport.Height};
-        programBinary->setUniform2fv(halfPixelSize, 1, xy);
-
-        // These values are used for computing gl_FragCoord in Program::linkVaryings().
-        GLint coord = programBinary->getDxCoordLocation();
-        GLfloat whxy[4] = {mState.viewportWidth / 2.0f, mState.viewportHeight / 2.0f, 
-                          (float)mState.viewportX + mState.viewportWidth / 2.0f, 
-                          (float)mState.viewportY + mState.viewportHeight / 2.0f};
-        programBinary->setUniform4fv(coord, 1, whxy);
-
-        GLint depth = programBinary->getDxDepthLocation();
-        GLfloat dz[2] = {(zFar - zNear) / 2.0f, (zNear + zFar) / 2.0f};
-        programBinary->setUniform2fv(depth, 1, dz);
-
-        GLint depthRange = programBinary->getDxDepthRangeLocation();
-        GLfloat nearFarDiff[3] = {zNear, zFar, zFar - zNear};
-        programBinary->setUniform3fv(depthRange, 1, nearFarDiff);
-        mDxUniformsDirty = false;
-    }
-
-    return true;
-}
-
-// Applies the fixed-function state (culling, depth test, alpha blending, stenciling, etc) to the Direct3D 9 device
-void Context::applyState(GLenum drawMode)
-{
-    Program *programObject = getCurrentProgram();
-    ProgramBinary *programBinary = programObject->getProgramBinary();
-
-    Framebuffer *framebufferObject = getDrawFramebuffer();
-
-    GLint frontCCW = programBinary->getDxFrontCCWLocation();
-    GLint ccw = (mState.frontFace == GL_CCW);
-    programBinary->setUniform1iv(frontCCW, 1, &ccw);
-
-    GLint pointsOrLines = programBinary->getDxPointsOrLinesLocation();
-    GLint alwaysFront = !isTriangleMode(drawMode);
-    programBinary->setUniform1iv(pointsOrLines, 1, &alwaysFront);
-
-    D3DADAPTER_IDENTIFIER9 *identifier = mDisplay->getAdapterIdentifier();
-    bool zeroColorMaskAllowed = identifier->VendorId != 0x1002;
-    // Apparently some ATI cards have a bug where a draw with a zero color
-    // write mask can cause later draws to have incorrect results. Instead,
-    // set a nonzero color write mask but modify the blend state so that no
-    // drawing is done.
-    // http://code.google.com/p/angleproject/issues/detail?id=169
-
-    if (mCullStateDirty || mFrontFaceDirty)
-    {
-        if (mState.cullFace)
-        {
-            mDevice->SetRenderState(D3DRS_CULLMODE, es2dx::ConvertCullMode(mState.cullMode, mState.frontFace));
-        }
-        else
-        {
-            mDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
-        }
-
-        mCullStateDirty = false;
-    }
-
-    if (mDepthStateDirty)
-    {
-        if (mState.depthTest)
-        {
-            mDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
-            mDevice->SetRenderState(D3DRS_ZFUNC, es2dx::ConvertComparison(mState.depthFunc));
-        }
-        else
-        {
-            mDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
-        }
-
-        mDepthStateDirty = false;
-    }
-
-    if (!zeroColorMaskAllowed && (mMaskStateDirty || mBlendStateDirty))
-    {
-        mBlendStateDirty = true;
-        mMaskStateDirty = true;
-    }
-
-    if (mBlendStateDirty)
-    {
-        if (mState.blend)
-        {
-            mDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
-
-            if (mState.sourceBlendRGB != GL_CONSTANT_ALPHA && mState.sourceBlendRGB != GL_ONE_MINUS_CONSTANT_ALPHA &&
-                mState.destBlendRGB != GL_CONSTANT_ALPHA && mState.destBlendRGB != GL_ONE_MINUS_CONSTANT_ALPHA)
-            {
-                mDevice->SetRenderState(D3DRS_BLENDFACTOR, es2dx::ConvertColor(mState.blendColor));
-            }
-            else
-            {
-                mDevice->SetRenderState(D3DRS_BLENDFACTOR, D3DCOLOR_RGBA(unorm<8>(mState.blendColor.alpha),
-                                                                        unorm<8>(mState.blendColor.alpha),
-                                                                        unorm<8>(mState.blendColor.alpha),
-                                                                        unorm<8>(mState.blendColor.alpha)));
-            }
-
-            mDevice->SetRenderState(D3DRS_SRCBLEND, es2dx::ConvertBlendFunc(mState.sourceBlendRGB));
-            mDevice->SetRenderState(D3DRS_DESTBLEND, es2dx::ConvertBlendFunc(mState.destBlendRGB));
-            mDevice->SetRenderState(D3DRS_BLENDOP, es2dx::ConvertBlendOp(mState.blendEquationRGB));
-
-            if (mState.sourceBlendRGB != mState.sourceBlendAlpha || 
-                mState.destBlendRGB != mState.destBlendAlpha || 
-                mState.blendEquationRGB != mState.blendEquationAlpha)
-            {
-                mDevice->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
-
-                mDevice->SetRenderState(D3DRS_SRCBLENDALPHA, es2dx::ConvertBlendFunc(mState.sourceBlendAlpha));
-                mDevice->SetRenderState(D3DRS_DESTBLENDALPHA, es2dx::ConvertBlendFunc(mState.destBlendAlpha));
-                mDevice->SetRenderState(D3DRS_BLENDOPALPHA, es2dx::ConvertBlendOp(mState.blendEquationAlpha));
-            }
-            else
-            {
-                mDevice->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, FALSE);
-            }
-        }
-        else
-        {
-            mDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
-        }
-
-        mBlendStateDirty = false;
-    }
-
-    if (mStencilStateDirty || mFrontFaceDirty)
-    {
-        if (mState.stencilTest && framebufferObject->hasStencil())
-        {
-            mDevice->SetRenderState(D3DRS_STENCILENABLE, TRUE);
-            mDevice->SetRenderState(D3DRS_TWOSIDEDSTENCILMODE, TRUE);
-
-            // FIXME: Unsupported by D3D9
-            const D3DRENDERSTATETYPE D3DRS_CCW_STENCILREF = D3DRS_STENCILREF;
-            const D3DRENDERSTATETYPE D3DRS_CCW_STENCILMASK = D3DRS_STENCILMASK;
-            const D3DRENDERSTATETYPE D3DRS_CCW_STENCILWRITEMASK = D3DRS_STENCILWRITEMASK;
-            if (mState.stencilWritemask != mState.stencilBackWritemask || 
-                mState.stencilRef != mState.stencilBackRef || 
-                mState.stencilMask != mState.stencilBackMask)
-            {
-                ERR("Separate front/back stencil writemasks, reference values, or stencil mask values are invalid under WebGL.");
-                return error(GL_INVALID_OPERATION);
-            }
-
-            // get the maximum size of the stencil ref
-            gl::Renderbuffer *stencilbuffer = framebufferObject->getStencilbuffer();
-            GLuint maxStencil = (1 << stencilbuffer->getStencilSize()) - 1;
-
-            mDevice->SetRenderState(mState.frontFace == GL_CCW ? D3DRS_STENCILWRITEMASK : D3DRS_CCW_STENCILWRITEMASK, mState.stencilWritemask);
-            mDevice->SetRenderState(mState.frontFace == GL_CCW ? D3DRS_STENCILFUNC : D3DRS_CCW_STENCILFUNC, 
-                                   es2dx::ConvertComparison(mState.stencilFunc));
-
-            mDevice->SetRenderState(mState.frontFace == GL_CCW ? D3DRS_STENCILREF : D3DRS_CCW_STENCILREF, (mState.stencilRef < (GLint)maxStencil) ? mState.stencilRef : maxStencil);
-            mDevice->SetRenderState(mState.frontFace == GL_CCW ? D3DRS_STENCILMASK : D3DRS_CCW_STENCILMASK, mState.stencilMask);
-
-            mDevice->SetRenderState(mState.frontFace == GL_CCW ? D3DRS_STENCILFAIL : D3DRS_CCW_STENCILFAIL, 
-                                   es2dx::ConvertStencilOp(mState.stencilFail));
-            mDevice->SetRenderState(mState.frontFace == GL_CCW ? D3DRS_STENCILZFAIL : D3DRS_CCW_STENCILZFAIL, 
-                                   es2dx::ConvertStencilOp(mState.stencilPassDepthFail));
-            mDevice->SetRenderState(mState.frontFace == GL_CCW ? D3DRS_STENCILPASS : D3DRS_CCW_STENCILPASS, 
-                                   es2dx::ConvertStencilOp(mState.stencilPassDepthPass));
-
-            mDevice->SetRenderState(mState.frontFace == GL_CW ? D3DRS_STENCILWRITEMASK : D3DRS_CCW_STENCILWRITEMASK, mState.stencilBackWritemask);
-            mDevice->SetRenderState(mState.frontFace == GL_CW ? D3DRS_STENCILFUNC : D3DRS_CCW_STENCILFUNC, 
-                                   es2dx::ConvertComparison(mState.stencilBackFunc));
-
-            mDevice->SetRenderState(mState.frontFace == GL_CW ? D3DRS_STENCILREF : D3DRS_CCW_STENCILREF, (mState.stencilBackRef < (GLint)maxStencil) ? mState.stencilBackRef : maxStencil);
-            mDevice->SetRenderState(mState.frontFace == GL_CW ? D3DRS_STENCILMASK : D3DRS_CCW_STENCILMASK, mState.stencilBackMask);
-
-            mDevice->SetRenderState(mState.frontFace == GL_CW ? D3DRS_STENCILFAIL : D3DRS_CCW_STENCILFAIL, 
-                                   es2dx::ConvertStencilOp(mState.stencilBackFail));
-            mDevice->SetRenderState(mState.frontFace == GL_CW ? D3DRS_STENCILZFAIL : D3DRS_CCW_STENCILZFAIL, 
-                                   es2dx::ConvertStencilOp(mState.stencilBackPassDepthFail));
-            mDevice->SetRenderState(mState.frontFace == GL_CW ? D3DRS_STENCILPASS : D3DRS_CCW_STENCILPASS, 
-                                   es2dx::ConvertStencilOp(mState.stencilBackPassDepthPass));
-        }
-        else
-        {
-            mDevice->SetRenderState(D3DRS_STENCILENABLE, FALSE);
-        }
-
-        mStencilStateDirty = false;
-        mFrontFaceDirty = false;
-    }
-
-    if (mMaskStateDirty)
-    {
-        int colorMask = es2dx::ConvertColorMask(mState.colorMaskRed, mState.colorMaskGreen, 
-                                                mState.colorMaskBlue, mState.colorMaskAlpha);
-        if (colorMask == 0 && !zeroColorMaskAllowed)
-        {
-            // Enable green channel, but set blending so nothing will be drawn.
-            mDevice->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_GREEN);
-            mDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
-
-            mDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ZERO);
-            mDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
-            mDevice->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD);
-        }
-        else
-        {
-            mDevice->SetRenderState(D3DRS_COLORWRITEENABLE, colorMask);
-        }
-        mDevice->SetRenderState(D3DRS_ZWRITEENABLE, mState.depthMask ? TRUE : FALSE);
-
-        mMaskStateDirty = false;
-    }
-
-    if (mPolygonOffsetStateDirty)
-    {
-        if (mState.polygonOffsetFill)
-        {
-            gl::Renderbuffer *depthbuffer = framebufferObject->getDepthbuffer();
-            if (depthbuffer)
-            {
-                mDevice->SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, *((DWORD*)&mState.polygonOffsetFactor));
-                float depthBias = ldexp(mState.polygonOffsetUnits, -(int)(depthbuffer->getDepthSize()));
-                mDevice->SetRenderState(D3DRS_DEPTHBIAS, *((DWORD*)&depthBias));
-            }
-        }
-        else
-        {
-            mDevice->SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, 0);
-            mDevice->SetRenderState(D3DRS_DEPTHBIAS, 0);
-        }
-
-        mPolygonOffsetStateDirty = false;
-    }
-
-    if (mSampleStateDirty)
-    {
-        if (mState.sampleAlphaToCoverage)
-        {
-            FIXME("Sample alpha to coverage is unimplemented.");
-        }
-
-        mDevice->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, TRUE);
-        if (mState.sampleCoverage)
-        {
-            unsigned int mask = 0;
-            if (mState.sampleCoverageValue != 0)
-            {
-                float threshold = 0.5f;
-
-                for (int i = 0; i < framebufferObject->getSamples(); ++i)
-                {
-                    mask <<= 1;
-
-                    if ((i + 1) * mState.sampleCoverageValue >= threshold)
-                    {
-                        threshold += 1.0f;
-                        mask |= 1;
-                    }
-                }
-            }
-            
-            if (mState.sampleCoverageInvert)
-            {
-                mask = ~mask;
-            }
-
-            mDevice->SetRenderState(D3DRS_MULTISAMPLEMASK, mask);
-        }
-        else
-        {
-            mDevice->SetRenderState(D3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
-        }
-
-        mSampleStateDirty = false;
-    }
-
-    if (mDitherStateDirty)
-    {
-        mDevice->SetRenderState(D3DRS_DITHERENABLE, mState.dither ? TRUE : FALSE);
-
-        mDitherStateDirty = false;
-    }
-}
-
-GLenum Context::applyVertexBuffer(GLint first, GLsizei count, GLsizei instances, GLsizei *repeatDraw)
-{
-    TranslatedAttribute attributes[MAX_VERTEX_ATTRIBS];
-
-    GLenum err = mVertexDataManager->prepareVertexData(first, count, attributes, instances);
-    if (err != GL_NO_ERROR)
-    {
-        return err;
-    }
-
-    return mVertexDeclarationCache.applyDeclaration(mDevice, attributes, getCurrentProgram(), instances, repeatDraw);
-}
-
-// Applies the indices and element array bindings to the Direct3D 9 device
-GLenum Context::applyIndexBuffer(const GLvoid *indices, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo)
-{
-    GLenum err = mIndexDataManager->prepareIndexData(type, count, mState.elementArrayBuffer.get(), indices, indexInfo);
-
-    if (err == GL_NO_ERROR)
-    {
-        if (indexInfo->serial != mAppliedIBSerial)
-        {
-            mDevice->SetIndices(indexInfo->indexBuffer);
-            mAppliedIBSerial = indexInfo->serial;
-        }
-    }
-
-    return err;
-}
-
-// Applies the shaders and shader constants to the Direct3D 9 device
-void Context::applyShaders()
-{
-    Program *programObject = getCurrentProgram();
-    ProgramBinary *programBinary = programObject->getProgramBinary();
-
-    if (programObject->getSerial() != mAppliedProgramSerial)
-    {
-        IDirect3DVertexShader9 *vertexShader = programBinary->getVertexShader();
-        IDirect3DPixelShader9 *pixelShader = programBinary->getPixelShader();
-
-        mDevice->SetPixelShader(pixelShader);
-        mDevice->SetVertexShader(vertexShader);
-        programBinary->dirtyAllUniforms();
-        mAppliedProgramSerial = programObject->getSerial();
-    }
-
-    programBinary->applyUniforms();
-}
-
-// Applies the textures and sampler states to the Direct3D 9 device
-void Context::applyTextures()
-{
-    applyTextures(SAMPLER_PIXEL);
-
-    if (mSupportsVertexTexture)
-    {
-        applyTextures(SAMPLER_VERTEX);
-    }
-}
-
-// For each Direct3D 9 sampler of either the pixel or vertex stage,
-// looks up the corresponding OpenGL texture image unit and texture type,
-// and sets the texture and its addressing/filtering state (or NULL when inactive).
-void Context::applyTextures(SamplerType type)
-{
-    Program *programObject = getCurrentProgram();
-    ProgramBinary *programBinary = programObject->getProgramBinary();
-
-    int samplerCount = (type == SAMPLER_PIXEL) ? MAX_TEXTURE_IMAGE_UNITS : MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF;   // Range of Direct3D 9 samplers of given sampler type
-    unsigned int *appliedTextureSerial = (type == SAMPLER_PIXEL) ? mAppliedTextureSerialPS : mAppliedTextureSerialVS;
-    int d3dSamplerOffset = (type == SAMPLER_PIXEL) ? 0 : D3DVERTEXTEXTURESAMPLER0;
-    int samplerRange = programBinary->getUsedSamplerRange(type);
-
-    for (int samplerIndex = 0; samplerIndex < samplerRange; samplerIndex++)
-    {
-        int textureUnit = programBinary->getSamplerMapping(type, samplerIndex);   // OpenGL texture image unit index
-        int d3dSampler = samplerIndex + d3dSamplerOffset;
-
-        if (textureUnit != -1)
-        {
-            TextureType textureType = programBinary->getSamplerTextureType(type, samplerIndex);
-
-            Texture *texture = getSamplerTexture(textureUnit, textureType);
-            unsigned int texSerial = texture->getTextureSerial();
-
-            if (appliedTextureSerial[samplerIndex] != texSerial || texture->hasDirtyParameters() || texture->hasDirtyImages())
-            {
-                IDirect3DBaseTexture9 *d3dTexture = texture->getTexture();
-
-                if (d3dTexture)
-                {
-                    if (appliedTextureSerial[samplerIndex] != texSerial || texture->hasDirtyParameters())
-                    {
-                        GLenum wrapS = texture->getWrapS();
-                        GLenum wrapT = texture->getWrapT();
-                        GLenum minFilter = texture->getMinFilter();
-                        GLenum magFilter = texture->getMagFilter();
-
-                        mDevice->SetSamplerState(d3dSampler, D3DSAMP_ADDRESSU, es2dx::ConvertTextureWrap(wrapS));
-                        mDevice->SetSamplerState(d3dSampler, D3DSAMP_ADDRESSV, es2dx::ConvertTextureWrap(wrapT));
-
-                        mDevice->SetSamplerState(d3dSampler, D3DSAMP_MAGFILTER, es2dx::ConvertMagFilter(magFilter));
-                        D3DTEXTUREFILTERTYPE d3dMinFilter, d3dMipFilter;
-                        es2dx::ConvertMinFilter(minFilter, &d3dMinFilter, &d3dMipFilter);
-                        mDevice->SetSamplerState(d3dSampler, D3DSAMP_MINFILTER, d3dMinFilter);
-                        mDevice->SetSamplerState(d3dSampler, D3DSAMP_MIPFILTER, d3dMipFilter);
-                    }
-
-                    if (appliedTextureSerial[samplerIndex] != texSerial || texture->hasDirtyImages())
-                    {
-                        mDevice->SetTexture(d3dSampler, d3dTexture);
-                    }
-                }
-                else
-                {
-                    mDevice->SetTexture(d3dSampler, getIncompleteTexture(textureType)->getTexture());
-                }
-
-                appliedTextureSerial[samplerIndex] = texSerial;
-                texture->resetDirty();
-            }
-        }
-        else
-        {
-            if (appliedTextureSerial[samplerIndex] != 0)
-            {
-                mDevice->SetTexture(d3dSampler, NULL);
-                appliedTextureSerial[samplerIndex] = 0;
-            }
-        }
-    }
-
-    for (int samplerIndex = samplerRange; samplerIndex < samplerCount; samplerIndex++)
-    {
-        if (appliedTextureSerial[samplerIndex] != 0)
-        {
-            mDevice->SetTexture(samplerIndex + d3dSamplerOffset, NULL);
-            appliedTextureSerial[samplerIndex] = 0;
-        }
-    }
-}
-
-void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
-                         GLenum format, GLenum type, GLsizei *bufSize, void* pixels)
-{
-    Framebuffer *framebuffer = getReadFramebuffer();
-
-    if (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
-    {
-        return error(GL_INVALID_FRAMEBUFFER_OPERATION);
-    }
-
-    if (getReadFramebufferHandle() != 0 && framebuffer->getSamples() != 0)
-    {
-        return error(GL_INVALID_OPERATION);
-    }
-
-    GLsizei outputPitch = ComputePitch(width, format, type, mState.packAlignment);
-    // sized query sanity check
-    if (bufSize)
-    {
-        int requiredSize = outputPitch * height;
-        if (requiredSize > *bufSize)
-        {
-            return error(GL_INVALID_OPERATION);
-        }
-    }
-
-    IDirect3DSurface9 *renderTarget = framebuffer->getRenderTarget();
-    if (!renderTarget)
-    {
-        return;   // Context must be lost, return silently
-    }
-
-    D3DSURFACE_DESC desc;
-    renderTarget->GetDesc(&desc);
-
-    if (desc.MultiSampleType != D3DMULTISAMPLE_NONE)
-    {
-        UNIMPLEMENTED();   // FIXME: Requires resolve using StretchRect into non-multisampled render target
-        renderTarget->Release();
-        return error(GL_OUT_OF_MEMORY);
-    }
-
-    HRESULT result;
-    IDirect3DSurface9 *systemSurface = NULL;
-    bool directToPixels = !getPackReverseRowOrder() && getPackAlignment() <= 4 && mDisplay->isD3d9ExDevice() &&
-                          x == 0 && y == 0 && UINT(width) == desc.Width && UINT(height) == desc.Height &&
-                          desc.Format == D3DFMT_A8R8G8B8 && format == GL_BGRA_EXT && type == GL_UNSIGNED_BYTE;
-    if (directToPixels)
-    {
-        // Use the pixels ptr as a shared handle to write directly into client's memory
-        result = mDevice->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format,
-                                                      D3DPOOL_SYSTEMMEM, &systemSurface, &pixels);
-        if (FAILED(result))
-        {
-            // Try again without the shared handle
-            directToPixels = false;
-        }
-    }
-
-    if (!directToPixels)
-    {
-        result = mDevice->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format,
-                                                      D3DPOOL_SYSTEMMEM, &systemSurface, NULL);
-        if (FAILED(result))
-        {
-            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
-            renderTarget->Release();
-            return error(GL_OUT_OF_MEMORY);
-        }
-    }
-
-    result = mDevice->GetRenderTargetData(renderTarget, systemSurface);
-    renderTarget->Release();
-    renderTarget = NULL;
-
-    if (FAILED(result))
-    {
-        systemSurface->Release();
-
-        // It turns out that D3D will sometimes produce more error
-        // codes than those documented.
-        if (checkDeviceLost(result))
-            return error(GL_OUT_OF_MEMORY);
-        else
-        {
-            UNREACHABLE();
-            return;
-        }
-
-    }
-
-    if (directToPixels)
-    {
-        systemSurface->Release();
-        return;
-    }
-
-    RECT rect;
-    rect.left = clamp(x, 0L, static_cast<LONG>(desc.Width));
-    rect.top = clamp(y, 0L, static_cast<LONG>(desc.Height));
-    rect.right = clamp(x + width, 0L, static_cast<LONG>(desc.Width));
-    rect.bottom = clamp(y + height, 0L, static_cast<LONG>(desc.Height));
-
-    D3DLOCKED_RECT lock;
-    result = systemSurface->LockRect(&lock, &rect, D3DLOCK_READONLY);
-
-    if (FAILED(result))
-    {
-        UNREACHABLE();
-        systemSurface->Release();
-
-        return;   // No sensible error to generate
-    }
-
-    unsigned char *dest = (unsigned char*)pixels;
-    unsigned short *dest16 = (unsigned short*)pixels;
-
-    unsigned char *source;
-    int inputPitch;
-    if (getPackReverseRowOrder())
-    {
-        source = ((unsigned char*)lock.pBits) + lock.Pitch * (rect.bottom - rect.top - 1);
-        inputPitch = -lock.Pitch;
-    }
-    else
-    {
-        source = (unsigned char*)lock.pBits;
-        inputPitch = lock.Pitch;
-    }
-
-    for (int j = 0; j < rect.bottom - rect.top; j++)
-    {
-        if (desc.Format == D3DFMT_A8R8G8B8 &&
-            format == GL_BGRA_EXT &&
-            type == GL_UNSIGNED_BYTE)
-        {
-            // Fast path for EXT_read_format_bgra, given
-            // an RGBA source buffer.  Note that buffers with no
-            // alpha go through the slow path below.
-            memcpy(dest + j * outputPitch,
-                   source + j * inputPitch,
-                   (rect.right - rect.left) * 4);
-            continue;
-        }
-
-        for (int i = 0; i < rect.right - rect.left; i++)
-        {
-            float r;
-            float g;
-            float b;
-            float a;
-
-            switch (desc.Format)
-            {
-              case D3DFMT_R5G6B5:
-                {
-                    unsigned short rgb = *(unsigned short*)(source + 2 * i + j * inputPitch);
-
-                    a = 1.0f;
-                    b = (rgb & 0x001F) * (1.0f / 0x001F);
-                    g = (rgb & 0x07E0) * (1.0f / 0x07E0);
-                    r = (rgb & 0xF800) * (1.0f / 0xF800);
-                }
-                break;
-              case D3DFMT_A1R5G5B5:
-                {
-                    unsigned short argb = *(unsigned short*)(source + 2 * i + j * inputPitch);
-
-                    a = (argb & 0x8000) ? 1.0f : 0.0f;
-                    b = (argb & 0x001F) * (1.0f / 0x001F);
-                    g = (argb & 0x03E0) * (1.0f / 0x03E0);
-                    r = (argb & 0x7C00) * (1.0f / 0x7C00);
-                }
-                break;
-              case D3DFMT_A8R8G8B8:
-                {
-                    unsigned int argb = *(unsigned int*)(source + 4 * i + j * inputPitch);
-
-                    a = (argb & 0xFF000000) * (1.0f / 0xFF000000);
-                    b = (argb & 0x000000FF) * (1.0f / 0x000000FF);
-                    g = (argb & 0x0000FF00) * (1.0f / 0x0000FF00);
-                    r = (argb & 0x00FF0000) * (1.0f / 0x00FF0000);
-                }
-                break;
-              case D3DFMT_X8R8G8B8:
-                {
-                    unsigned int xrgb = *(unsigned int*)(source + 4 * i + j * inputPitch);
-
-                    a = 1.0f;
-                    b = (xrgb & 0x000000FF) * (1.0f / 0x000000FF);
-                    g = (xrgb & 0x0000FF00) * (1.0f / 0x0000FF00);
-                    r = (xrgb & 0x00FF0000) * (1.0f / 0x00FF0000);
-                }
-                break;
-              case D3DFMT_A2R10G10B10:
-                {
-                    unsigned int argb = *(unsigned int*)(source + 4 * i + j * inputPitch);
-
-                    a = (argb & 0xC0000000) * (1.0f / 0xC0000000);
-                    b = (argb & 0x000003FF) * (1.0f / 0x000003FF);
-                    g = (argb & 0x000FFC00) * (1.0f / 0x000FFC00);
-                    r = (argb & 0x3FF00000) * (1.0f / 0x3FF00000);
-                }
-                break;
-              case D3DFMT_A32B32G32R32F:
-                {
-                    // float formats in D3D are stored rgba, rather than the other way round
-                    r = *((float*)(source + 16 * i + j * inputPitch) + 0);
-                    g = *((float*)(source + 16 * i + j * inputPitch) + 1);
-                    b = *((float*)(source + 16 * i + j * inputPitch) + 2);
-                    a = *((float*)(source + 16 * i + j * inputPitch) + 3);
-                }
-                break;
-              case D3DFMT_A16B16G16R16F:
-                {
-                    // float formats in D3D are stored rgba, rather than the other way round
-                    float abgr[4];
-
-                    D3DXFloat16To32Array(abgr, (D3DXFLOAT16*)(source + 8 * i + j * inputPitch), 4);
-
-                    a = abgr[3];
-                    b = abgr[2];
-                    g = abgr[1];
-                    r = abgr[0];
-                }
-                break;
-              default:
-                UNIMPLEMENTED();   // FIXME
-                UNREACHABLE();
-                return;
-            }
-
-            switch (format)
-            {
-              case GL_RGBA:
-                switch (type)
-                {
-                  case GL_UNSIGNED_BYTE:
-                    dest[4 * i + j * outputPitch + 0] = (unsigned char)(255 * r + 0.5f);
-                    dest[4 * i + j * outputPitch + 1] = (unsigned char)(255 * g + 0.5f);
-                    dest[4 * i + j * outputPitch + 2] = (unsigned char)(255 * b + 0.5f);
-                    dest[4 * i + j * outputPitch + 3] = (unsigned char)(255 * a + 0.5f);
-                    break;
-                  default: UNREACHABLE();
-                }
-                break;
-              case GL_BGRA_EXT:
-                switch (type)
-                {
-                  case GL_UNSIGNED_BYTE:
-                    dest[4 * i + j * outputPitch + 0] = (unsigned char)(255 * b + 0.5f);
-                    dest[4 * i + j * outputPitch + 1] = (unsigned char)(255 * g + 0.5f);
-                    dest[4 * i + j * outputPitch + 2] = (unsigned char)(255 * r + 0.5f);
-                    dest[4 * i + j * outputPitch + 3] = (unsigned char)(255 * a + 0.5f);
-                    break;
-                  case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
-                    // According to the desktop GL spec in the "Transfer of Pixel Rectangles" section
-                    // this type is packed as follows:
-                    //   15   14   13   12   11   10    9    8    7    6    5    4    3    2    1    0
-                    //  --------------------------------------------------------------------------------
-                    // |       4th         |        3rd         |        2nd        |   1st component   |
-                    //  --------------------------------------------------------------------------------
-                    // in the case of BGRA_EXT, B is the first component, G the second, and so forth.
-                    dest16[i + j * outputPitch / sizeof(unsigned short)] =
-                        ((unsigned short)(15 * a + 0.5f) << 12)|
-                        ((unsigned short)(15 * r + 0.5f) << 8) |
-                        ((unsigned short)(15 * g + 0.5f) << 4) |
-                        ((unsigned short)(15 * b + 0.5f) << 0);
-                    break;
-                  case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
-                    // According to the desktop GL spec in the "Transfer of Pixel Rectangles" section
-                    // this type is packed as follows:
-                    //   15   14   13   12   11   10    9    8    7    6    5    4    3    2    1    0
-                    //  --------------------------------------------------------------------------------
-                    // | 4th |          3rd           |           2nd          |      1st component     |
-                    //  --------------------------------------------------------------------------------
-                    // in the case of BGRA_EXT, B is the first component, G the second, and so forth.
-                    dest16[i + j * outputPitch / sizeof(unsigned short)] =
-                        ((unsigned short)(     a + 0.5f) << 15) |
-                        ((unsigned short)(31 * r + 0.5f) << 10) |
-                        ((unsigned short)(31 * g + 0.5f) << 5) |
-                        ((unsigned short)(31 * b + 0.5f) << 0);
-                    break;
-                  default: UNREACHABLE();
-                }
-                break;
-              case GL_RGB:   // IMPLEMENTATION_COLOR_READ_FORMAT
-                switch (type)
-                {
-                  case GL_UNSIGNED_SHORT_5_6_5:   // IMPLEMENTATION_COLOR_READ_TYPE
-                    dest16[i + j * outputPitch / sizeof(unsigned short)] = 
-                        ((unsigned short)(31 * b + 0.5f) << 0) |
-                        ((unsigned short)(63 * g + 0.5f) << 5) |
-                        ((unsigned short)(31 * r + 0.5f) << 11);
-                    break;
-                  default: UNREACHABLE();
-                }
-                break;
-              default: UNREACHABLE();
-            }
-        }
-    }
-
-    systemSurface->UnlockRect();
-
-    systemSurface->Release();
-}
-
-void Context::clear(GLbitfield mask)
-{
-    Framebuffer *framebufferObject = getDrawFramebuffer();
-
-    if (!framebufferObject || framebufferObject->completeness() != GL_FRAMEBUFFER_COMPLETE)
-    {
-        return error(GL_INVALID_FRAMEBUFFER_OPERATION);
-    }
-
-    DWORD flags = 0;
-
-    if (mask & GL_COLOR_BUFFER_BIT)
-    {
-        mask &= ~GL_COLOR_BUFFER_BIT;
-
-        if (framebufferObject->getColorbufferType() != GL_NONE)
-        {
-            flags |= D3DCLEAR_TARGET;
-        }
-    }
-
-    if (mask & GL_DEPTH_BUFFER_BIT)
-    {
-        mask &= ~GL_DEPTH_BUFFER_BIT;
-        if (mState.depthMask && framebufferObject->getDepthbufferType() != GL_NONE)
-        {
-            flags |= D3DCLEAR_ZBUFFER;
-        }
-    }
-
-    GLuint stencilUnmasked = 0x0;
-
-    if (mask & GL_STENCIL_BUFFER_BIT)
-    {
-        mask &= ~GL_STENCIL_BUFFER_BIT;
-        if (framebufferObject->getStencilbufferType() != GL_NONE)
-        {
-            IDirect3DSurface9 *depthStencil = framebufferObject->getStencilbuffer()->getDepthStencil();
-            if (!depthStencil)
-            {
-                ERR("Depth stencil pointer unexpectedly null.");
-                return;
-            }
-            
-            D3DSURFACE_DESC desc;
-            depthStencil->GetDesc(&desc);
-            depthStencil->Release();
-
-            unsigned int stencilSize = dx2es::GetStencilSize(desc.Format);
-            stencilUnmasked = (0x1 << stencilSize) - 1;
-
-            if (stencilUnmasked != 0x0)
-            {
-                flags |= D3DCLEAR_STENCIL;
-            }
-        }
-    }
-
-    if (mask != 0)
-    {
-        return error(GL_INVALID_VALUE);
-    }
-
-    if (!applyRenderTarget(true))   // Clips the clear to the scissor rectangle but not the viewport
-    {
-        return;
-    }
-
-    D3DCOLOR color = D3DCOLOR_ARGB(unorm<8>(mState.colorClearValue.alpha), 
-                                   unorm<8>(mState.colorClearValue.red), 
-                                   unorm<8>(mState.colorClearValue.green), 
-                                   unorm<8>(mState.colorClearValue.blue));
-    float depth = clamp01(mState.depthClearValue);
-    int stencil = mState.stencilClearValue & 0x000000FF;
-
-    bool alphaUnmasked = (dx2es::GetAlphaSize(mRenderTargetDesc.Format) == 0) || mState.colorMaskAlpha;
-
-    const bool needMaskedStencilClear = (flags & D3DCLEAR_STENCIL) &&
-                                        (mState.stencilWritemask & stencilUnmasked) != stencilUnmasked;
-    const bool needMaskedColorClear = (flags & D3DCLEAR_TARGET) &&
-                                      !(mState.colorMaskRed && mState.colorMaskGreen &&
-                                        mState.colorMaskBlue && alphaUnmasked);
-
-    if (needMaskedColorClear || needMaskedStencilClear)
-    {
-        // State which is altered in all paths from this point to the clear call is saved.
-        // State which is altered in only some paths will be flagged dirty in the case that
-        //  that path is taken.
-        HRESULT hr;
-        if (mMaskedClearSavedState == NULL)
-        {
-            hr = mDevice->BeginStateBlock();
-            ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
-
-            mDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
-            mDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
-            mDevice->SetRenderState(D3DRS_ZENABLE, FALSE);
-            mDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
-            mDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
-            mDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
-            mDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
-            mDevice->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
-            mDevice->SetRenderState(D3DRS_COLORWRITEENABLE, 0);
-            mDevice->SetRenderState(D3DRS_STENCILENABLE, FALSE);
-            mDevice->SetPixelShader(NULL);
-            mDevice->SetVertexShader(NULL);
-            mDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
-            mDevice->SetStreamSource(0, NULL, 0, 0);
-            mDevice->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
-            mDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
-            mDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TFACTOR);
-            mDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
-            mDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR);
-            mDevice->SetRenderState(D3DRS_TEXTUREFACTOR, color);
-            mDevice->SetRenderState(D3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
-            
-            for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
-            {
-                mDevice->SetStreamSourceFreq(i, 1);
-            }
-
-            hr = mDevice->EndStateBlock(&mMaskedClearSavedState);
-            ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
-        }
-
-        ASSERT(mMaskedClearSavedState != NULL);
-
-        if (mMaskedClearSavedState != NULL)
-        {
-            hr = mMaskedClearSavedState->Capture();
-            ASSERT(SUCCEEDED(hr));
-        }
-
-        mDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
-        mDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
-        mDevice->SetRenderState(D3DRS_ZENABLE, FALSE);
-        mDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
-        mDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
-        mDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
-        mDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
-        mDevice->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
-
-        if (flags & D3DCLEAR_TARGET)
-        {
-            mDevice->SetRenderState(D3DRS_COLORWRITEENABLE, es2dx::ConvertColorMask(mState.colorMaskRed, mState.colorMaskGreen, mState.colorMaskBlue, mState.colorMaskAlpha));
-        }
-        else
-        {
-            mDevice->SetRenderState(D3DRS_COLORWRITEENABLE, 0);
-        }
-
-        if (stencilUnmasked != 0x0 && (flags & D3DCLEAR_STENCIL))
-        {
-            mDevice->SetRenderState(D3DRS_STENCILENABLE, TRUE);
-            mDevice->SetRenderState(D3DRS_TWOSIDEDSTENCILMODE, FALSE);
-            mDevice->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_ALWAYS);
-            mDevice->SetRenderState(D3DRS_STENCILREF, stencil);
-            mDevice->SetRenderState(D3DRS_STENCILWRITEMASK, mState.stencilWritemask);
-            mDevice->SetRenderState(D3DRS_STENCILFAIL, D3DSTENCILOP_REPLACE);
-            mDevice->SetRenderState(D3DRS_STENCILZFAIL, D3DSTENCILOP_REPLACE);
-            mDevice->SetRenderState(D3DRS_STENCILPASS, D3DSTENCILOP_REPLACE);
-            mStencilStateDirty = true;
-        }
-        else
-        {
-            mDevice->SetRenderState(D3DRS_STENCILENABLE, FALSE);
-        }
-
-        mDevice->SetPixelShader(NULL);
-        mDevice->SetVertexShader(NULL);
-        mDevice->SetFVF(D3DFVF_XYZRHW);
-        mDevice->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
-        mDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
-        mDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TFACTOR);
-        mDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
-        mDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR);
-        mDevice->SetRenderState(D3DRS_TEXTUREFACTOR, color);
-        mDevice->SetRenderState(D3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
-
-        for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
-        {
-            mDevice->SetStreamSourceFreq(i, 1);
-        }
-
-        float quad[4][4];   // A quadrilateral covering the target, aligned to match the edges
-        quad[0][0] = -0.5f;
-        quad[0][1] = mRenderTargetDesc.Height - 0.5f;
-        quad[0][2] = 0.0f;
-        quad[0][3] = 1.0f;
-
-        quad[1][0] = mRenderTargetDesc.Width - 0.5f;
-        quad[1][1] = mRenderTargetDesc.Height - 0.5f;
-        quad[1][2] = 0.0f;
-        quad[1][3] = 1.0f;
-
-        quad[2][0] = -0.5f;
-        quad[2][1] = -0.5f;
-        quad[2][2] = 0.0f;
-        quad[2][3] = 1.0f;
-
-        quad[3][0] = mRenderTargetDesc.Width - 0.5f;
-        quad[3][1] = -0.5f;
-        quad[3][2] = 0.0f;
-        quad[3][3] = 1.0f;
-
-        mDisplay->startScene();
-        mDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, quad, sizeof(float[4]));
-
-        if (flags & D3DCLEAR_ZBUFFER)
-        {
-            mDevice->SetRenderState(D3DRS_ZENABLE, TRUE);
-            mDevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
-            mDevice->Clear(0, NULL, D3DCLEAR_ZBUFFER, color, depth, stencil);
-        }
-
-        if (mMaskedClearSavedState != NULL)
-        {
-            mMaskedClearSavedState->Apply();
-        }
-    }
-    else if (flags)
-    {
-        mDevice->Clear(0, NULL, flags, color, depth, stencil);
-    }
-}
-
-void Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances)
-{
-    if (!mState.currentProgram)
-    {
-        return error(GL_INVALID_OPERATION);
-    }
-
-    D3DPRIMITIVETYPE primitiveType;
-    int primitiveCount;
-
-    if(!es2dx::ConvertPrimitiveType(mode, count, &primitiveType, &primitiveCount))
-        return error(GL_INVALID_ENUM);
-
-    if (primitiveCount <= 0)
-    {
-        return;
-    }
-
-    if (!applyRenderTarget(false))
-    {
-        return;
-    }
-
-    applyState(mode);
-
-    GLsizei repeatDraw = 1;
-    GLenum err = applyVertexBuffer(first, count, instances, &repeatDraw);
-    if (err != GL_NO_ERROR)
-    {
-        return error(err);
-    }
-
-    applyShaders();
-    applyTextures();
-
-    if (!getCurrentProgram()->getProgramBinary()->validateSamplers(NULL))
-    {
-        return error(GL_INVALID_OPERATION);
-    }
-
-    if (!cullSkipsDraw(mode))
-    {
-        mDisplay->startScene();
-        
-        if (mode == GL_LINE_LOOP)
-        {
-            drawLineLoop(count, GL_NONE, NULL, 0);
-        }
-        else if (instances > 0)
-        {
-            StaticIndexBuffer *countingIB = mIndexDataManager->getCountingIndices(count);
-            if (countingIB)
-            {
-                if (mAppliedIBSerial != countingIB->getSerial())
-                {
-                    mDevice->SetIndices(countingIB->getBuffer());
-                    mAppliedIBSerial = countingIB->getSerial();
-                }
-
-                for (int i = 0; i < repeatDraw; i++)
-                {
-                    mDevice->DrawIndexedPrimitive(primitiveType, 0, 0, count, 0, primitiveCount);
-                }
-            }
-            else
-            {
-                ERR("Could not create a counting index buffer for glDrawArraysInstanced.");
-                return error(GL_OUT_OF_MEMORY);
-            }
-        }
-        else   // Regular case
-        {
-            mDevice->DrawPrimitive(primitiveType, 0, primitiveCount);
-        }
-    }
-}
-
-void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instances)
-{
-    if (!mState.currentProgram)
-    {
-        return error(GL_INVALID_OPERATION);
-    }
-
-    if (!indices && !mState.elementArrayBuffer)
-    {
-        return error(GL_INVALID_OPERATION);
-    }
-
-    D3DPRIMITIVETYPE primitiveType;
-    int primitiveCount;
-
-    if(!es2dx::ConvertPrimitiveType(mode, count, &primitiveType, &primitiveCount))
-        return error(GL_INVALID_ENUM);
-
-    if (primitiveCount <= 0)
-    {
-        return;
-    }
-
-    if (!applyRenderTarget(false))
-    {
-        return;
-    }
-
-    applyState(mode);
-
-    TranslatedIndexData indexInfo;
-    GLenum err = applyIndexBuffer(indices, count, mode, type, &indexInfo);
-    if (err != GL_NO_ERROR)
-    {
-        return error(err);
-    }
-
-    GLsizei vertexCount = indexInfo.maxIndex - indexInfo.minIndex + 1;
-    GLsizei repeatDraw = 1;
-    err = applyVertexBuffer(indexInfo.minIndex, vertexCount, instances, &repeatDraw);
-    if (err != GL_NO_ERROR)
-    {
-        return error(err);
-    }
-
-    applyShaders();
-    applyTextures();
-
-    if (!getCurrentProgram()->getProgramBinary()->validateSamplers(false))
-    {
-        return error(GL_INVALID_OPERATION);
-    }
-
-    if (!cullSkipsDraw(mode))
-    {
-        mDisplay->startScene();
-
-        if (mode == GL_LINE_LOOP)
-        {
-            drawLineLoop(count, type, indices, indexInfo.minIndex);   
-        }
-        else
-        {
-            for (int i = 0; i < repeatDraw; i++)
-            {
-                mDevice->DrawIndexedPrimitive(primitiveType, -(INT)indexInfo.minIndex, indexInfo.minIndex, vertexCount, indexInfo.startIndex, primitiveCount);
-            }
-        }
-    }
-}
-
-// Implements glFlush when block is false, glFinish when block is true
-void Context::sync(bool block)
-{
-    mDisplay->sync(block);
-}
-
-void Context::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex)
-{
-    // Get the raw indices for an indexed draw
-    if (type != GL_NONE && mState.elementArrayBuffer.get())
-    {
-        Buffer *indexBuffer = mState.elementArrayBuffer.get();
-        intptr_t offset = reinterpret_cast<intptr_t>(indices);
-        indices = static_cast<const GLubyte*>(indexBuffer->data()) + offset;
-    }
-
-    UINT startIndex = 0;
-    bool succeeded = false;
-
-    if (supports32bitIndices())
-    {
-        const int spaceNeeded = (count + 1) * sizeof(unsigned int);
-
-        if (!mLineLoopIB)
-        {
-            mLineLoopIB = new StreamingIndexBuffer(mDevice, INITIAL_INDEX_BUFFER_SIZE, D3DFMT_INDEX32);
-        }
-
-        if (mLineLoopIB)
-        {
-            mLineLoopIB->reserveSpace(spaceNeeded, GL_UNSIGNED_INT);
-
-            UINT offset = 0;
-            unsigned int *data = static_cast<unsigned int*>(mLineLoopIB->map(spaceNeeded, &offset));
-            startIndex = offset / 4;
-            
-            if (data)
-            {
-                switch (type)
-                {
-                  case GL_NONE:   // Non-indexed draw
-                    for (int i = 0; i < count; i++)
-                    {
-                        data[i] = i;
-                    }
-                    data[count] = 0;
-                    break;
-                  case GL_UNSIGNED_BYTE:
-                    for (int i = 0; i < count; i++)
-                    {
-                        data[i] = static_cast<const GLubyte*>(indices)[i];
-                    }
-                    data[count] = static_cast<const GLubyte*>(indices)[0];
-                    break;
-                  case GL_UNSIGNED_SHORT:
-                    for (int i = 0; i < count; i++)
-                    {
-                        data[i] = static_cast<const GLushort*>(indices)[i];
-                    }
-                    data[count] = static_cast<const GLushort*>(indices)[0];
-                    break;
-                  case GL_UNSIGNED_INT:
-                    for (int i = 0; i < count; i++)
-                    {
-                        data[i] = static_cast<const GLuint*>(indices)[i];
-                    }
-                    data[count] = static_cast<const GLuint*>(indices)[0];
-                    break;
-                  default: UNREACHABLE();
-                }
-
-                mLineLoopIB->unmap();
-                succeeded = true;
-            }
-        }
-    }
-    else
-    {
-        const int spaceNeeded = (count + 1) * sizeof(unsigned short);
-
-        if (!mLineLoopIB)
-        {
-            mLineLoopIB = new StreamingIndexBuffer(mDevice, INITIAL_INDEX_BUFFER_SIZE, D3DFMT_INDEX16);
-        }
-
-        if (mLineLoopIB)
-        {
-            mLineLoopIB->reserveSpace(spaceNeeded, GL_UNSIGNED_SHORT);
-
-            UINT offset = 0;
-            unsigned short *data = static_cast<unsigned short*>(mLineLoopIB->map(spaceNeeded, &offset));
-            startIndex = offset / 2;
-            
-            if (data)
-            {
-                switch (type)
-                {
-                  case GL_NONE:   // Non-indexed draw
-                    for (int i = 0; i < count; i++)
-                    {
-                        data[i] = i;
-                    }
-                    data[count] = 0;
-                    break;
-                  case GL_UNSIGNED_BYTE:
-                    for (int i = 0; i < count; i++)
-                    {
-                        data[i] = static_cast<const GLubyte*>(indices)[i];
-                    }
-                    data[count] = static_cast<const GLubyte*>(indices)[0];
-                    break;
-                  case GL_UNSIGNED_SHORT:
-                    for (int i = 0; i < count; i++)
-                    {
-                        data[i] = static_cast<const GLushort*>(indices)[i];
-                    }
-                    data[count] = static_cast<const GLushort*>(indices)[0];
-                    break;
-                  case GL_UNSIGNED_INT:
-                    for (int i = 0; i < count; i++)
-                    {
-                        data[i] = static_cast<const GLuint*>(indices)[i];
-                    }
-                    data[count] = static_cast<const GLuint*>(indices)[0];
-                    break;
-                  default: UNREACHABLE();
-                }
-
-                mLineLoopIB->unmap();
-                succeeded = true;
-            }
-        }
-    }
-    
-    if (succeeded)
-    {
-        if (mAppliedIBSerial != mLineLoopIB->getSerial())
-        {
-            mDevice->SetIndices(mLineLoopIB->getBuffer());
-            mAppliedIBSerial = mLineLoopIB->getSerial();
-        }
-
-        mDevice->DrawIndexedPrimitive(D3DPT_LINESTRIP, -minIndex, minIndex, count, startIndex, count);
-    }
-    else
-    {
-        ERR("Could not create a looping index buffer for GL_LINE_LOOP.");
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void Context::recordInvalidEnum()
-{
-    mInvalidEnum = true;
-}
-
-void Context::recordInvalidValue()
-{
-    mInvalidValue = true;
-}
-
-void Context::recordInvalidOperation()
-{
-    mInvalidOperation = true;
-}
-
-void Context::recordOutOfMemory()
-{
-    mOutOfMemory = true;
-}
-
-void Context::recordInvalidFramebufferOperation()
-{
-    mInvalidFramebufferOperation = true;
-}
-
-// Get one of the recorded errors and clear its flag, if any.
-// [OpenGL ES 2.0.24] section 2.5 page 13.
-GLenum Context::getError()
-{
-    if (mInvalidEnum)
-    {
-        mInvalidEnum = false;
-
-        return GL_INVALID_ENUM;
-    }
-
-    if (mInvalidValue)
-    {
-        mInvalidValue = false;
-
-        return GL_INVALID_VALUE;
-    }
-
-    if (mInvalidOperation)
-    {
-        mInvalidOperation = false;
-
-        return GL_INVALID_OPERATION;
-    }
-
-    if (mOutOfMemory)
-    {
-        mOutOfMemory = false;
-
-        return GL_OUT_OF_MEMORY;
-    }
-
-    if (mInvalidFramebufferOperation)
-    {
-        mInvalidFramebufferOperation = false;
-
-        return GL_INVALID_FRAMEBUFFER_OPERATION;
-    }
-
-    return GL_NO_ERROR;
-}
-
-GLenum Context::getResetStatus()
-{
-    if (mResetStatus == GL_NO_ERROR)
-    {
-        bool lost = mDisplay->testDeviceLost();
-
-        if (lost)
-        {
-            mDisplay->notifyDeviceLost();   // Sets mResetStatus
-        }
-    }
-
-    GLenum status = mResetStatus;
-
-    if (mResetStatus != GL_NO_ERROR)
-    {
-        if (mDisplay->testDeviceResettable())
-        {
-            mResetStatus = GL_NO_ERROR;
-        }
-    }
-    
-    return status;
-}
-
-bool Context::isResetNotificationEnabled()
-{
-    return (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT);
-}
-
-bool Context::supportsShaderModel3() const
-{
-    return mSupportsShaderModel3;
-}
-
-int Context::getMaximumVaryingVectors() const
-{
-    return mSupportsShaderModel3 ? MAX_VARYING_VECTORS_SM3 : MAX_VARYING_VECTORS_SM2;
-}
-
-unsigned int Context::getMaximumVertexTextureImageUnits() const
-{
-    return mSupportsVertexTexture ? MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF : 0;
-}
-
-unsigned int Context::getMaximumCombinedTextureImageUnits() const
-{
-    return MAX_TEXTURE_IMAGE_UNITS + getMaximumVertexTextureImageUnits();
-}
-
-int Context::getMaximumFragmentUniformVectors() const
-{
-    return mSupportsShaderModel3 ? MAX_FRAGMENT_UNIFORM_VECTORS_SM3 : MAX_FRAGMENT_UNIFORM_VECTORS_SM2;
-}
-
-int Context::getMaxSupportedSamples() const
-{
-    return mMaxSupportedSamples;
-}
-
-int Context::getNearestSupportedSamples(D3DFORMAT format, int requested) const
-{
-    if (requested == 0)
-    {
-        return requested;
-    }
-
-    std::map<D3DFORMAT, bool *>::const_iterator itr = mMultiSampleSupport.find(format);
-    if (itr == mMultiSampleSupport.end())
-    {
-        return -1;
-    }
-
-    for (int i = requested; i <= D3DMULTISAMPLE_16_SAMPLES; ++i)
-    {
-        if (itr->second[i] && i != D3DMULTISAMPLE_NONMASKABLE)
-        {
-            return i;
-        }
-    }
-
-    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;
-}
-
-bool Context::supportsDXT5Textures() const
-{
-    return mSupportsDXT5Textures;
-}
-
-bool Context::supportsFloat32Textures() const
-{
-    return mSupportsFloat32Textures;
-}
-
-bool Context::supportsFloat32LinearFilter() const
-{
-    return mSupportsFloat32LinearFilter;
-}
-
-bool Context::supportsFloat32RenderableTextures() const
-{
-    return mSupportsFloat32RenderableTextures;
-}
-
-bool Context::supportsFloat16Textures() const
-{
-    return mSupportsFloat16Textures;
-}
-
-bool Context::supportsFloat16LinearFilter() const
-{
-    return mSupportsFloat16LinearFilter;
-}
-
-bool Context::supportsFloat16RenderableTextures() const
-{
-    return mSupportsFloat16RenderableTextures;
-}
-
-int Context::getMaximumRenderbufferDimension() const
-{
-    return mMaxRenderbufferDimension;
-}
-
-int Context::getMaximumTextureDimension() const
-{
-    return mMaxTextureDimension;
-}
-
-int Context::getMaximumCubeTextureDimension() const
-{
-    return mMaxCubeTextureDimension;
-}
-
-int Context::getMaximumTextureLevel() const
-{
-    return mMaxTextureLevel;
-}
-
-bool Context::supportsLuminanceTextures() const
-{
-    return mSupportsLuminanceTextures;
-}
-
-bool Context::supportsLuminanceAlphaTextures() const
-{
-    return mSupportsLuminanceAlphaTextures;
-}
-
-bool Context::supportsDepthTextures() const
-{
-    return mSupportsDepthTextures;
-}
-
-bool Context::supports32bitIndices() const
-{
-    return mSupports32bitIndices;
-}
-
-bool Context::supportsNonPower2Texture() const
-{
-    return mSupportsNonPower2Texture;
-}
-
-bool Context::supportsInstancing() const
-{
-    return mSupportsInstancing;
-}
-
-void Context::detachBuffer(GLuint buffer)
-{
-    // [OpenGL ES 2.0.24] section 2.9 page 22:
-    // If a buffer object is deleted while it is bound, all bindings to that object in the current context
-    // (i.e. in the thread that called Delete-Buffers) are reset to zero.
-
-    if (mState.arrayBuffer.id() == buffer)
-    {
-        mState.arrayBuffer.set(NULL);
-    }
-
-    if (mState.elementArrayBuffer.id() == buffer)
-    {
-        mState.elementArrayBuffer.set(NULL);
-    }
-
-    for (int attribute = 0; attribute < MAX_VERTEX_ATTRIBS; attribute++)
-    {
-        if (mState.vertexAttribute[attribute].mBoundBuffer.id() == buffer)
-        {
-            mState.vertexAttribute[attribute].mBoundBuffer.set(NULL);
-        }
-    }
-}
-
-void Context::detachTexture(GLuint texture)
-{
-    // [OpenGL ES 2.0.24] section 3.8 page 84:
-    // If a texture object is deleted, it is as if all texture units which are bound to that texture object are
-    // rebound to texture object zero
-
-    for (int type = 0; type < TEXTURE_TYPE_COUNT; type++)
-    {
-        for (int sampler = 0; sampler < MAX_COMBINED_TEXTURE_IMAGE_UNITS_VTF; sampler++)
-        {
-            if (mState.samplerTexture[type][sampler].id() == texture)
-            {
-                mState.samplerTexture[type][sampler].set(NULL);
-            }
-        }
-    }
-
-    // [OpenGL ES 2.0.24] section 4.4 page 112:
-    // If a texture object is deleted while its image is attached to the currently bound framebuffer, then it is
-    // as if FramebufferTexture2D had been called, with a texture of 0, for each attachment point to which this
-    // image was attached in the currently bound framebuffer.
-
-    Framebuffer *readFramebuffer = getReadFramebuffer();
-    Framebuffer *drawFramebuffer = getDrawFramebuffer();
-
-    if (readFramebuffer)
-    {
-        readFramebuffer->detachTexture(texture);
-    }
-
-    if (drawFramebuffer && drawFramebuffer != readFramebuffer)
-    {
-        drawFramebuffer->detachTexture(texture);
-    }
-}
-
-void Context::detachFramebuffer(GLuint framebuffer)
-{
-    // [OpenGL ES 2.0.24] section 4.4 page 107:
-    // If a framebuffer that is currently bound to the target FRAMEBUFFER is deleted, it is as though
-    // BindFramebuffer had been executed with the target of FRAMEBUFFER and framebuffer of zero.
-
-    if (mState.readFramebuffer == framebuffer)
-    {
-        bindReadFramebuffer(0);
-    }
-
-    if (mState.drawFramebuffer == framebuffer)
-    {
-        bindDrawFramebuffer(0);
-    }
-}
-
-void Context::detachRenderbuffer(GLuint renderbuffer)
-{
-    // [OpenGL ES 2.0.24] section 4.4 page 109:
-    // If a renderbuffer that is currently bound to RENDERBUFFER is deleted, it is as though BindRenderbuffer
-    // had been executed with the target RENDERBUFFER and name of zero.
-
-    if (mState.renderbuffer.id() == renderbuffer)
-    {
-        bindRenderbuffer(0);
-    }
-
-    // [OpenGL ES 2.0.24] section 4.4 page 111:
-    // If a renderbuffer object is deleted while its image is attached to the currently bound framebuffer,
-    // then it is as if FramebufferRenderbuffer had been called, with a renderbuffer of 0, for each attachment
-    // point to which this image was attached in the currently bound framebuffer.
-
-    Framebuffer *readFramebuffer = getReadFramebuffer();
-    Framebuffer *drawFramebuffer = getDrawFramebuffer();
-
-    if (readFramebuffer)
-    {
-        readFramebuffer->detachRenderbuffer(renderbuffer);
-    }
-
-    if (drawFramebuffer && drawFramebuffer != readFramebuffer)
-    {
-        drawFramebuffer->detachRenderbuffer(renderbuffer);
-    }
-}
-
-Texture *Context::getIncompleteTexture(TextureType type)
-{
-    Texture *t = mIncompleteTextures[type].get();
-
-    if (t == NULL)
-    {
-        static const GLubyte color[] = { 0, 0, 0, 255 };
-
-        switch (type)
-        {
-          default:
-            UNREACHABLE();
-            // default falls through to TEXTURE_2D
-
-          case TEXTURE_2D:
-            {
-                Texture2D *incomplete2d = new Texture2D(Texture::INCOMPLETE_TEXTURE_ID);
-                incomplete2d->setImage(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
-                t = incomplete2d;
-            }
-            break;
-
-          case TEXTURE_CUBE:
-            {
-              TextureCubeMap *incompleteCube = new TextureCubeMap(Texture::INCOMPLETE_TEXTURE_ID);
-
-              incompleteCube->setImagePosX(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
-              incompleteCube->setImageNegX(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
-              incompleteCube->setImagePosY(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
-              incompleteCube->setImageNegY(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
-              incompleteCube->setImagePosZ(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
-              incompleteCube->setImageNegZ(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
-
-              t = incompleteCube;
-            }
-            break;
-        }
-
-        mIncompleteTextures[type].set(t);
-    }
-
-    return t;
-}
-
-bool Context::cullSkipsDraw(GLenum drawMode)
-{
-    return mState.cullFace && mState.cullMode == GL_FRONT_AND_BACK && isTriangleMode(drawMode);
-}
-
-bool Context::isTriangleMode(GLenum drawMode)
-{
-    switch (drawMode)
-    {
-      case GL_TRIANGLES:
-      case GL_TRIANGLE_FAN:
-      case GL_TRIANGLE_STRIP:
-        return true;
-      case GL_POINTS:
-      case GL_LINES:
-      case GL_LINE_LOOP:
-      case GL_LINE_STRIP:
-        return false;
-      default: UNREACHABLE();
-    }
-
-    return false;
-}
-
-void Context::setVertexAttrib(GLuint index, const GLfloat *values)
-{
-    ASSERT(index < gl::MAX_VERTEX_ATTRIBS);
-
-    mState.vertexAttribute[index].mCurrentValue[0] = values[0];
-    mState.vertexAttribute[index].mCurrentValue[1] = values[1];
-    mState.vertexAttribute[index].mCurrentValue[2] = values[2];
-    mState.vertexAttribute[index].mCurrentValue[3] = values[3];
-
-    mVertexDataManager->dirtyCurrentValue(index);
-}
-
-void Context::setVertexAttribDivisor(GLuint index, GLuint divisor)
-{
-    ASSERT(index < gl::MAX_VERTEX_ATTRIBS);
-
-    mState.vertexAttribute[index].mDivisor = divisor;
-}
-
-// keep list sorted in following order
-// OES extensions
-// EXT extensions
-// Vendor extensions
-void Context::initExtensionString()
-{
-    mExtensionString = "";
-
-    // OES extensions
-    if (supports32bitIndices())
-    {
-        mExtensionString += "GL_OES_element_index_uint ";
-    }
-
-    mExtensionString += "GL_OES_packed_depth_stencil ";
-    //mExtensionString += "GL_OES_get_program_binary ";
-    mExtensionString += "GL_OES_rgb8_rgba8 ";
-    mExtensionString += "GL_OES_standard_derivatives ";
-
-    if (supportsFloat16Textures())
-    {
-        mExtensionString += "GL_OES_texture_half_float ";
-    }
-    if (supportsFloat16LinearFilter())
-    {
-        mExtensionString += "GL_OES_texture_half_float_linear ";
-    }
-    if (supportsFloat32Textures())
-    {
-        mExtensionString += "GL_OES_texture_float ";
-    }
-    if (supportsFloat32LinearFilter())
-    {
-        mExtensionString += "GL_OES_texture_float_linear ";
-    }
-
-    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 ";
-    }
-
-    mExtensionString += "GL_EXT_texture_format_BGRA8888 ";
-    mExtensionString += "GL_EXT_texture_storage ";
-
-    // ANGLE-specific extensions
-    if (supportsDepthTextures())
-    {
-        mExtensionString += "GL_ANGLE_depth_texture ";
-    }
-
-    mExtensionString += "GL_ANGLE_framebuffer_blit ";
-    if (getMaxSupportedSamples() != 0)
-    {
-        mExtensionString += "GL_ANGLE_framebuffer_multisample ";
-    }
-
-    if (supportsInstancing())
-    {
-        mExtensionString += "GL_ANGLE_instanced_arrays ";
-    }
-
-    mExtensionString += "GL_ANGLE_pack_reverse_row_order ";
-
-    if (supportsDXT3Textures())
-    {
-        mExtensionString += "GL_ANGLE_texture_compression_dxt3 ";
-    }
-    if (supportsDXT5Textures())
-    {
-        mExtensionString += "GL_ANGLE_texture_compression_dxt5 ";
-    }
-
-    mExtensionString += "GL_ANGLE_texture_usage ";
-    mExtensionString += "GL_ANGLE_translated_shader_source ";
-
-    // Other vendor-specific extensions
-    if (supportsEventQueries())
-    {
-        mExtensionString += "GL_NV_fence ";
-    }
-
-    std::string::size_type end = mExtensionString.find_last_not_of(' ');
-    if (end != std::string::npos)
-    {
-        mExtensionString.resize(end+1);
-    }
-}
-
-const char *Context::getExtensionString() const
-{
-    return mExtensionString.c_str();
-}
-
-void Context::initRendererString()
-{
-    D3DADAPTER_IDENTIFIER9 *identifier = mDisplay->getAdapterIdentifier();
-
-    mRendererString = "ANGLE (";
-    mRendererString += identifier->Description;
-    mRendererString += ")";
-}
-
-const char *Context::getRendererString() const
-{
-    return mRendererString.c_str();
-}
-
-void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, 
-                              GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
-                              GLbitfield mask)
-{
-    Framebuffer *readFramebuffer = getReadFramebuffer();
-    Framebuffer *drawFramebuffer = getDrawFramebuffer();
-
-    if (!readFramebuffer || readFramebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE ||
-        !drawFramebuffer || drawFramebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
-    {
-        return error(GL_INVALID_FRAMEBUFFER_OPERATION);
-    }
-
-    if (drawFramebuffer->getSamples() != 0)
-    {
-        return error(GL_INVALID_OPERATION);
-    }
-
-    int readBufferWidth = readFramebuffer->getColorbuffer()->getWidth();
-    int readBufferHeight = readFramebuffer->getColorbuffer()->getHeight();
-    int drawBufferWidth = drawFramebuffer->getColorbuffer()->getWidth();
-    int drawBufferHeight = drawFramebuffer->getColorbuffer()->getHeight();
-
-    RECT sourceRect;
-    RECT destRect;
-
-    if (srcX0 < srcX1)
-    {
-        sourceRect.left = srcX0;
-        sourceRect.right = srcX1;
-        destRect.left = dstX0;
-        destRect.right = dstX1;
-    }
-    else
-    {
-        sourceRect.left = srcX1;
-        destRect.left = dstX1;
-        sourceRect.right = srcX0;
-        destRect.right = dstX0;
-    }
-
-    if (srcY0 < srcY1)
-    {
-        sourceRect.bottom = srcY1;
-        destRect.bottom = dstY1;
-        sourceRect.top = srcY0;
-        destRect.top = dstY0;
-    }
-    else
-    {
-        sourceRect.bottom = srcY0;
-        destRect.bottom = dstY0;
-        sourceRect.top = srcY1;
-        destRect.top = dstY1;
-    }
-
-    RECT sourceScissoredRect = sourceRect;
-    RECT destScissoredRect = destRect;
-
-    if (mState.scissorTest)
-    {
-        // Only write to parts of the destination framebuffer which pass the scissor test
-        // Please note: the destRect is now in D3D-style coordinates, so the *top* of the
-        // rect will be checked against scissorY, rather than the bottom.
-        if (destRect.left < mState.scissorX)
-        {
-            int xDiff = mState.scissorX - destRect.left;
-            destScissoredRect.left = mState.scissorX;
-            sourceScissoredRect.left += xDiff;
-        }
-
-        if (destRect.right > mState.scissorX + mState.scissorWidth)
-        {
-            int xDiff = destRect.right - (mState.scissorX + mState.scissorWidth);
-            destScissoredRect.right = mState.scissorX + mState.scissorWidth;
-            sourceScissoredRect.right -= xDiff;
-        }
-
-        if (destRect.top < mState.scissorY)
-        {
-            int yDiff = mState.scissorY - destRect.top;
-            destScissoredRect.top = mState.scissorY;
-            sourceScissoredRect.top += yDiff;
-        }
-
-        if (destRect.bottom > mState.scissorY + mState.scissorHeight)
-        {
-            int yDiff = destRect.bottom - (mState.scissorY + mState.scissorHeight);
-            destScissoredRect.bottom = mState.scissorY + mState.scissorHeight;
-            sourceScissoredRect.bottom -= yDiff;
-        }
-    }
-
-    bool blitRenderTarget = false;
-    bool blitDepthStencil = false;
-
-    RECT sourceTrimmedRect = sourceScissoredRect;
-    RECT destTrimmedRect = destScissoredRect;
-
-    // The source & destination rectangles also may need to be trimmed if they fall out of the bounds of 
-    // the actual draw and read surfaces.
-    if (sourceTrimmedRect.left < 0)
-    {
-        int xDiff = 0 - sourceTrimmedRect.left;
-        sourceTrimmedRect.left = 0;
-        destTrimmedRect.left += xDiff;
-    }
-
-    if (sourceTrimmedRect.right > readBufferWidth)
-    {
-        int xDiff = sourceTrimmedRect.right - readBufferWidth;
-        sourceTrimmedRect.right = readBufferWidth;
-        destTrimmedRect.right -= xDiff;
-    }
-
-    if (sourceTrimmedRect.top < 0)
-    {
-        int yDiff = 0 - sourceTrimmedRect.top;
-        sourceTrimmedRect.top = 0;
-        destTrimmedRect.top += yDiff;
-    }
-
-    if (sourceTrimmedRect.bottom > readBufferHeight)
-    {
-        int yDiff = sourceTrimmedRect.bottom - readBufferHeight;
-        sourceTrimmedRect.bottom = readBufferHeight;
-        destTrimmedRect.bottom -= yDiff;
-    }
-
-    if (destTrimmedRect.left < 0)
-    {
-        int xDiff = 0 - destTrimmedRect.left;
-        destTrimmedRect.left = 0;
-        sourceTrimmedRect.left += xDiff;
-    }
-
-    if (destTrimmedRect.right > drawBufferWidth)
-    {
-        int xDiff = destTrimmedRect.right - drawBufferWidth;
-        destTrimmedRect.right = drawBufferWidth;
-        sourceTrimmedRect.right -= xDiff;
-    }
-
-    if (destTrimmedRect.top < 0)
-    {
-        int yDiff = 0 - destTrimmedRect.top;
-        destTrimmedRect.top = 0;
-        sourceTrimmedRect.top += yDiff;
-    }
-
-    if (destTrimmedRect.bottom > drawBufferHeight)
-    {
-        int yDiff = destTrimmedRect.bottom - drawBufferHeight;
-        destTrimmedRect.bottom = drawBufferHeight;
-        sourceTrimmedRect.bottom -= yDiff;
-    }
-
-    bool partialBufferCopy = false;
-    if (sourceTrimmedRect.bottom - sourceTrimmedRect.top < readBufferHeight ||
-        sourceTrimmedRect.right - sourceTrimmedRect.left < readBufferWidth || 
-        destTrimmedRect.bottom - destTrimmedRect.top < drawBufferHeight ||
-        destTrimmedRect.right - destTrimmedRect.left < drawBufferWidth ||
-        sourceTrimmedRect.top != 0 || destTrimmedRect.top != 0 || sourceTrimmedRect.left != 0 || destTrimmedRect.left != 0)
-    {
-        partialBufferCopy = true;
-    }
-
-    if (mask & GL_COLOR_BUFFER_BIT)
-    {
-        const bool validReadType = readFramebuffer->getColorbufferType() == GL_TEXTURE_2D ||
-            readFramebuffer->getColorbufferType() == GL_RENDERBUFFER;
-        const bool validDrawType = drawFramebuffer->getColorbufferType() == GL_TEXTURE_2D ||
-            drawFramebuffer->getColorbufferType() == GL_RENDERBUFFER;
-        if (!validReadType || !validDrawType ||
-            readFramebuffer->getColorbuffer()->getD3DFormat() != drawFramebuffer->getColorbuffer()->getD3DFormat())
-        {
-            ERR("Color buffer format conversion in BlitFramebufferANGLE not supported by this implementation");
-            return error(GL_INVALID_OPERATION);
-        }
-        
-        if (partialBufferCopy && readFramebuffer->getSamples() != 0)
-        {
-            return error(GL_INVALID_OPERATION);
-        }
-
-        blitRenderTarget = true;
-
-    }
-
-    if (mask & (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT))
-    {
-        Renderbuffer *readDSBuffer = NULL;
-        Renderbuffer *drawDSBuffer = NULL;
-
-        // We support OES_packed_depth_stencil, and do not support a separately attached depth and stencil buffer, so if we have
-        // both a depth and stencil buffer, it will be the same buffer.
-
-        if (mask & GL_DEPTH_BUFFER_BIT)
-        {
-            if (readFramebuffer->getDepthbuffer() && drawFramebuffer->getDepthbuffer())
-            {
-                if (readFramebuffer->getDepthbufferType() != drawFramebuffer->getDepthbufferType() ||
-                    readFramebuffer->getDepthbuffer()->getD3DFormat() != drawFramebuffer->getDepthbuffer()->getD3DFormat())
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                blitDepthStencil = true;
-                readDSBuffer = readFramebuffer->getDepthbuffer();
-                drawDSBuffer = drawFramebuffer->getDepthbuffer();
-            }
-        }
-
-        if (mask & GL_STENCIL_BUFFER_BIT)
-        {
-            if (readFramebuffer->getStencilbuffer() && drawFramebuffer->getStencilbuffer())
-            {
-                if (readFramebuffer->getStencilbufferType() != drawFramebuffer->getStencilbufferType() ||
-                    readFramebuffer->getStencilbuffer()->getD3DFormat() != drawFramebuffer->getStencilbuffer()->getD3DFormat())
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                blitDepthStencil = true;
-                readDSBuffer = readFramebuffer->getStencilbuffer();
-                drawDSBuffer = drawFramebuffer->getStencilbuffer();
-            }
-        }
-
-        if (partialBufferCopy)
-        {
-            ERR("Only whole-buffer depth and stencil blits are supported by this implementation.");
-            return error(GL_INVALID_OPERATION); // only whole-buffer copies are permitted
-        }
-
-        if ((drawDSBuffer && drawDSBuffer->getSamples() != 0) || 
-            (readDSBuffer && readDSBuffer->getSamples() != 0))
-        {
-            return error(GL_INVALID_OPERATION);
-        }
-    }
-
-    if (blitRenderTarget || blitDepthStencil)
-    {
-        mDisplay->endScene();
-
-        if (blitRenderTarget)
-        {
-            IDirect3DSurface9* readRenderTarget = readFramebuffer->getRenderTarget();
-            IDirect3DSurface9* drawRenderTarget = drawFramebuffer->getRenderTarget();
-
-            HRESULT result = mDevice->StretchRect(readRenderTarget, &sourceTrimmedRect, 
-                                                  drawRenderTarget, &destTrimmedRect, D3DTEXF_NONE);
-
-            readRenderTarget->Release();
-            drawRenderTarget->Release();
-
-            if (FAILED(result))
-            {
-                ERR("BlitFramebufferANGLE failed: StretchRect returned %x.", result);
-                return;
-            }
-        }
-
-        if (blitDepthStencil)
-        {
-            IDirect3DSurface9* readDepthStencil = readFramebuffer->getDepthStencil();
-            IDirect3DSurface9* drawDepthStencil = drawFramebuffer->getDepthStencil();
-
-            HRESULT result = mDevice->StretchRect(readDepthStencil, NULL, drawDepthStencil, NULL, D3DTEXF_NONE);
-
-            readDepthStencil->Release();
-            drawDepthStencil->Release();
-
-            if (FAILED(result))
-            {
-                ERR("BlitFramebufferANGLE failed: StretchRect returned %x.", result);
-                return;
-            }
-        }
-    }
-}
-
-VertexDeclarationCache::VertexDeclarationCache() : mMaxLru(0)
-{
-    for (int i = 0; i < NUM_VERTEX_DECL_CACHE_ENTRIES; i++)
-    {
-        mVertexDeclCache[i].vertexDeclaration = NULL;
-        mVertexDeclCache[i].lruCount = 0;
-    }
-}
-
-VertexDeclarationCache::~VertexDeclarationCache()
-{
-    for (int i = 0; i < NUM_VERTEX_DECL_CACHE_ENTRIES; i++)
-    {
-        if (mVertexDeclCache[i].vertexDeclaration)
-        {
-            mVertexDeclCache[i].vertexDeclaration->Release();
-        }
-    }
-}
-
-GLenum VertexDeclarationCache::applyDeclaration(IDirect3DDevice9 *device, TranslatedAttribute attributes[], Program *program, GLsizei instances, GLsizei *repeatDraw)
-{
-    *repeatDraw = 1;
-
-    int indexedAttribute = MAX_VERTEX_ATTRIBS;
-    int instancedAttribute = MAX_VERTEX_ATTRIBS;
-
-    if (instances > 0)
-    {
-        // Find an indexed attribute to be mapped to D3D stream 0
-        for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
-        {
-            if (attributes[i].active)
-            {
-                if (indexedAttribute == MAX_VERTEX_ATTRIBS)
-                {
-                    if (attributes[i].divisor == 0)
-                    {
-                        indexedAttribute = i;
-                    }
-                }
-                else if (instancedAttribute == MAX_VERTEX_ATTRIBS)
-                {
-                    if (attributes[i].divisor != 0)
-                    {
-                        instancedAttribute = i;
-                    }
-                }
-                else break;   // Found both an indexed and instanced attribute
-            }
-        }
-
-        if (indexedAttribute == MAX_VERTEX_ATTRIBS)
-        {
-            return GL_INVALID_OPERATION;
-        }
-    }
-
-    D3DVERTEXELEMENT9 elements[MAX_VERTEX_ATTRIBS + 1];
-    D3DVERTEXELEMENT9 *element = &elements[0];
-
-    ProgramBinary *programBinary = program->getProgramBinary();
-
-    for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
-    {
-        if (attributes[i].active)
-        {
-            int stream = i;
-
-            if (instances > 0)
-            {
-                // Due to a bug on ATI cards we can't enable instancing when none of the attributes are instanced.
-                if (instancedAttribute == MAX_VERTEX_ATTRIBS)
-                {
-                    *repeatDraw = instances;
-                }
-                else
-                {
-                    if (i == indexedAttribute)
-                    {
-                        stream = 0;
-                    }
-                    else if (i == 0)
-                    {
-                        stream = indexedAttribute;
-                    }
-
-                    UINT frequency = 1;
-                    
-                    if (attributes[i].divisor == 0)
-                    {
-                        frequency = D3DSTREAMSOURCE_INDEXEDDATA | instances;
-                    }
-                    else
-                    {
-                        frequency = D3DSTREAMSOURCE_INSTANCEDATA | attributes[i].divisor;
-                    }
-                    
-                    device->SetStreamSourceFreq(stream, frequency);
-                    mInstancingEnabled = true;
-                }
-            }
-
-            if (mAppliedVBs[stream].serial != attributes[i].serial ||
-                mAppliedVBs[stream].stride != attributes[i].stride ||
-                mAppliedVBs[stream].offset != attributes[i].offset)
-            {
-                device->SetStreamSource(stream, attributes[i].vertexBuffer, attributes[i].offset, attributes[i].stride);
-                mAppliedVBs[stream].serial = attributes[i].serial;
-                mAppliedVBs[stream].stride = attributes[i].stride;
-                mAppliedVBs[stream].offset = attributes[i].offset;
-            }
-
-            element->Stream = stream;
-            element->Offset = 0;
-            element->Type = attributes[i].type;
-            element->Method = D3DDECLMETHOD_DEFAULT;
-            element->Usage = D3DDECLUSAGE_TEXCOORD;
-            element->UsageIndex = programBinary->getSemanticIndex(i);
-            element++;
-        }
-    }
-
-    if (instances == 0 || instancedAttribute == MAX_VERTEX_ATTRIBS)
-    {
-        if (mInstancingEnabled)
-        {
-            for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
-            {
-                device->SetStreamSourceFreq(i, 1);
-            }
-
-            mInstancingEnabled = false;
-        }
-    }
-
-    static const D3DVERTEXELEMENT9 end = D3DDECL_END();
-    *(element++) = end;
-
-    for (int i = 0; i < NUM_VERTEX_DECL_CACHE_ENTRIES; i++)
-    {
-        VertexDeclCacheEntry *entry = &mVertexDeclCache[i];
-        if (memcmp(entry->cachedElements, elements, (element - elements) * sizeof(D3DVERTEXELEMENT9)) == 0 && entry->vertexDeclaration)
-        {
-            entry->lruCount = ++mMaxLru;
-            if(entry->vertexDeclaration != mLastSetVDecl)
-            {
-                device->SetVertexDeclaration(entry->vertexDeclaration);
-                mLastSetVDecl = entry->vertexDeclaration;
-            }
-
-            return GL_NO_ERROR;
-        }
-    }
-
-    VertexDeclCacheEntry *lastCache = mVertexDeclCache;
-
-    for (int i = 0; i < NUM_VERTEX_DECL_CACHE_ENTRIES; i++)
-    {
-        if (mVertexDeclCache[i].lruCount < lastCache->lruCount)
-        {
-            lastCache = &mVertexDeclCache[i];
-        }
-    }
-
-    if (lastCache->vertexDeclaration != NULL)
-    {
-        lastCache->vertexDeclaration->Release();
-        lastCache->vertexDeclaration = NULL;
-        // mLastSetVDecl is set to the replacement, so we don't have to worry
-        // about it.
-    }
-
-    memcpy(lastCache->cachedElements, elements, (element - elements) * sizeof(D3DVERTEXELEMENT9));
-    device->CreateVertexDeclaration(elements, &lastCache->vertexDeclaration);
-    device->SetVertexDeclaration(lastCache->vertexDeclaration);
-    mLastSetVDecl = lastCache->vertexDeclaration;
-    lastCache->lruCount = ++mMaxLru;
-
-    return GL_NO_ERROR;
-}
-
-void VertexDeclarationCache::markStateDirty()
-{
-    for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
-    {
-        mAppliedVBs[i].serial = 0;
-    }
-
-    mLastSetVDecl = NULL;
-    mInstancingEnabled = true;   // Forces it to be disabled when not used
-}
-
-}
-
-extern "C"
-{
-gl::Context *glCreateContext(const egl::Config *config, const gl::Context *shareContext, bool notifyResets, bool robustAccess)
-{
-    return new gl::Context(config, shareContext, notifyResets, robustAccess);
-}
-
-void glDestroyContext(gl::Context *context)
-{
-    delete context;
-
-    if (context == gl::getContext())
-    {
-        gl::makeCurrent(NULL, NULL, NULL);
-    }
-}
-
-void glMakeCurrent(gl::Context *context, egl::Display *display, egl::Surface *surface)
-{
-    gl::makeCurrent(context, display, surface);
-}
-
-gl::Context *glGetCurrentContext()
-{
-    return gl::getContext();
-}
-}
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Context.h b/Source/ThirdParty/ANGLE/src/libGLESv2/Context.h
deleted file mode 100644
index 4d47ce7..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Context.h
+++ /dev/null
@@ -1,661 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Context.h: Defines the gl::Context class, managing all GL state and performing
-// rendering operations. It is the GLES2 specific implementation of EGLContext.
-
-#ifndef LIBGLESV2_CONTEXT_H_
-#define LIBGLESV2_CONTEXT_H_
-
-#define GL_APICALL
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#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"
-
-namespace egl
-{
-class Display;
-class Surface;
-class Config;
-}
-
-namespace gl
-{
-struct TranslatedAttribute;
-struct TranslatedIndexData;
-
-class Buffer;
-class Shader;
-class Program;
-class Texture;
-class Texture2D;
-class TextureCubeMap;
-class Framebuffer;
-class Renderbuffer;
-class RenderbufferStorage;
-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 = 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
-{
-    float red;
-    float green;
-    float blue;
-    float alpha;
-};
-
-// Helper structure describing a single vertex attribute
-class VertexAttribute
-{
-  public:
-    VertexAttribute() : mType(GL_FLOAT), mSize(0), mNormalized(false), mStride(0), mPointer(NULL), mArrayEnabled(false), mDivisor(0)
-    {
-        mCurrentValue[0] = 0.0f;
-        mCurrentValue[1] = 0.0f;
-        mCurrentValue[2] = 0.0f;
-        mCurrentValue[3] = 1.0f;
-    }
-
-    int typeSize() const
-    {
-        switch (mType)
-        {
-          case GL_BYTE:           return mSize * sizeof(GLbyte);
-          case GL_UNSIGNED_BYTE:  return mSize * sizeof(GLubyte);
-          case GL_SHORT:          return mSize * sizeof(GLshort);
-          case GL_UNSIGNED_SHORT: return mSize * sizeof(GLushort);
-          case GL_FIXED:          return mSize * sizeof(GLfixed);
-          case GL_FLOAT:          return mSize * sizeof(GLfloat);
-          default: UNREACHABLE(); return mSize * sizeof(GLfloat);
-        }
-    }
-
-    GLsizei stride() const
-    {
-        return mStride ? mStride : typeSize();
-    }
-
-    // From glVertexAttribPointer
-    GLenum mType;
-    GLint mSize;
-    bool mNormalized;
-    GLsizei mStride;   // 0 means natural stride
-
-    union
-    {
-        const void *mPointer;
-        intptr_t mOffset;
-    };
-
-    BindingPointer<Buffer> mBoundBuffer;   // Captured when glVertexAttribPointer is called.
-
-    bool mArrayEnabled;   // From glEnable/DisableVertexAttribArray
-    float mCurrentValue[4];   // From glVertexAttrib
-    unsigned int mDivisor;
-};
-
-typedef VertexAttribute VertexAttributeArray[MAX_VERTEX_ATTRIBS];
-
-// Helper structure to store all raw state
-struct State
-{
-    Color colorClearValue;
-    GLclampf depthClearValue;
-    int stencilClearValue;
-
-    bool cullFace;
-    GLenum cullMode;
-    GLenum frontFace;
-    bool depthTest;
-    GLenum depthFunc;
-    bool blend;
-    GLenum sourceBlendRGB;
-    GLenum destBlendRGB;
-    GLenum sourceBlendAlpha;
-    GLenum destBlendAlpha;
-    GLenum blendEquationRGB;
-    GLenum blendEquationAlpha;
-    Color blendColor;
-    bool stencilTest;
-    GLenum stencilFunc;
-    GLint stencilRef;
-    GLuint stencilMask;
-    GLenum stencilFail;
-    GLenum stencilPassDepthFail;
-    GLenum stencilPassDepthPass;
-    GLuint stencilWritemask;
-    GLenum stencilBackFunc;
-    GLint stencilBackRef;
-    GLuint stencilBackMask;
-    GLenum stencilBackFail;
-    GLenum stencilBackPassDepthFail;
-    GLenum stencilBackPassDepthPass;
-    GLuint stencilBackWritemask;
-    bool polygonOffsetFill;
-    GLfloat polygonOffsetFactor;
-    GLfloat polygonOffsetUnits;
-    bool sampleAlphaToCoverage;
-    bool sampleCoverage;
-    GLclampf sampleCoverageValue;
-    bool sampleCoverageInvert;
-    bool scissorTest;
-    bool dither;
-
-    GLfloat lineWidth;
-
-    GLenum generateMipmapHint;
-    GLenum fragmentShaderDerivativeHint;
-
-    GLint viewportX;
-    GLint viewportY;
-    GLsizei viewportWidth;
-    GLsizei viewportHeight;
-    float zNear;
-    float zFar;
-
-    GLint scissorX;
-    GLint scissorY;
-    GLsizei scissorWidth;
-    GLsizei scissorHeight;
-
-    bool colorMaskRed;
-    bool colorMaskGreen;
-    bool colorMaskBlue;
-    bool colorMaskAlpha;
-    bool depthMask;
-
-    unsigned int activeSampler;   // Active texture unit selector - GL_TEXTURE0
-    BindingPointer<Buffer> arrayBuffer;
-    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
-{
-  public:
-    VertexDeclarationCache();
-    ~VertexDeclarationCache();
-
-    GLenum applyDeclaration(IDirect3DDevice9 *device, TranslatedAttribute attributes[], Program *program, GLsizei instances, GLsizei *repeatDraw);
-
-    void markStateDirty();
-
-  private:
-    UINT mMaxLru;
-
-    enum { NUM_VERTEX_DECL_CACHE_ENTRIES = 32 };
-
-    struct VBData
-    {
-        unsigned int serial;
-        unsigned int stride;
-        unsigned int offset;
-    };
-
-    VBData mAppliedVBs[MAX_VERTEX_ATTRIBS];
-    IDirect3DVertexDeclaration9 *mLastSetVDecl;
-    bool mInstancingEnabled;
-
-    struct VertexDeclCacheEntry
-    {
-        D3DVERTEXELEMENT9 cachedElements[MAX_VERTEX_ATTRIBS + 1];
-        UINT lruCount;
-        IDirect3DVertexDeclaration9 *vertexDeclaration;
-    } mVertexDeclCache[NUM_VERTEX_DECL_CACHE_ENTRIES];
-};
-
-class Context
-{
-  public:
-    Context(const egl::Config *config, const gl::Context *shareContext, bool notifyResets, bool robustAccess);
-
-    ~Context();
-
-    void makeCurrent(egl::Display *display, egl::Surface *surface);
-
-    virtual void markAllStateDirty();
-    void markDxUniformsDirty();
-
-    virtual void markContextLost();
-    bool isContextLost();
-
-    // State manipulation
-    void setClearColor(float red, float green, float blue, float alpha);
-
-    void setClearDepth(float depth);
-
-    void setClearStencil(int stencil);
-
-    void setCullFace(bool enabled);
-    bool isCullFaceEnabled() const;
-
-    void setCullMode(GLenum mode);
-
-    void setFrontFace(GLenum front);
-
-    void setDepthTest(bool enabled);
-    bool isDepthTestEnabled() const;
-
-    void setDepthFunc(GLenum depthFunc);
-
-    void setDepthRange(float zNear, float zFar);
-    
-    void setBlend(bool enabled);
-    bool isBlendEnabled() const;
-
-    void setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha);
-    void setBlendColor(float red, float green, float blue, float alpha);
-    void setBlendEquation(GLenum rgbEquation, GLenum alphaEquation);
-
-    void setStencilTest(bool enabled);
-    bool isStencilTestEnabled() const;
-
-    void setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask);
-    void setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask);
-    void setStencilWritemask(GLuint stencilWritemask);
-    void setStencilBackWritemask(GLuint stencilBackWritemask);
-    void setStencilOperations(GLenum stencilFail, GLenum stencilPassDepthFail, GLenum stencilPassDepthPass);
-    void setStencilBackOperations(GLenum stencilBackFail, GLenum stencilBackPassDepthFail, GLenum stencilBackPassDepthPass);
-
-    void setPolygonOffsetFill(bool enabled);
-    bool isPolygonOffsetFillEnabled() const;
-
-    void setPolygonOffsetParams(GLfloat factor, GLfloat units);
-
-    void setSampleAlphaToCoverage(bool enabled);
-    bool isSampleAlphaToCoverageEnabled() const;
-
-    void setSampleCoverage(bool enabled);
-    bool isSampleCoverageEnabled() const;
-
-    void setSampleCoverageParams(GLclampf value, bool invert);
-
-    void setScissorTest(bool enabled);
-    bool isScissorTestEnabled() const;
-
-    void setDither(bool enabled);
-    bool isDitherEnabled() const;
-
-    void setLineWidth(GLfloat width);
-
-    void setGenerateMipmapHint(GLenum hint);
-    void setFragmentShaderDerivativeHint(GLenum hint);
-
-    void setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height);
-
-    void setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height);
-
-    void setColorMask(bool red, bool green, bool blue, bool alpha);
-    void setDepthMask(bool mask);
-
-    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();
-
-    void setUnpackAlignment(GLint alignment);
-    GLint getUnpackAlignment() const;
-
-    void setPackAlignment(GLint alignment);
-    GLint getPackAlignment() const;
-
-    void setPackReverseRowOrder(bool reverseRowOrder);
-    bool getPackReverseRowOrder() const;
-
-    // These create  and destroy methods are merely pass-throughs to 
-    // ResourceManager, which owns these object types
-    GLuint createBuffer();
-    GLuint createShader(GLenum type);
-    GLuint createProgram();
-    GLuint createTexture();
-    GLuint createRenderbuffer();
-
-    void deleteBuffer(GLuint buffer);
-    void deleteShader(GLuint shader);
-    void deleteProgram(GLuint program);
-    void deleteTexture(GLuint texture);
-    void deleteRenderbuffer(GLuint renderbuffer);
-
-    // 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);
-    void setVertexAttribDivisor(GLuint index, GLuint divisor);
-
-    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();
-    Framebuffer *getDrawFramebuffer();
-
-    bool getFloatv(GLenum pname, GLfloat *params);
-    bool getIntegerv(GLenum pname, GLint *params);
-    bool getBooleanv(GLenum pname, GLboolean *params);
-
-    bool getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams);
-
-    void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei *bufSize, void* pixels);
-    void clear(GLbitfield mask);
-    void drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances);
-    void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instances);
-    void sync(bool block);   // flush/finish
-
-    void drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex);
-
-    void recordInvalidEnum();
-    void recordInvalidValue();
-    void recordInvalidOperation();
-    void recordOutOfMemory();
-    void recordInvalidFramebufferOperation();
-
-    GLenum getError();
-    GLenum getResetStatus();
-    virtual bool isResetNotificationEnabled();
-
-    bool supportsShaderModel3() const;
-    int getMaximumVaryingVectors() const;
-    unsigned int getMaximumVertexTextureImageUnits() const;
-    unsigned int getMaximumCombinedTextureImageUnits() const;
-    int getMaximumFragmentUniformVectors() const;
-    int getMaximumRenderbufferDimension() const;
-    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;
-    bool supportsFloat16RenderableTextures() const;
-    bool supportsLuminanceTextures() const;
-    bool supportsLuminanceAlphaTextures() const;
-    bool supportsDepthTextures() const;
-    bool supports32bitIndices() const;
-    bool supportsNonPower2Texture() const;
-    bool supportsInstancing() const;
-
-    void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, 
-                         GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
-                         GLbitfield mask);
-
-    Blit *getBlitter() { return mBlit; }
-
-    const D3DCAPS9 &getDeviceCaps() { return mDeviceCaps; }
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Context);
-
-    bool applyRenderTarget(bool ignoreViewport);
-    void applyState(GLenum drawMode);
-    GLenum applyVertexBuffer(GLint first, GLsizei count, GLsizei instances, GLsizei *repeatDraw);
-    GLenum applyIndexBuffer(const GLvoid *indices, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
-    void applyShaders();
-    void applyTextures();
-    void applyTextures(SamplerType type);
-
-    void detachBuffer(GLuint buffer);
-    void detachTexture(GLuint texture);
-    void detachFramebuffer(GLuint framebuffer);
-    void detachRenderbuffer(GLuint renderbuffer);
-
-    Texture *getIncompleteTexture(TextureType type);
-
-    bool cullSkipsDraw(GLenum drawMode);
-    bool isTriangleMode(GLenum drawMode);
-
-    void initExtensionString();
-    void initRendererString();
-
-    const egl::Config *const mConfig;
-    egl::Display *mDisplay;
-    IDirect3DDevice9 *mDevice;
-
-    State mState;
-
-    BindingPointer<Texture2D> mTexture2DZero;
-    BindingPointer<TextureCubeMap> mTextureCubeMapZero;
-
-    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;
-
-    StreamingIndexBuffer *mLineLoopIB;
-    
-    BindingPointer<Texture> mIncompleteTextures[TEXTURE_TYPE_COUNT];
-
-    // Recorded errors
-    bool mInvalidEnum;
-    bool mInvalidValue;
-    bool mInvalidOperation;
-    bool mOutOfMemory;
-    bool mInvalidFramebufferOperation;
-
-    // Current/lost context flags
-    bool mHasBeenCurrent;
-    bool mContextLost;
-    GLenum mResetStatus;
-    GLenum mResetStrategy;
-    bool mRobustAccess;
-
-    unsigned int mAppliedTextureSerialPS[MAX_TEXTURE_IMAGE_UNITS];
-    unsigned int mAppliedTextureSerialVS[MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF];
-    unsigned int mAppliedProgramSerial;
-    unsigned int mAppliedRenderTargetSerial;
-    unsigned int mAppliedDepthbufferSerial;
-    unsigned int mAppliedStencilbufferSerial;
-    unsigned int mAppliedIBSerial;
-    bool mDepthStencilInitialized;
-    bool mViewportInitialized;
-    D3DVIEWPORT9 mSetViewport;
-    bool mRenderTargetDescInitialized;
-    D3DSURFACE_DESC mRenderTargetDesc;
-    bool mDxUniformsDirty;
-    Program *mCachedCurrentProgram;
-    Framebuffer *mBoundDrawFramebuffer;
-
-    bool mSupportsShaderModel3;
-    bool mSupportsVertexTexture;
-    bool mSupportsNonPower2Texture;
-    bool mSupportsInstancing;
-    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;
-    bool mSupportsFloat16RenderableTextures;
-    bool mSupportsLuminanceTextures;
-    bool mSupportsLuminanceAlphaTextures;
-    bool mSupportsDepthTextures;
-    bool mSupports32bitIndices;
-    int mNumCompressedTextureFormats;
-
-    // state caching flags
-    bool mClearStateDirty;
-    bool mCullStateDirty;
-    bool mDepthStateDirty;
-    bool mMaskStateDirty;
-    bool mPixelPackingStateDirty;
-    bool mBlendStateDirty;
-    bool mStencilStateDirty;
-    bool mPolygonOffsetStateDirty;
-    bool mScissorStateDirty;
-    bool mSampleStateDirty;
-    bool mFrontFaceDirty;
-    bool mDitherStateDirty;
-
-    IDirect3DStateBlock9 *mMaskedClearSavedState;
-
-    D3DCAPS9 mDeviceCaps;
-
-    ResourceManager *mResourceManager;
-
-    VertexDeclarationCache mVertexDeclarationCache;
-};
-}
-
-extern "C"
-{
-// Exported functions for use by EGL
-gl::Context *glCreateContext(const egl::Config *config, const gl::Context *shareContext, bool notifyResets, bool robustAccess);
-void glDestroyContext(gl::Context *context);
-void glMakeCurrent(gl::Context *context, egl::Display *display, egl::Surface *surface);
-gl::Context *glGetCurrentContext();
-__eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char *procname);
-bool __stdcall glBindTexImage(egl::Surface *surface);
-}
-
-#endif   // INCLUDE_CONTEXT_H_
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.cpp b/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.cpp
deleted file mode 100644
index 14d1239..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.cpp
+++ /dev/null
@@ -1,132 +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.
-//
-
-// Fence.cpp: Implements the gl::Fence class, which supports the GL_NV_fence extension.
-
-#include "libGLESv2/Fence.h"
-
-#include "libGLESv2/main.h"
-
-namespace gl
-{
-
-Fence::Fence(egl::Display* display)
-{
-    mDisplay = display;
-    mQuery = NULL;
-    mCondition = GL_NONE;
-    mStatus = GL_FALSE;
-}
-
-Fence::~Fence()
-{
-    if (mQuery != NULL)
-    {
-        mDisplay->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)
-    {
-        mQuery = mDisplay->allocateEventQuery();
-        if (!mQuery)
-        {
-            return error(GL_OUT_OF_MEMORY);
-        }
-    }
-
-    HRESULT result = mQuery->Issue(D3DISSUE_END);
-    ASSERT(SUCCEEDED(result));
-
-    mCondition = condition;
-    mStatus = GL_FALSE;
-}
-
-GLboolean Fence::testFence()
-{
-    if (mQuery == NULL)
-    {
-        return error(GL_INVALID_OPERATION, GL_TRUE);
-    }
-
-    HRESULT result = mQuery->GetData(NULL, 0, D3DGETDATA_FLUSH);
-
-    if (checkDeviceLost(result))
-    {
-       return error(GL_OUT_OF_MEMORY, GL_TRUE);
-    }
-
-    ASSERT(result == S_OK || result == S_FALSE);
-    mStatus = result == S_OK;
-    return mStatus;
-}
-
-void Fence::finishFence()
-{
-    if (mQuery == NULL)
-    {
-        return error(GL_INVALID_OPERATION);
-    }
-
-    while (!testFence())
-    {
-        Sleep(0);
-    }
-}
-
-void Fence::getFenceiv(GLenum pname, GLint *params)
-{
-    if (mQuery == NULL)
-    {
-        return error(GL_INVALID_OPERATION);
-    }
-
-    switch (pname)
-    {
-        case GL_FENCE_STATUS_NV:
-        {
-            // GL_NV_fence spec:
-            // Once the status of a fence has been finished (via FinishFenceNV) or tested and the returned status is TRUE (via either TestFenceNV
-            // or GetFenceivNV querying the FENCE_STATUS_NV), the status remains TRUE until the next SetFenceNV of the fence.
-            if (mStatus)
-            {
-                params[0] = GL_TRUE;
-                return;
-            }
-            
-            HRESULT result = mQuery->GetData(NULL, 0, 0);
-            
-            if (checkDeviceLost(result))
-            {
-                params[0] = GL_TRUE;
-                return error(GL_OUT_OF_MEMORY);
-            }
-
-            ASSERT(result == S_OK || result == S_FALSE);
-            mStatus = result == S_OK;
-            params[0] = mStatus;
-            
-            break;
-        }
-        case GL_FENCE_CONDITION_NV:
-            params[0] = mCondition;
-            break;
-        default:
-            return error(GL_INVALID_ENUM);
-            break;
-    }
-}
-
-}
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.h b/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.h
deleted file mode 100644
index 9626cb0..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.h
+++ /dev/null
@@ -1,49 +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.
-//
-
-// Fence.h: Defines the gl::Fence class, which supports the GL_NV_fence extension.
-
-#ifndef LIBGLESV2_FENCE_H_
-#define LIBGLESV2_FENCE_H_
-
-#define GL_APICALL
-#include <GLES2/gl2.h>
-#include <d3d9.h>
-
-#include "common/angleutils.h"
-
-namespace egl
-{
-class Display;
-}
-
-namespace gl
-{
-
-class Fence
-{
-  public:
-    explicit Fence(egl::Display* display);
-    virtual ~Fence();
-
-    GLboolean isFence();
-    void setFence(GLenum condition);
-    GLboolean testFence();
-    void finishFence();
-    void getFenceiv(GLenum pname, GLint *params);
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Fence);
-
-    egl::Display* mDisplay;
-    IDirect3DQuery9* mQuery;
-    GLenum mCondition;
-    GLboolean mStatus;
-};
-
-}
-
-#endif   // LIBGLESV2_FENCE_H_
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.cpp b/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.cpp
deleted file mode 100644
index 76d4283..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.cpp
+++ /dev/null
@@ -1,509 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Framebuffer.cpp: Implements the gl::Framebuffer class. Implements GL framebuffer
-// objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105.
-
-#include "libGLESv2/Framebuffer.h"
-
-#include "libGLESv2/main.h"
-#include "libGLESv2/Renderbuffer.h"
-#include "libGLESv2/Texture.h"
-#include "libGLESv2/utilities.h"
-
-namespace gl
-{
-
-Framebuffer::Framebuffer()
-{
-    mColorbufferType = GL_NONE;
-    mDepthbufferType = GL_NONE;
-    mStencilbufferType = GL_NONE;
-}
-
-Framebuffer::~Framebuffer()
-{
-    mColorbufferPointer.set(NULL);
-    mDepthbufferPointer.set(NULL);
-    mStencilbufferPointer.set(NULL);
-    mNullColorbufferPointer.set(NULL);
-}
-
-Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle) const
-{
-    gl::Context *context = gl::getContext();
-    Renderbuffer *buffer = NULL;
-
-    if (type == GL_NONE)
-    {
-        buffer = NULL;
-    }
-    else if (type == GL_RENDERBUFFER)
-    {
-        buffer = context->getRenderbuffer(handle);
-    }
-    else if (IsInternalTextureTarget(type))
-    {
-        buffer = context->getTexture(handle)->getRenderbuffer(type);
-    }
-    else
-    {
-        UNREACHABLE();
-    }
-
-    return buffer;
-}
-
-void Framebuffer::setColorbuffer(GLenum type, GLuint colorbuffer)
-{
-    mColorbufferType = (colorbuffer != 0) ? type : GL_NONE;
-    mColorbufferPointer.set(lookupRenderbuffer(type, colorbuffer));
-}
-
-void Framebuffer::setDepthbuffer(GLenum type, GLuint depthbuffer)
-{
-    mDepthbufferType = (depthbuffer != 0) ? type : GL_NONE;
-    mDepthbufferPointer.set(lookupRenderbuffer(type, depthbuffer));
-}
-
-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 && IsInternalTextureTarget(mColorbufferType))
-    {
-        mColorbufferType = GL_NONE;
-        mColorbufferPointer.set(NULL);
-    }
-
-    if (mDepthbufferPointer.id() == texture && IsInternalTextureTarget(mDepthbufferType))
-    {
-        mDepthbufferType = GL_NONE;
-        mDepthbufferPointer.set(NULL);
-    }
-
-    if (mStencilbufferPointer.id() == texture && IsInternalTextureTarget(mStencilbufferType))
-    {
-        mStencilbufferType = GL_NONE;
-        mStencilbufferPointer.set(NULL);
-    }
-}
-
-void Framebuffer::detachRenderbuffer(GLuint renderbuffer)
-{
-    if (mColorbufferPointer.id() == renderbuffer && mColorbufferType == GL_RENDERBUFFER)
-    {
-        mColorbufferType = GL_NONE;
-        mColorbufferPointer.set(NULL);
-    }
-
-    if (mDepthbufferPointer.id() == renderbuffer && mDepthbufferType == GL_RENDERBUFFER)
-    {
-        mDepthbufferType = GL_NONE;
-        mDepthbufferPointer.set(NULL);
-    }
-
-    if (mStencilbufferPointer.id() == renderbuffer && mStencilbufferType == GL_RENDERBUFFER)
-    {
-        mStencilbufferType = GL_NONE;
-        mStencilbufferPointer.set(NULL);
-    }
-}
-
-unsigned int Framebuffer::getRenderTargetSerial()
-{
-    Renderbuffer *colorbuffer = mColorbufferPointer.get();
-
-    if (colorbuffer)
-    {
-        return colorbuffer->getSerial();
-    }
-
-    return 0;
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *Framebuffer::getRenderTarget()
-{
-    Renderbuffer *colorbuffer = mColorbufferPointer.get();
-
-    if (colorbuffer)
-    {
-        return colorbuffer->getRenderTarget();
-    }
-
-    return NULL;
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *Framebuffer::getDepthStencil()
-{
-    Renderbuffer *depthstencilbuffer = mDepthbufferPointer.get();
-    
-    if (!depthstencilbuffer)
-    {
-        depthstencilbuffer = mStencilbufferPointer.get();
-    }
-
-    if (depthstencilbuffer)
-    {
-        return depthstencilbuffer->getDepthStencil();
-    }
-
-    return NULL;
-}
-
-unsigned int Framebuffer::getDepthbufferSerial()
-{
-    Renderbuffer *depthbuffer = mDepthbufferPointer.get();
-
-    if (depthbuffer)
-    {
-        return depthbuffer->getSerial();
-    }
-
-    return 0;
-}
-
-unsigned int Framebuffer::getStencilbufferSerial()
-{
-    Renderbuffer *stencilbuffer = mStencilbufferPointer.get();
-
-    if (stencilbuffer)
-    {
-        return stencilbuffer->getSerial();
-    }
-
-    return 0;
-}
-
-Renderbuffer *Framebuffer::getColorbuffer()
-{
-    return mColorbufferPointer.get();
-}
-
-Renderbuffer *Framebuffer::getDepthbuffer()
-{
-    return mDepthbufferPointer.get();
-}
-
-Renderbuffer *Framebuffer::getStencilbuffer()
-{
-    return mStencilbufferPointer.get();
-}
-
-Renderbuffer *Framebuffer::getNullColorbuffer()
-{
-    Renderbuffer *nullbuffer  = mNullColorbufferPointer.get();
-    Renderbuffer *depthbuffer = getDepthbuffer();
-
-    if (!depthbuffer)
-    {
-        ERR("Unexpected null depthbuffer for depth-only FBO.");
-        return NULL;
-    }
-
-    GLsizei width  = depthbuffer->getWidth();
-    GLsizei height = depthbuffer->getHeight();
-
-    if (!nullbuffer ||
-        width != nullbuffer->getWidth() || height != nullbuffer->getHeight())
-    {
-        nullbuffer = new Renderbuffer(0, new Colorbuffer(width, height, GL_NONE, 0));
-        mNullColorbufferPointer.set(nullbuffer);
-    }
-
-    return nullbuffer;
-}
-
-GLenum Framebuffer::getColorbufferType()
-{
-    return mColorbufferType;
-}
-
-GLenum Framebuffer::getDepthbufferType()
-{
-    return mDepthbufferType;
-}
-
-GLenum Framebuffer::getStencilbufferType()
-{
-    return mStencilbufferType;
-}
-
-GLuint Framebuffer::getColorbufferHandle()
-{
-    return mColorbufferPointer.id();
-}
-
-GLuint Framebuffer::getDepthbufferHandle()
-{
-    return mDepthbufferPointer.id();
-}
-
-GLuint Framebuffer::getStencilbufferHandle()
-{
-    return mStencilbufferPointer.id();
-}
-
-bool Framebuffer::hasStencil()
-{
-    if (mStencilbufferType != GL_NONE)
-    {
-        Renderbuffer *stencilbufferObject = getStencilbuffer();
-
-        if (stencilbufferObject)
-        {
-            return stencilbufferObject->getStencilSize() > 0;
-        }
-    }
-
-    return false;
-}
-
-GLenum Framebuffer::completeness()
-{
-    gl::Context *context = gl::getContext();
-    int width = 0;
-    int height = 0;
-    int samples = -1;
-    bool missingAttachment = true;
-
-    if (mColorbufferType != GL_NONE)
-    {
-        Renderbuffer *colorbuffer = getColorbuffer();
-
-        if (!colorbuffer)
-        {
-            return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-        }
-
-        if (colorbuffer->getWidth() == 0 || colorbuffer->getHeight() == 0)
-        {
-            return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-        }
-
-        if (mColorbufferType == GL_RENDERBUFFER)
-        {
-            if (!gl::IsColorRenderable(colorbuffer->getInternalFormat()))
-            {
-                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-            }
-        }
-        else if (IsInternalTextureTarget(mColorbufferType))
-        {
-            GLenum internalformat = colorbuffer->getInternalFormat();
-            D3DFORMAT d3dformat = colorbuffer->getD3DFormat();
-
-            if (IsCompressed(internalformat) ||
-                internalformat == GL_ALPHA ||
-                internalformat == GL_LUMINANCE ||
-                internalformat == GL_LUMINANCE_ALPHA)
-            {
-                return GL_FRAMEBUFFER_UNSUPPORTED;
-            }
-
-            if ((dx2es::IsFloat32Format(d3dformat) && !context->supportsFloat32RenderableTextures()) ||
-                (dx2es::IsFloat16Format(d3dformat) && !context->supportsFloat16RenderableTextures()))
-            {
-                return GL_FRAMEBUFFER_UNSUPPORTED;
-            }
-
-            if (dx2es::IsDepthTextureFormat(d3dformat) || dx2es::IsStencilTextureFormat(d3dformat))
-            {
-                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-            }
-        }
-        else
-        {
-            UNREACHABLE();
-            return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-        }
-
-        width = colorbuffer->getWidth();
-        height = colorbuffer->getHeight();
-        samples = colorbuffer->getSamples();
-        missingAttachment = false;
-    }
-
-    Renderbuffer *depthbuffer = NULL;
-    Renderbuffer *stencilbuffer = NULL;
-
-    if (mDepthbufferType != GL_NONE)
-    {
-        depthbuffer = getDepthbuffer();
-
-        if (!depthbuffer)
-        {
-            return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-        }
-
-        if (depthbuffer->getWidth() == 0 || depthbuffer->getHeight() == 0)
-        {
-            return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-        }
-
-        if (mDepthbufferType == GL_RENDERBUFFER)
-        {
-            if (!gl::IsDepthRenderable(depthbuffer->getInternalFormat()))
-            {
-                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-            }
-        }
-        else if (IsInternalTextureTarget(mDepthbufferType))
-        {
-            D3DFORMAT d3dformat = depthbuffer->getD3DFormat();
-
-            // depth texture attachments require OES/ANGLE_depth_texture
-            if (!context->supportsDepthTextures())
-            {
-                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-            }
-
-            if (!dx2es::IsDepthTextureFormat(d3dformat))
-            {
-                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-            }
-        }
-        else
-        {
-            UNREACHABLE();
-            return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-        }
-
-        if (missingAttachment)
-        {
-            width = depthbuffer->getWidth();
-            height = depthbuffer->getHeight();
-            samples = depthbuffer->getSamples();
-            missingAttachment = false;
-        }
-        else if (width != depthbuffer->getWidth() || height != depthbuffer->getHeight())
-        {
-            return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS;
-        }
-        else if (samples != depthbuffer->getSamples())
-        {
-            return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE;
-        }
-    }
-
-    if (mStencilbufferType != GL_NONE)
-    {
-        stencilbuffer = getStencilbuffer();
-
-        if (!stencilbuffer)
-        {
-            return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-        }
-
-        if (stencilbuffer->getWidth() == 0 || stencilbuffer->getHeight() == 0)
-        {
-            return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-        }
-
-        if (mStencilbufferType == GL_RENDERBUFFER)
-        {
-            if (!gl::IsStencilRenderable(stencilbuffer->getInternalFormat()))
-            {
-                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-            }
-        }
-        else if (IsInternalTextureTarget(mStencilbufferType))
-        {
-            D3DFORMAT d3dformat = stencilbuffer->getD3DFormat();
-
-            // texture stencil attachments come along as part
-            // of OES_packed_depth_stencil + OES/ANGLE_depth_texture
-            if (!context->supportsDepthTextures())
-            {
-                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-            }
-
-            if (!dx2es::IsStencilTextureFormat(d3dformat))
-            {
-                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-            }
-        }
-        else
-        {
-            UNREACHABLE();
-            return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-        }
-
-        if (missingAttachment)
-        {
-            width = stencilbuffer->getWidth();
-            height = stencilbuffer->getHeight();
-            samples = stencilbuffer->getSamples();
-            missingAttachment = false;
-        }
-        else if (width != stencilbuffer->getWidth() || height != stencilbuffer->getHeight())
-        {
-            return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS;
-        }
-        else if (samples != stencilbuffer->getSamples())
-        {
-            return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE;
-        }
-    }
-
-    // if we have both a depth and stencil buffer, they must refer to the same object
-    // since we only support packed_depth_stencil and not separate depth and stencil
-    if (depthbuffer && stencilbuffer && (depthbuffer != stencilbuffer))
-    {
-        return GL_FRAMEBUFFER_UNSUPPORTED;
-    }
-
-    // we need to have at least one attachment to be complete
-    if (missingAttachment)
-    {
-        return GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;
-    }
-
-    return GL_FRAMEBUFFER_COMPLETE;
-}
-
-DefaultFramebuffer::DefaultFramebuffer(Colorbuffer *colorbuffer, DepthStencilbuffer *depthStencil)
-{
-    mColorbufferPointer.set(new Renderbuffer(0, colorbuffer));
-
-    Renderbuffer *depthStencilRenderbuffer = new Renderbuffer(0, depthStencil);
-    mDepthbufferPointer.set(depthStencilRenderbuffer);
-    mStencilbufferPointer.set(depthStencilRenderbuffer);
-
-    mColorbufferType = GL_RENDERBUFFER;
-    mDepthbufferType = (depthStencilRenderbuffer->getDepthSize() != 0) ? GL_RENDERBUFFER : GL_NONE;
-    mStencilbufferType = (depthStencilRenderbuffer->getStencilSize() != 0) ? GL_RENDERBUFFER : GL_NONE;
-}
-
-int Framebuffer::getSamples()
-{
-    if (completeness() == GL_FRAMEBUFFER_COMPLETE)
-    {
-        return getColorbuffer()->getSamples();
-    }
-    else
-    {
-        return 0;
-    }
-}
-
-GLenum DefaultFramebuffer::completeness()
-{
-    // The default framebuffer should always be complete
-    ASSERT(Framebuffer::completeness() == GL_FRAMEBUFFER_COMPLETE);
-
-    return GL_FRAMEBUFFER_COMPLETE;
-}
-
-}
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.h b/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.h
deleted file mode 100644
index 14d9c2a..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.h
+++ /dev/null
@@ -1,98 +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.
-//
-
-// Framebuffer.h: Defines the gl::Framebuffer class. Implements GL framebuffer
-// objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105.
-
-#ifndef LIBGLESV2_FRAMEBUFFER_H_
-#define LIBGLESV2_FRAMEBUFFER_H_
-
-#define GL_APICALL
-#include <GLES2/gl2.h>
-#include <d3d9.h>
-
-#include "common/angleutils.h"
-#include "common/RefCountObject.h"
-
-namespace gl
-{
-class Renderbuffer;
-class Colorbuffer;
-class Depthbuffer;
-class Stencilbuffer;
-class DepthStencilbuffer;
-
-class Framebuffer
-{
-  public:
-    Framebuffer();
-
-    virtual ~Framebuffer();
-
-    void setColorbuffer(GLenum type, GLuint colorbuffer);
-    void setDepthbuffer(GLenum type, GLuint depthbuffer);
-    void setStencilbuffer(GLenum type, GLuint stencilbuffer);
-
-    void detachTexture(GLuint texture);
-    void detachRenderbuffer(GLuint renderbuffer);
-
-    IDirect3DSurface9 *getRenderTarget();
-    IDirect3DSurface9 *getDepthStencil();
-
-    unsigned int getRenderTargetSerial();
-    unsigned int getDepthbufferSerial();
-    unsigned int getStencilbufferSerial();
-
-    Renderbuffer *getColorbuffer();
-    Renderbuffer *getDepthbuffer();
-    Renderbuffer *getStencilbuffer();
-    Renderbuffer *getNullColorbuffer();
-
-    GLenum getColorbufferType();
-    GLenum getDepthbufferType();
-    GLenum getStencilbufferType();
-
-    GLuint getColorbufferHandle();
-    GLuint getDepthbufferHandle();
-    GLuint getStencilbufferHandle();
-
-    bool hasStencil();
-    int getSamples();
-
-    virtual GLenum completeness();
-
-  protected:
-    GLenum mColorbufferType;
-    BindingPointer<Renderbuffer> mColorbufferPointer;
-
-    GLenum mDepthbufferType;
-    BindingPointer<Renderbuffer> mDepthbufferPointer;
-
-    GLenum mStencilbufferType;
-    BindingPointer<Renderbuffer> mStencilbufferPointer;
-
-    BindingPointer<Renderbuffer> mNullColorbufferPointer;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Framebuffer);
-
-    Renderbuffer *lookupRenderbuffer(GLenum type, GLuint handle) const;
-};
-
-class DefaultFramebuffer : public Framebuffer
-{
-  public:
-    DefaultFramebuffer(Colorbuffer *colorbuffer, DepthStencilbuffer *depthStencil);
-
-    virtual GLenum completeness();
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(DefaultFramebuffer);
-};
-
-}
-
-#endif   // LIBGLESV2_FRAMEBUFFER_H_
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/HandleAllocator.cpp b/Source/ThirdParty/ANGLE/src/libGLESv2/HandleAllocator.cpp
deleted file mode 100644
index c498f8a..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/HandleAllocator.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-// 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.
-//
-
-// HandleAllocator.cpp: Implements the gl::HandleAllocator class, which is used
-// to allocate GL handles.
-
-#include "libGLESv2/HandleAllocator.h"
-
-#include "libGLESv2/main.h"
-
-namespace gl
-{
-
-HandleAllocator::HandleAllocator() : mBaseValue(1), mNextValue(1)
-{
-}
-
-HandleAllocator::~HandleAllocator()
-{
-}
-
-void HandleAllocator::setBaseHandle(GLuint value)
-{
-    ASSERT(mBaseValue == mNextValue);
-    mBaseValue = value;
-    mNextValue = value;
-}
-
-GLuint HandleAllocator::allocate()
-{
-    if (mFreeValues.size())
-    {
-        GLuint handle = mFreeValues.back();
-        mFreeValues.pop_back();
-        return handle;
-    }
-    return mNextValue++;
-}
-
-void HandleAllocator::release(GLuint handle)
-{
-    if (handle == mNextValue - 1)
-    {
-        // Don't drop below base value
-        if(mNextValue > mBaseValue)
-        {
-            mNextValue--;
-        }
-    }
-    else
-    {
-        // Only free handles that we own - don't drop below the base value
-        if (handle >= mBaseValue)
-        {
-            mFreeValues.push_back(handle);
-        }
-    }
-}
-
-}
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/HandleAllocator.h b/Source/ThirdParty/ANGLE/src/libGLESv2/HandleAllocator.h
deleted file mode 100644
index a92e168..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/HandleAllocator.h
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// 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.
-//
-
-// HandleAllocator.h: Defines the gl::HandleAllocator class, which is used to
-// allocate GL handles.
-
-#ifndef LIBGLESV2_HANDLEALLOCATOR_H_
-#define LIBGLESV2_HANDLEALLOCATOR_H_
-
-#define GL_APICALL
-#include <GLES2/gl2.h>
-
-#include <vector>
-
-#include "common/angleutils.h"
-
-namespace gl
-{
-
-class HandleAllocator
-{
-  public:
-    HandleAllocator();
-    virtual ~HandleAllocator();
-
-    void setBaseHandle(GLuint value);
-
-    GLuint allocate();
-    void release(GLuint handle);
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(HandleAllocator);
-
-    GLuint mBaseValue;
-    GLuint mNextValue;
-    typedef std::vector<GLuint> HandleList;
-    HandleList mFreeValues;
-};
-
-}
-
-#endif   // LIBGLESV2_HANDLEALLOCATOR_H_
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/IndexDataManager.cpp b/Source/ThirdParty/ANGLE/src/libGLESv2/IndexDataManager.cpp
deleted file mode 100644
index 3dc0aef..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/IndexDataManager.cpp
+++ /dev/null
@@ -1,473 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// IndexDataManager.cpp: Defines the IndexDataManager, a class that
-// runs the Buffer translation process for index buffers.
-
-#include "libGLESv2/IndexDataManager.h"
-
-#include "common/debug.h"
-
-#include "libGLESv2/Buffer.h"
-#include "libGLESv2/mathutil.h"
-#include "libGLESv2/main.h"
-
-namespace gl
-{
-unsigned int IndexBuffer::mCurrentSerial = 1;
-
-IndexDataManager::IndexDataManager(Context *context, IDirect3DDevice9 *device) : mDevice(device)
-{
-    mStreamingBufferShort = new StreamingIndexBuffer(mDevice, INITIAL_INDEX_BUFFER_SIZE, D3DFMT_INDEX16);
-
-    if (context->supports32bitIndices())
-    {
-        mStreamingBufferInt = new StreamingIndexBuffer(mDevice, INITIAL_INDEX_BUFFER_SIZE, D3DFMT_INDEX32);
-
-        if (!mStreamingBufferInt)
-        {
-            // Don't leave it in a half-initialized state
-            delete mStreamingBufferShort;
-            mStreamingBufferShort = NULL;
-        }
-    }
-    else
-    {
-        mStreamingBufferInt = NULL;
-    }
-
-    if (!mStreamingBufferShort)
-    {
-        ERR("Failed to allocate the streaming index buffer(s).");
-    }
-
-    mCountingBuffer = NULL;
-}
-
-IndexDataManager::~IndexDataManager()
-{
-    delete mStreamingBufferShort;
-    delete mStreamingBufferInt;
-    delete mCountingBuffer;
-}
-
-void convertIndices(GLenum type, const void *input, GLsizei count, void *output)
-{
-    if (type == GL_UNSIGNED_BYTE)
-    {
-        const GLubyte *in = static_cast<const GLubyte*>(input);
-        GLushort *out = static_cast<GLushort*>(output);
-
-        for (GLsizei i = 0; i < count; i++)
-        {
-            out[i] = in[i];
-        }
-    }
-    else if (type == GL_UNSIGNED_INT)
-    {
-        memcpy(output, input, count * sizeof(GLuint));
-    }
-    else if (type == GL_UNSIGNED_SHORT)
-    {
-        memcpy(output, input, count * sizeof(GLushort));
-    }
-    else UNREACHABLE();
-}
-
-template <class IndexType>
-void computeRange(const IndexType *indices, GLsizei count, GLuint *minIndex, GLuint *maxIndex)
-{
-    *minIndex = indices[0];
-    *maxIndex = indices[0];
-
-    for (GLsizei i = 0; i < count; i++)
-    {
-        if (*minIndex > indices[i]) *minIndex = indices[i];
-        if (*maxIndex < indices[i]) *maxIndex = indices[i];
-    }
-}
-
-void computeRange(GLenum type, const GLvoid *indices, GLsizei count, GLuint *minIndex, GLuint *maxIndex)
-{
-    if (type == GL_UNSIGNED_BYTE)
-    {
-        computeRange(static_cast<const GLubyte*>(indices), count, minIndex, maxIndex);
-    }
-    else if (type == GL_UNSIGNED_INT)
-    {
-        computeRange(static_cast<const GLuint*>(indices), count, minIndex, maxIndex);
-    }
-    else if (type == GL_UNSIGNED_SHORT)
-    {
-        computeRange(static_cast<const GLushort*>(indices), count, minIndex, maxIndex);
-    }
-    else UNREACHABLE();
-}
-
-GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, Buffer *buffer, const GLvoid *indices, TranslatedIndexData *translated)
-{
-    if (!mStreamingBufferShort)
-    {
-        return GL_OUT_OF_MEMORY;
-    }
-
-    D3DFORMAT format = (type == GL_UNSIGNED_INT) ? D3DFMT_INDEX32 : D3DFMT_INDEX16;
-    intptr_t offset = reinterpret_cast<intptr_t>(indices);
-    bool alignedOffset = false;
-
-    if (buffer != NULL)
-    {
-        switch (type)
-        {
-          case GL_UNSIGNED_BYTE:  alignedOffset = (offset % sizeof(GLubyte) == 0);  break;
-          case GL_UNSIGNED_SHORT: alignedOffset = (offset % sizeof(GLushort) == 0); break;
-          case GL_UNSIGNED_INT:   alignedOffset = (offset % sizeof(GLuint) == 0);   break;
-          default: UNREACHABLE(); alignedOffset = false;
-        }
-
-        if (typeSize(type) * count + offset > static_cast<std::size_t>(buffer->size()))
-        {
-            return GL_INVALID_OPERATION;
-        }
-
-        indices = static_cast<const GLubyte*>(buffer->data()) + offset;
-    }
-
-    StreamingIndexBuffer *streamingBuffer = (type == GL_UNSIGNED_INT) ? mStreamingBufferInt : mStreamingBufferShort;
-
-    StaticIndexBuffer *staticBuffer = buffer ? buffer->getStaticIndexBuffer() : NULL;
-    IndexBuffer *indexBuffer = streamingBuffer;
-    UINT streamOffset = 0;
-
-    if (staticBuffer && staticBuffer->lookupType(type) && alignedOffset)
-    {
-        indexBuffer = staticBuffer;
-        streamOffset = staticBuffer->lookupRange(offset, count, &translated->minIndex, &translated->maxIndex);
-
-        if (streamOffset == -1)
-        {
-            streamOffset = (offset / typeSize(type)) * indexSize(format);
-            computeRange(type, indices, count, &translated->minIndex, &translated->maxIndex);
-            staticBuffer->addRange(offset, count, translated->minIndex, translated->maxIndex, streamOffset);
-        }
-    }
-    else
-    {
-        int convertCount = count;
-
-        if (staticBuffer)
-        {
-            if (staticBuffer->size() == 0 && alignedOffset)
-            {
-                indexBuffer = staticBuffer;
-                convertCount = buffer->size() / typeSize(type);
-            }
-            else
-            {
-                buffer->invalidateStaticData();
-                staticBuffer = NULL;
-            }
-        }
-
-        void *output = NULL;
-        
-        if (indexBuffer)
-        {
-            indexBuffer->reserveSpace(convertCount * indexSize(format), type);
-            output = indexBuffer->map(indexSize(format) * convertCount, &streamOffset);
-        }
-        
-        if (output == NULL)
-        {
-            ERR("Failed to map index buffer.");
-            return GL_OUT_OF_MEMORY;
-        }
-
-        convertIndices(type, staticBuffer ? buffer->data() : indices, convertCount, output);
-        indexBuffer->unmap();
-
-        computeRange(type, indices, count, &translated->minIndex, &translated->maxIndex);
-
-        if (staticBuffer)
-        {
-            streamOffset = (offset / typeSize(type)) * indexSize(format);
-            staticBuffer->addRange(offset, count, translated->minIndex, translated->maxIndex, streamOffset);
-        }
-    }
-
-    translated->indexBuffer = indexBuffer->getBuffer();
-    translated->serial = indexBuffer->getSerial();
-    translated->startIndex = streamOffset / indexSize(format);
-
-    if (buffer)
-    {
-        buffer->promoteStaticUsage(count * typeSize(type));
-    }
-
-    return GL_NO_ERROR;
-}
-
-std::size_t IndexDataManager::indexSize(D3DFORMAT format) const
-{
-    return (format == D3DFMT_INDEX32) ? sizeof(unsigned int) : sizeof(unsigned short);
-}
-
-std::size_t IndexDataManager::typeSize(GLenum type) const
-{
-    switch (type)
-    {
-      case GL_UNSIGNED_INT:   return sizeof(GLuint);
-      case GL_UNSIGNED_SHORT: return sizeof(GLushort);
-      case GL_UNSIGNED_BYTE:  return sizeof(GLubyte);
-      default: UNREACHABLE(); return sizeof(GLushort);
-    }
-}
-
-StaticIndexBuffer *IndexDataManager::getCountingIndices(GLsizei count)
-{
-    if (count <= 65536)   // 16-bit indices
-    {
-        const unsigned int spaceNeeded = count * sizeof(unsigned short);
-
-        if (!mCountingBuffer || mCountingBuffer->size() < spaceNeeded)
-        {
-            delete mCountingBuffer;
-            mCountingBuffer = new StaticIndexBuffer(mDevice);
-            mCountingBuffer->reserveSpace(spaceNeeded, GL_UNSIGNED_SHORT);
-
-            UINT offset;
-            unsigned short *data = static_cast<unsigned short*>(mCountingBuffer->map(spaceNeeded, &offset));
-        
-            if (data)
-            {
-                for(int i = 0; i < count; i++)
-                {
-                    data[i] = i;
-                }
-
-                mCountingBuffer->unmap();
-            }
-        }
-    }
-    else if (mStreamingBufferInt)   // 32-bit indices supported
-    {
-        const unsigned int spaceNeeded = count * sizeof(unsigned int);
-
-        if (!mCountingBuffer || mCountingBuffer->size() < spaceNeeded)
-        {
-            delete mCountingBuffer;
-            mCountingBuffer = new StaticIndexBuffer(mDevice);
-            mCountingBuffer->reserveSpace(spaceNeeded, GL_UNSIGNED_INT);
-
-            UINT offset;
-            unsigned int *data = static_cast<unsigned int*>(mCountingBuffer->map(spaceNeeded, &offset));
-        
-            if (data)
-            {
-                for(int i = 0; i < count; i++)
-                {
-                    data[i] = i;
-                }
-                
-                mCountingBuffer->unmap();
-            }
-        }
-    }
-    else return NULL;
-    
-    return mCountingBuffer;
-}
-
-IndexBuffer::IndexBuffer(IDirect3DDevice9 *device, UINT size, D3DFORMAT format) : mDevice(device), mBufferSize(size), mIndexBuffer(NULL)
-{
-    if (size > 0)
-    {
-        D3DPOOL pool = getDisplay()->getBufferPool(D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY);
-        HRESULT result = device->CreateIndexBuffer(size, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, format, pool, &mIndexBuffer, NULL);
-        mSerial = issueSerial();
-
-        if (FAILED(result))
-        {
-            ERR("Out of memory allocating an index buffer of size %lu.", size);
-        }
-    }
-}
-
-IndexBuffer::~IndexBuffer()
-{
-    if (mIndexBuffer)
-    {
-        mIndexBuffer->Release();
-    }
-}
-
-IDirect3DIndexBuffer9 *IndexBuffer::getBuffer() const
-{
-    return mIndexBuffer;
-}
-
-unsigned int IndexBuffer::getSerial() const
-{
-    return mSerial;
-}
-
-unsigned int IndexBuffer::issueSerial()
-{
-    return mCurrentSerial++;
-}
-
-void IndexBuffer::unmap()
-{
-    if (mIndexBuffer)
-    {
-        mIndexBuffer->Unlock();
-    }
-}
-
-StreamingIndexBuffer::StreamingIndexBuffer(IDirect3DDevice9 *device, UINT initialSize, D3DFORMAT format) : IndexBuffer(device, initialSize, format)
-{
-    mWritePosition = 0;
-}
-
-StreamingIndexBuffer::~StreamingIndexBuffer()
-{
-}
-
-void *StreamingIndexBuffer::map(UINT requiredSpace, UINT *offset)
-{
-    void *mapPtr = NULL;
-
-    if (mIndexBuffer)
-    {
-        HRESULT result = mIndexBuffer->Lock(mWritePosition, requiredSpace, &mapPtr, D3DLOCK_NOOVERWRITE);
-     
-        if (FAILED(result))
-        {
-            ERR(" Lock failed with error 0x%08x", result);
-            return NULL;
-        }
-
-        *offset = mWritePosition;
-        mWritePosition += requiredSpace;
-    }
-
-    return mapPtr;
-}
-
-void StreamingIndexBuffer::reserveSpace(UINT requiredSpace, GLenum type)
-{
-    if (requiredSpace > mBufferSize)
-    {
-        if (mIndexBuffer)
-        {
-            mIndexBuffer->Release();
-            mIndexBuffer = NULL;
-        }
-
-        mBufferSize = std::max(requiredSpace, 2 * mBufferSize);
-
-        D3DPOOL pool = getDisplay()->getBufferPool(D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY);
-        HRESULT result = mDevice->CreateIndexBuffer(mBufferSize, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, type == GL_UNSIGNED_INT ? D3DFMT_INDEX32 : D3DFMT_INDEX16, pool, &mIndexBuffer, NULL);
-        mSerial = issueSerial();
-    
-        if (FAILED(result))
-        {
-            ERR("Out of memory allocating a vertex buffer of size %lu.", mBufferSize);
-        }
-
-        mWritePosition = 0;
-    }
-    else if (mWritePosition + requiredSpace > mBufferSize)   // Recycle
-    {
-        void *dummy;
-        mIndexBuffer->Lock(0, 1, &dummy, D3DLOCK_DISCARD);
-        mIndexBuffer->Unlock();
-
-        mWritePosition = 0;
-    }
-}
-
-StaticIndexBuffer::StaticIndexBuffer(IDirect3DDevice9 *device) : IndexBuffer(device, 0, D3DFMT_UNKNOWN)
-{
-    mCacheType = GL_NONE;
-}
-
-StaticIndexBuffer::~StaticIndexBuffer()
-{
-}
-
-void *StaticIndexBuffer::map(UINT requiredSpace, UINT *offset)
-{
-    void *mapPtr = NULL;
-
-    if (mIndexBuffer)
-    {
-        HRESULT result = mIndexBuffer->Lock(0, requiredSpace, &mapPtr, 0);
-     
-        if (FAILED(result))
-        {
-            ERR(" Lock failed with error 0x%08x", result);
-            return NULL;
-        }
-
-        *offset = 0;
-    }
-
-    return mapPtr;
-}
-
-void StaticIndexBuffer::reserveSpace(UINT requiredSpace, GLenum type)
-{
-    if (!mIndexBuffer && mBufferSize == 0)
-    {
-        D3DPOOL pool = getDisplay()->getBufferPool(D3DUSAGE_WRITEONLY);
-        HRESULT result = mDevice->CreateIndexBuffer(requiredSpace, D3DUSAGE_WRITEONLY, type == GL_UNSIGNED_INT ? D3DFMT_INDEX32 : D3DFMT_INDEX16, pool, &mIndexBuffer, NULL);
-        mSerial = issueSerial();
-    
-        if (FAILED(result))
-        {
-            ERR("Out of memory allocating a vertex buffer of size %lu.", mBufferSize);
-        }
-
-        mBufferSize = requiredSpace;
-        mCacheType = type;
-    }
-    else if (mIndexBuffer && mBufferSize >= requiredSpace && mCacheType == type)
-    {
-        // Already allocated
-    }
-    else UNREACHABLE();   // Static index buffers can't be resized
-}
-
-bool StaticIndexBuffer::lookupType(GLenum type)
-{
-    return mCacheType == type;
-}
-
-UINT StaticIndexBuffer::lookupRange(intptr_t offset, GLsizei count, UINT *minIndex, UINT *maxIndex)
-{
-    IndexRange range = {offset, count};
-
-    std::map<IndexRange, IndexResult>::iterator res = mCache.find(range);
-    
-    if (res == mCache.end())
-    {
-        return -1;
-    }
-
-    *minIndex = res->second.minIndex;
-    *maxIndex = res->second.maxIndex;
-    return res->second.streamOffset;
-}
-
-void StaticIndexBuffer::addRange(intptr_t offset, GLsizei count, UINT minIndex, UINT maxIndex, UINT streamOffset)
-{
-    IndexRange indexRange = {offset, count};
-    IndexResult indexResult = {minIndex, maxIndex, streamOffset};
-    mCache[indexRange] = indexResult;
-}
-
-}
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/IndexDataManager.h b/Source/ThirdParty/ANGLE/src/libGLESv2/IndexDataManager.h
deleted file mode 100644
index c1d4168..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/IndexDataManager.h
+++ /dev/null
@@ -1,149 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// IndexDataManager.h: Defines the IndexDataManager, a class that
-// runs the Buffer translation process for index buffers.
-
-#ifndef LIBGLESV2_INDEXDATAMANAGER_H_
-#define LIBGLESV2_INDEXDATAMANAGER_H_
-
-#include <vector>
-#include <cstddef>
-
-#define GL_APICALL
-#include <GLES2/gl2.h>
-
-#include "libGLESv2/Context.h"
-
-namespace
-{
-    enum { INITIAL_INDEX_BUFFER_SIZE = 4096 * sizeof(GLuint) };
-}
-
-namespace gl
-{
-
-struct TranslatedIndexData
-{
-    UINT minIndex;
-    UINT maxIndex;
-    UINT startIndex;
-
-    IDirect3DIndexBuffer9 *indexBuffer;
-    unsigned int serial;
-};
-
-class IndexBuffer
-{
-  public:
-    IndexBuffer(IDirect3DDevice9 *device, UINT size, D3DFORMAT format);
-    virtual ~IndexBuffer();
-
-    UINT size() const { return mBufferSize; }
-    virtual void *map(UINT requiredSpace, UINT *offset) = 0;
-    void unmap();
-    virtual void reserveSpace(UINT requiredSpace, GLenum type) = 0;
-
-    IDirect3DIndexBuffer9 *getBuffer() const;
-    unsigned int getSerial() const;
-
-  protected:
-    IDirect3DDevice9 *const mDevice;
-
-    IDirect3DIndexBuffer9 *mIndexBuffer;
-    UINT mBufferSize;
-
-    unsigned int mSerial;
-    static unsigned int issueSerial();
-    static unsigned int mCurrentSerial;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(IndexBuffer);
-};
-
-class StreamingIndexBuffer : public IndexBuffer
-{
-  public:
-    StreamingIndexBuffer(IDirect3DDevice9 *device, UINT initialSize, D3DFORMAT format);
-    ~StreamingIndexBuffer();
-
-    virtual void *map(UINT requiredSpace, UINT *offset);
-    virtual void reserveSpace(UINT requiredSpace, GLenum type);
-
-  private:
-    UINT mWritePosition;
-};
-
-class StaticIndexBuffer : public IndexBuffer
-{
-  public:
-    explicit StaticIndexBuffer(IDirect3DDevice9 *device);
-    ~StaticIndexBuffer();
-
-    virtual void *map(UINT requiredSpace, UINT *offset);
-    virtual void reserveSpace(UINT requiredSpace, GLenum type);
-
-    bool lookupType(GLenum type);
-    UINT lookupRange(intptr_t offset, GLsizei count, UINT *minIndex, UINT *maxIndex);   // Returns the offset into the index buffer, or -1 if not found
-    void addRange(intptr_t offset, GLsizei count, UINT minIndex, UINT maxIndex, UINT streamOffset);
-
-  private:
-    GLenum mCacheType;
-    
-    struct IndexRange
-    {
-        intptr_t offset;
-        GLsizei count;
-
-        bool operator<(const IndexRange& rhs) const
-        {
-            if (offset != rhs.offset)
-            {
-                return offset < rhs.offset;
-            }
-            if (count != rhs.count)
-            {
-                return count < rhs.count;
-            }
-            return false;
-        }
-    };
-
-    struct IndexResult
-    {
-        UINT minIndex;
-        UINT maxIndex;
-        UINT streamOffset;
-    };
-
-    std::map<IndexRange, IndexResult> mCache;
-};
-
-class IndexDataManager
-{
-  public:
-    IndexDataManager(Context *context, IDirect3DDevice9 *evice);
-    virtual ~IndexDataManager();
-
-    GLenum prepareIndexData(GLenum type, GLsizei count, Buffer *arrayElementBuffer, const GLvoid *indices, TranslatedIndexData *translated);
-    StaticIndexBuffer *getCountingIndices(GLsizei count);
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(IndexDataManager);
-
-    std::size_t typeSize(GLenum type) const;
-    std::size_t indexSize(D3DFORMAT format) const;
-
-    IDirect3DDevice9 *const mDevice;
-
-    StreamingIndexBuffer *mStreamingBufferShort;
-    StreamingIndexBuffer *mStreamingBufferInt;
-    StaticIndexBuffer *mCountingBuffer;
-};
-
-}
-
-#endif   // LIBGLESV2_INDEXDATAMANAGER_H_
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Program.cpp b/Source/ThirdParty/ANGLE/src/libGLESv2/Program.cpp
deleted file mode 100644
index f28a9d8..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Program.cpp
+++ /dev/null
@@ -1,507 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Program.cpp: Implements the gl::Program class. Implements GL program objects
-// and related functionality. [OpenGL ES 2.0.24] section 2.10.3 page 28.
-
-#include "libGLESv2/Program.h"
-#include "libGLESv2/ProgramBinary.h"
-
-#include "common/debug.h"
-
-#include "libGLESv2/main.h"
-#include "libGLESv2/Shader.h"
-#include "libGLESv2/utilities.h"
-
-#include <string>
-
-namespace gl
-{
-const char * const g_fakepath = "C:\\fakepath";
-
-unsigned int Program::mCurrentSerial = 1;
-
-AttributeBindings::AttributeBindings()
-{
-}
-
-AttributeBindings::~AttributeBindings()
-{
-}
-
-InfoLog::InfoLog() : mInfoLog(NULL)
-{
-}
-
-InfoLog::~InfoLog()
-{
-    delete[] mInfoLog;
-}
-
-
-int InfoLog::getLength() const
-{
-    if (!mInfoLog)
-    {
-        return 0;
-    }
-    else
-    {
-       return strlen(mInfoLog) + 1;
-    }
-}
-
-void InfoLog::getLog(GLsizei bufSize, GLsizei *length, char *infoLog)
-{
-    int index = 0;
-
-    if (bufSize > 0)
-    {
-        if (mInfoLog)
-        {
-            index = std::min(bufSize - 1, (int)strlen(mInfoLog));
-            memcpy(infoLog, mInfoLog, index);
-        }
-
-        infoLog[index] = '\0';
-    }
-
-    if (length)
-    {
-        *length = index;
-    }
-}
-
-// append a santized message to the program info log.
-// The D3D compiler includes a fake file path in some of the warning or error 
-// messages, so lets remove all occurrences of this fake file path from the log.
-void InfoLog::appendSanitized(const char *message)
-{
-    std::string msg(message);
-
-    size_t found;
-    do
-    {
-        found = msg.find(g_fakepath);
-        if (found != std::string::npos)
-        {
-            msg.erase(found, strlen(g_fakepath));
-        }
-    }
-    while (found != std::string::npos);
-
-    append("%s\n", msg.c_str());
-}
-
-void InfoLog::append(const char *format, ...)
-{
-    if (!format)
-    {
-        return;
-    }
-
-    char info[1024];
-
-    va_list vararg;
-    va_start(vararg, format);
-    vsnprintf(info, sizeof(info), format, vararg);
-    va_end(vararg);
-
-    size_t infoLength = strlen(info);
-
-    if (!mInfoLog)
-    {
-        mInfoLog = new char[infoLength + 1];
-        strcpy(mInfoLog, info);
-    }
-    else
-    {
-        size_t logLength = strlen(mInfoLog);
-        char *newLog = new char[logLength + infoLength + 1];
-        strcpy(newLog, mInfoLog);
-        strcpy(newLog + logLength, info);
-
-        delete[] mInfoLog;
-        mInfoLog = newLog;
-    }
-}
-
-void InfoLog::reset()
-{
-    if (mInfoLog)
-    {
-        delete [] mInfoLog;
-        mInfoLog = NULL;
-    }
-}
-
-Program::Program(ResourceManager *manager, GLuint handle) : mResourceManager(manager), mHandle(handle), mSerial(issueSerial())
-{
-    mFragmentShader = NULL;
-    mVertexShader = NULL;
-    mProgramBinary = NULL;
-    mDeleteStatus = false;
-    mRefCount = 0;
-}
-
-Program::~Program()
-{
-    unlink(true);
-
-    if (mVertexShader != NULL)
-    {
-        mVertexShader->release();
-    }
-
-    if (mFragmentShader != NULL)
-    {
-        mFragmentShader->release();
-    }
-}
-
-bool Program::attachShader(Shader *shader)
-{
-    if (shader->getType() == GL_VERTEX_SHADER)
-    {
-        if (mVertexShader)
-        {
-            return false;
-        }
-
-        mVertexShader = (VertexShader*)shader;
-        mVertexShader->addRef();
-    }
-    else if (shader->getType() == GL_FRAGMENT_SHADER)
-    {
-        if (mFragmentShader)
-        {
-            return false;
-        }
-
-        mFragmentShader = (FragmentShader*)shader;
-        mFragmentShader->addRef();
-    }
-    else UNREACHABLE();
-
-    return true;
-}
-
-bool Program::detachShader(Shader *shader)
-{
-    if (shader->getType() == GL_VERTEX_SHADER)
-    {
-        if (mVertexShader != shader)
-        {
-            return false;
-        }
-
-        mVertexShader->release();
-        mVertexShader = NULL;
-    }
-    else if (shader->getType() == GL_FRAGMENT_SHADER)
-    {
-        if (mFragmentShader != shader)
-        {
-            return false;
-        }
-
-        mFragmentShader->release();
-        mFragmentShader = NULL;
-    }
-    else UNREACHABLE();
-
-    return true;
-}
-
-int Program::getAttachedShadersCount() const
-{
-    return (mVertexShader ? 1 : 0) + (mFragmentShader ? 1 : 0);
-}
-
-void AttributeBindings::bindAttributeLocation(GLuint index, const char *name)
-{
-    if (index < MAX_VERTEX_ATTRIBS)
-    {
-        for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
-        {
-            mAttributeBinding[i].erase(name);
-        }
-
-        mAttributeBinding[index].insert(name);
-    }
-}
-
-void Program::bindAttributeLocation(GLuint index, const char *name)
-{
-    mAttributeBindings.bindAttributeLocation(index, name);
-}
-
-// Links the HLSL code of the vertex and pixel shader by matching up their varyings,
-// compiling them into binaries, determining the attribute mappings, and collecting
-// a list of uniforms
-void Program::link()
-{
-    unlink(false);
-
-    mInfoLog.reset();
-
-    mProgramBinary = new ProgramBinary;
-    if (!mProgramBinary->link(mInfoLog, mAttributeBindings, mFragmentShader, mVertexShader))
-    {
-        unlink(false);
-    }
-}
-
-int AttributeBindings::getAttributeBinding(const std::string &name) const
-{
-    for (int location = 0; location < MAX_VERTEX_ATTRIBS; location++)
-    {
-        if (mAttributeBinding[location].find(name) != mAttributeBinding[location].end())
-        {
-            return location;
-        }
-    }
-
-    return -1;
-}
-
-// Returns the program object to an unlinked state, before re-linking, or at destruction
-void Program::unlink(bool destroy)
-{
-    if (destroy)   // Object being destructed
-    {
-        if (mFragmentShader)
-        {
-            mFragmentShader->release();
-            mFragmentShader = NULL;
-        }
-
-        if (mVertexShader)
-        {
-            mVertexShader->release();
-            mVertexShader = NULL;
-        }
-    }
-
-    if (mProgramBinary)
-    {
-        delete mProgramBinary;
-        mProgramBinary = NULL;
-    }
-}
-
-ProgramBinary* Program::getProgramBinary()
-{
-    return mProgramBinary;
-}
-
-void Program::setProgramBinary(ProgramBinary *programBinary)
-{
-    unlink(false);
-    mProgramBinary = programBinary;
-}
-
-void Program::release()
-{
-    mRefCount--;
-
-    if (mRefCount == 0 && mDeleteStatus)
-    {
-        mResourceManager->deleteProgram(mHandle);
-    }
-}
-
-void Program::addRef()
-{
-    mRefCount++;
-}
-
-unsigned int Program::getRefCount() const
-{
-    return mRefCount;
-}
-
-unsigned int Program::getSerial() const
-{
-    return mSerial;
-}
-
-unsigned int Program::issueSerial()
-{
-    return mCurrentSerial++;
-}
-
-int Program::getInfoLogLength() const
-{
-    return mInfoLog.getLength();
-}
-
-void Program::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog)
-{
-    return mInfoLog.getLog(bufSize, length, infoLog);
-}
-
-void Program::getAttachedShaders(GLsizei maxCount, GLsizei *count, GLuint *shaders)
-{
-    int total = 0;
-
-    if (mVertexShader)
-    {
-        if (total < maxCount)
-        {
-            shaders[total] = mVertexShader->getHandle();
-        }
-
-        total++;
-    }
-
-    if (mFragmentShader)
-    {
-        if (total < maxCount)
-        {
-            shaders[total] = mFragmentShader->getHandle();
-        }
-
-        total++;
-    }
-
-    if (count)
-    {
-        *count = total;
-    }
-}
-
-void Program::getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
-    if (mProgramBinary)
-    {
-        mProgramBinary->getActiveAttribute(index, bufsize, length, size, type, name);
-    }
-    else
-    {
-        if (bufsize > 0)
-        {
-            name[0] = '\0';
-        }
-        
-        if (length)
-        {
-            *length = 0;
-        }
-
-        *type = GL_NONE;
-        *size = 1;
-    }
-}
-
-GLint Program::getActiveAttributeCount()
-{
-    if (mProgramBinary)
-    {
-        return mProgramBinary->getActiveAttributeCount();
-    }
-    else
-    {
-        return 0;
-    }
-}
-
-GLint Program::getActiveAttributeMaxLength()
-{
-    if (mProgramBinary)
-    {
-        return mProgramBinary->getActiveAttributeMaxLength();
-    }
-    else
-    {
-        return 0;
-    }
-}
-
-void Program::getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
-    if (mProgramBinary)
-    {
-        return mProgramBinary->getActiveUniform(index, bufsize, length, size, type, name);
-    }
-    else
-    {
-        if (bufsize > 0)
-        {
-            name[0] = '\0';
-        }
-
-        if (length)
-        {
-            *length = 0;
-        }
-
-        *size = 0;
-        *type = GL_NONE;
-    }
-}
-
-GLint Program::getActiveUniformCount()
-{
-    if (mProgramBinary)
-    {
-        return mProgramBinary->getActiveUniformCount();
-    }
-    else
-    {
-        return 0;
-    }
-}
-
-GLint Program::getActiveUniformMaxLength()
-{
-    if (mProgramBinary)
-    {
-        return mProgramBinary->getActiveUniformMaxLength();
-    }
-    else
-    {
-        return 0;
-    }
-}
-
-void Program::flagForDeletion()
-{
-    mDeleteStatus = true;
-}
-
-bool Program::isFlaggedForDeletion() const
-{
-    return mDeleteStatus;
-}
-
-void Program::validate()
-{
-    mInfoLog.reset();
-
-    if (mProgramBinary)
-    {
-        mProgramBinary->validate(mInfoLog);
-    }
-    else
-    {
-        mInfoLog.append("Program has not been successfully linked.");
-    }
-}
-
-bool Program::isValidated() const
-{
-    if (mProgramBinary)
-    {
-        return mProgramBinary->isValidated();
-    }
-    else
-    {
-        return false;
-    }
-}
-
-}
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Program.h b/Source/ThirdParty/ANGLE/src/libGLESv2/Program.h
deleted file mode 100644
index 244731d..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Program.h
+++ /dev/null
@@ -1,126 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Program.h: Defines the gl::Program class. Implements GL program objects
-// and related functionality. [OpenGL ES 2.0.24] section 2.10.3 page 28.
-
-#ifndef LIBGLESV2_PROGRAM_H_
-#define LIBGLESV2_PROGRAM_H_
-
-#include <d3dx9.h>
-#include <string>
-#include <set>
-
-#include "libGLESv2/Shader.h"
-#include "libGLESv2/Context.h"
-
-namespace gl
-{
-class ResourceManager;
-class FragmentShader;
-class VertexShader;
-
-extern const char * const g_fakepath;
-
-class AttributeBindings
-{
-  public:
-    AttributeBindings();
-    ~AttributeBindings();
-
-    void bindAttributeLocation(GLuint index, const char *name);
-    int getAttributeBinding(const std::string &name) const;
-
-  private:
-    std::set<std::string> mAttributeBinding[MAX_VERTEX_ATTRIBS];
-};
-
-class InfoLog
-{
-  public:
-    InfoLog();
-    ~InfoLog();
-
-    int getLength() const;
-    void getLog(GLsizei bufSize, GLsizei *length, char *infoLog);
-
-    void appendSanitized(const char *message);
-    void append(const char *info, ...);
-    void reset();
-  private:
-    DISALLOW_COPY_AND_ASSIGN(InfoLog);
-    char *mInfoLog;
-};
-
-class Program
-{
-  public:
-    Program(ResourceManager *manager, GLuint handle);
-
-    ~Program();
-
-    bool attachShader(Shader *shader);
-    bool detachShader(Shader *shader);
-    int getAttachedShadersCount() const;
-
-    void bindAttributeLocation(GLuint index, const char *name);
-
-    void link();
-    void setProgramBinary(ProgramBinary *programBinary);
-    ProgramBinary *getProgramBinary();
-
-    int getInfoLogLength() const;
-    void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog);
-    void getAttachedShaders(GLsizei maxCount, GLsizei *count, GLuint *shaders);
-
-    void getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-    GLint getActiveAttributeCount();
-    GLint getActiveAttributeMaxLength();
-
-    void getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-    GLint getActiveUniformCount();
-    GLint getActiveUniformMaxLength();
-
-    void addRef();
-    void release();
-    unsigned int getRefCount() const;
-    void flagForDeletion();
-    bool isFlaggedForDeletion() const;
-
-    void validate();
-    bool isValidated() const;
-
-    unsigned int getSerial() const;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Program);
-
-    void unlink(bool destroy = false);
-
-    static unsigned int issueSerial();
-
-    FragmentShader *mFragmentShader;
-    VertexShader *mVertexShader;
-
-    AttributeBindings mAttributeBindings;
-
-    ProgramBinary* mProgramBinary;
-    bool mDeleteStatus;   // Flag to indicate that the program can be deleted when no longer in use
-
-    unsigned int mRefCount;
-
-    const unsigned int mSerial;
-
-    static unsigned int mCurrentSerial;
-
-    ResourceManager *mResourceManager;
-    const GLuint mHandle;
-
-    InfoLog mInfoLog;
-};
-}
-
-#endif   // LIBGLESV2_PROGRAM_H_
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.cpp b/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.cpp
deleted file mode 100644
index ac28e51..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.cpp
+++ /dev/null
@@ -1,2480 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Program.cpp: Implements the gl::Program class. Implements GL program objects
-// and related functionality. [OpenGL ES 2.0.24] section 2.10.3 page 28.
-
-#include "libGLESv2/Program.h"
-#include "libGLESv2/ProgramBinary.h"
-
-#include "common/debug.h"
-
-#include "libGLESv2/main.h"
-#include "libGLESv2/Shader.h"
-#include "libGLESv2/utilities.h"
-
-#include <string>
-
-#if !defined(ANGLE_COMPILE_OPTIMIZATION_LEVEL)
-#define ANGLE_COMPILE_OPTIMIZATION_LEVEL D3DCOMPILE_OPTIMIZATION_LEVEL3
-#endif
-
-namespace gl
-{
-std::string str(int i)
-{
-    char buffer[20];
-    snprintf(buffer, sizeof(buffer), "%d", i);
-    return buffer;
-}
-
-Uniform::Uniform(GLenum type, const std::string &_name, unsigned int arraySize)
-    : type(type), _name(_name), name(ProgramBinary::undecorateUniform(_name)), arraySize(arraySize)
-{
-    int bytes = UniformInternalSize(type) * arraySize;
-    data = new unsigned char[bytes];
-    memset(data, 0, bytes);
-    dirty = true;
-}
-
-Uniform::~Uniform()
-{
-    delete[] data;
-}
-
-bool Uniform::isArray()
-{
-    return _name.compare(0, 3, "ar_") == 0;
-}
-
-UniformLocation::UniformLocation(const std::string &_name, unsigned int element, unsigned int index) 
-    : name(ProgramBinary::undecorateUniform(_name)), element(element), index(index)
-{
-}
-
-ProgramBinary::ProgramBinary()
-{
-    mDevice = getDevice();
-
-    mPixelExecutable = NULL;
-    mVertexExecutable = NULL;
-    mConstantTablePS = NULL;
-    mConstantTableVS = NULL;
-
-    mValidated = false;
-
-    for (int index = 0; index < MAX_VERTEX_ATTRIBS; index++)
-    {
-        mSemanticIndex[index] = -1;
-    }
-
-    for (int index = 0; index < MAX_TEXTURE_IMAGE_UNITS; index++)
-    {
-        mSamplersPS[index].active = false;
-    }
-
-    for (int index = 0; index < MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF; index++)
-    {
-        mSamplersVS[index].active = false;
-    }
-
-    mUsedVertexSamplerRange = 0;
-    mUsedPixelSamplerRange = 0;
-
-    mDxDepthRangeLocation = -1;
-    mDxDepthLocation = -1;
-    mDxCoordLocation = -1;
-    mDxHalfPixelSizeLocation = -1;
-    mDxFrontCCWLocation = -1;
-    mDxPointsOrLinesLocation = -1;
-}
-
-ProgramBinary::~ProgramBinary()
-{
-    if (mPixelExecutable)
-    {
-        mPixelExecutable->Release();
-    }
-
-    if (mVertexExecutable)
-    {
-        mVertexExecutable->Release();
-    }
-
-    if (mConstantTablePS)
-    {
-        mConstantTablePS->Release();
-    }
-
-    if (mConstantTableVS)
-    {
-        mConstantTableVS->Release();
-    }
-
-    while (!mUniforms.empty())
-    {
-        delete mUniforms.back();
-        mUniforms.pop_back();
-    }
-}
-
-IDirect3DPixelShader9 *ProgramBinary::getPixelShader()
-{
-    return mPixelExecutable;
-}
-
-IDirect3DVertexShader9 *ProgramBinary::getVertexShader()
-{
-    return mVertexExecutable;
-}
-
-GLuint ProgramBinary::getAttributeLocation(const char *name)
-{
-    if (name)
-    {
-        for (int index = 0; index < MAX_VERTEX_ATTRIBS; index++)
-        {
-            if (mLinkedAttribute[index].name == std::string(name))
-            {
-                return index;
-            }
-        }
-    }
-
-    return -1;
-}
-
-int ProgramBinary::getSemanticIndex(int attributeIndex)
-{
-    ASSERT(attributeIndex >= 0 && attributeIndex < MAX_VERTEX_ATTRIBS);
-    
-    return mSemanticIndex[attributeIndex];
-}
-
-// Returns one more than the highest sampler index used.
-GLint ProgramBinary::getUsedSamplerRange(SamplerType type)
-{
-    switch (type)
-    {
-      case SAMPLER_PIXEL:
-        return mUsedPixelSamplerRange;
-      case SAMPLER_VERTEX:
-        return mUsedVertexSamplerRange;
-      default:
-        UNREACHABLE();
-        return 0;
-    }
-}
-
-// Returns the index of the texture image unit (0-19) corresponding to a Direct3D 9 sampler
-// index (0-15 for the pixel shader and 0-3 for the vertex shader).
-GLint ProgramBinary::getSamplerMapping(SamplerType type, unsigned int samplerIndex)
-{
-    GLint logicalTextureUnit = -1;
-
-    switch (type)
-    {
-      case SAMPLER_PIXEL:
-        ASSERT(samplerIndex < sizeof(mSamplersPS)/sizeof(mSamplersPS[0]));
-
-        if (mSamplersPS[samplerIndex].active)
-        {
-            logicalTextureUnit = mSamplersPS[samplerIndex].logicalTextureUnit;
-        }
-        break;
-      case SAMPLER_VERTEX:
-        ASSERT(samplerIndex < sizeof(mSamplersVS)/sizeof(mSamplersVS[0]));
-
-        if (mSamplersVS[samplerIndex].active)
-        {
-            logicalTextureUnit = mSamplersVS[samplerIndex].logicalTextureUnit;
-        }
-        break;
-      default: UNREACHABLE();
-    }
-
-    if (logicalTextureUnit >= 0 && logicalTextureUnit < (GLint)getContext()->getMaximumCombinedTextureImageUnits())
-    {
-        return logicalTextureUnit;
-    }
-
-    return -1;
-}
-
-// Returns the texture type for a given Direct3D 9 sampler type and
-// index (0-15 for the pixel shader and 0-3 for the vertex shader).
-TextureType ProgramBinary::getSamplerTextureType(SamplerType type, unsigned int samplerIndex)
-{
-    switch (type)
-    {
-      case SAMPLER_PIXEL:
-        ASSERT(samplerIndex < sizeof(mSamplersPS)/sizeof(mSamplersPS[0]));
-        ASSERT(mSamplersPS[samplerIndex].active);
-        return mSamplersPS[samplerIndex].textureType;
-      case SAMPLER_VERTEX:
-        ASSERT(samplerIndex < sizeof(mSamplersVS)/sizeof(mSamplersVS[0]));
-        ASSERT(mSamplersVS[samplerIndex].active);
-        return mSamplersVS[samplerIndex].textureType;
-      default: UNREACHABLE();
-    }
-
-    return TEXTURE_2D;
-}
-
-GLint ProgramBinary::getUniformLocation(std::string name)
-{
-    unsigned int subscript = 0;
-
-    // Strip any trailing array operator and retrieve the subscript
-    size_t open = name.find_last_of('[');
-    size_t close = name.find_last_of(']');
-    if (open != std::string::npos && close == name.length() - 1)
-    {
-        subscript = atoi(name.substr(open + 1).c_str());
-        name.erase(open);
-    }
-
-    unsigned int numUniforms = mUniformIndex.size();
-    for (unsigned int location = 0; location < numUniforms; location++)
-    {
-        if (mUniformIndex[location].name == name &&
-            mUniformIndex[location].element == subscript)
-        {
-            return location;
-        }
-    }
-
-    return -1;
-}
-
-bool ProgramBinary::setUniform1fv(GLint location, GLsizei count, const GLfloat* v)
-{
-    if (location < 0 || location >= (int)mUniformIndex.size())
-    {
-        return false;
-    }
-
-    Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
-    targetUniform->dirty = true;
-
-    if (targetUniform->type == GL_FLOAT)
-    {
-        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);
-
-        GLfloat *target = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 4;
-
-        for (int i = 0; i < count; i++)
-        {
-            target[0] = v[0];
-            target[1] = 0;
-            target[2] = 0;
-            target[3] = 0;
-            target += 4;
-            v += 1;
-        }
-    }
-    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 = (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;
-            }
-        }
-    }
-    else
-    {
-        return false;
-    }
-
-    return true;
-}
-
-bool ProgramBinary::setUniform2fv(GLint location, GLsizei count, const GLfloat *v)
-{
-    if (location < 0 || location >= (int)mUniformIndex.size())
-    {
-        return false;
-    }
-
-    Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
-    targetUniform->dirty = true;
-
-    if (targetUniform->type == GL_FLOAT_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);
-
-        GLfloat *target = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 4;
-
-        for (int i = 0; i < count; i++)
-        {
-            target[0] = v[0];
-            target[1] = v[1];
-            target[2] = 0;
-            target[3] = 0;
-            target += 4;
-            v += 2;
-        }
-    }
-    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 = (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;
-            }
-        }
-    }
-    else 
-    {
-        return false;
-    }
-
-    return true;
-}
-
-bool ProgramBinary::setUniform3fv(GLint location, GLsizei count, const GLfloat *v)
-{
-    if (location < 0 || location >= (int)mUniformIndex.size())
-    {
-        return false;
-    }
-
-    Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
-    targetUniform->dirty = true;
-
-    if (targetUniform->type == GL_FLOAT_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);
-
-        GLfloat *target = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 4;
-
-        for (int i = 0; i < count; i++)
-        {
-            target[0] = v[0];
-            target[1] = v[1];
-            target[2] = v[2];
-            target[3] = 0;
-            target += 4;
-            v += 3;
-        }
-    }
-    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 = (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;
-            }
-        }
-    }
-    else 
-    {
-        return false;
-    }
-
-    return true;
-}
-
-bool ProgramBinary::setUniform4fv(GLint location, GLsizei count, const GLfloat *v)
-{
-    if (location < 0 || location >= (int)mUniformIndex.size())
-    {
-        return false;
-    }
-
-    Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
-    targetUniform->dirty = true;
-
-    if (targetUniform->type == GL_FLOAT_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);
-
-        memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLfloat) * 4,
-               v, 4 * sizeof(GLfloat) * count);
-    }
-    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 = (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;
-            }
-        }
-    }
-    else 
-    {
-        return false;
-    }
-
-    return true;
-}
-
-template<typename T, int targetWidth, int targetHeight, int srcWidth, int srcHeight>
-void transposeMatrix(T *target, const GLfloat *value)
-{
-    int copyWidth = std::min(targetWidth, srcWidth);
-    int copyHeight = std::min(targetHeight, srcHeight);
-
-    for (int x = 0; x < copyWidth; x++)
-    {
-        for (int y = 0; y < copyHeight; y++)
-        {
-            target[x * targetWidth + y] = (T)value[y * srcWidth + x];
-        }
-    }
-    // clear unfilled right side
-    for (int y = 0; y < copyHeight; y++)
-    {
-        for (int x = srcWidth; x < targetWidth; x++)
-        {
-            target[y * targetWidth + x] = (T)0;
-        }
-    }
-    // clear unfilled bottom.
-    for (int y = srcHeight; y < targetHeight; y++)
-    {
-        for (int x = 0; x < targetWidth; x++)
-        {
-            target[y * targetWidth + x] = (T)0;
-        }
-    }
-}
-
-bool ProgramBinary::setUniformMatrix2fv(GLint location, GLsizei count, const GLfloat *value)
-{
-    if (location < 0 || location >= (int)mUniformIndex.size())
-    {
-        return false;
-    }
-
-    Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
-    targetUniform->dirty = true;
-
-    if (targetUniform->type != GL_FLOAT_MAT2)
-    {
-        return false;
-    }
-
-    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);
-
-    GLfloat *target = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 8;
-    for (int i = 0; i < count; i++)
-    {
-        transposeMatrix<GLfloat,4,2,2,2>(target, value);
-        target += 8;
-        value += 4;
-    }
-
-    return true;
-}
-
-bool ProgramBinary::setUniformMatrix3fv(GLint location, GLsizei count, const GLfloat *value)
-{
-    if (location < 0 || location >= (int)mUniformIndex.size())
-    {
-        return false;
-    }
-
-    Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
-    targetUniform->dirty = true;
-
-    if (targetUniform->type != GL_FLOAT_MAT3)
-    {
-        return false;
-    }
-
-    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);
-
-    GLfloat *target = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 12;
-    for (int i = 0; i < count; i++)
-    {
-        transposeMatrix<GLfloat,4,3,3,3>(target, value);
-        target += 12;
-        value += 9;
-    }
-
-    return true;
-}
-
-
-bool ProgramBinary::setUniformMatrix4fv(GLint location, GLsizei count, const GLfloat *value)
-{
-    if (location < 0 || location >= (int)mUniformIndex.size())
-    {
-        return false;
-    }
-
-    Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
-    targetUniform->dirty = true;
-
-    if (targetUniform->type != GL_FLOAT_MAT4)
-    {
-        return false;
-    }
-
-    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);
-
-    GLfloat *target = (GLfloat*)(targetUniform->data + mUniformIndex[location].element * sizeof(GLfloat) * 16);
-    for (int i = 0; i < count; i++)
-    {
-        transposeMatrix<GLfloat,4,4,4,4>(target, value);
-        target += 16;
-        value += 16;
-    }
-
-    return true;
-}
-
-bool ProgramBinary::setUniform1iv(GLint location, GLsizei count, const GLint *v)
-{
-    if (location < 0 || location >= (int)mUniformIndex.size())
-    {
-        return false;
-    }
-
-    Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
-    targetUniform->dirty = true;
-
-    if (targetUniform->type == GL_INT ||
-        targetUniform->type == GL_SAMPLER_2D ||
-        targetUniform->type == GL_SAMPLER_CUBE)
-    {
-        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);
-
-        memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLint),
-               v, sizeof(GLint) * count);
-    }
-    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 = (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;
-            }
-        }
-    }
-    else
-    {
-        return false;
-    }
-
-    return true;
-}
-
-bool ProgramBinary::setUniform2iv(GLint location, GLsizei count, const GLint *v)
-{
-    if (location < 0 || location >= (int)mUniformIndex.size())
-    {
-        return false;
-    }
-
-    Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
-    targetUniform->dirty = true;
-
-    if (targetUniform->type == GL_INT_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);
-
-        memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLint) * 2,
-               v, 2 * sizeof(GLint) * count);
-    }
-    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 = (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;
-            }
-        }
-    }
-    else
-    {
-        return false;
-    }
-
-    return true;
-}
-
-bool ProgramBinary::setUniform3iv(GLint location, GLsizei count, const GLint *v)
-{
-    if (location < 0 || location >= (int)mUniformIndex.size())
-    {
-        return false;
-    }
-
-    Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
-    targetUniform->dirty = true;
-
-    if (targetUniform->type == GL_INT_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);
-
-        memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLint) * 3,
-               v, 3 * sizeof(GLint) * count);
-    }
-    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 = (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;
-            }
-        }
-    }
-    else
-    {
-        return false;
-    }
-
-    return true;
-}
-
-bool ProgramBinary::setUniform4iv(GLint location, GLsizei count, const GLint *v)
-{
-    if (location < 0 || location >= (int)mUniformIndex.size())
-    {
-        return false;
-    }
-
-    Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
-    targetUniform->dirty = true;
-
-    if (targetUniform->type == GL_INT_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);
-
-        memcpy(targetUniform->data + mUniformIndex[location].element * sizeof(GLint) * 4,
-               v, 4 * sizeof(GLint) * count);
-    }
-    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 = (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;
-            }
-        }
-    }
-    else
-    {
-        return false;
-    }
-
-    return true;
-}
-
-bool ProgramBinary::getUniformfv(GLint location, GLsizei *bufSize, GLfloat *params)
-{
-    if (location < 0 || location >= (int)mUniformIndex.size())
-    {
-        return false;
-    }
-
-    Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
-
-    // sized queries -- ensure the provided buffer is large enough
-    if (bufSize)
-    {
-        int requiredBytes = UniformExternalSize(targetUniform->type);
-        if (*bufSize < requiredBytes)
-        {
-            return false;
-        }
-    }
-
-    switch (targetUniform->type)
-    {
-      case GL_FLOAT_MAT2:
-        transposeMatrix<GLfloat,2,2,4,2>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 8);
-        break;
-      case GL_FLOAT_MAT3:
-        transposeMatrix<GLfloat,3,3,4,3>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 12);
-        break;
-      case GL_FLOAT_MAT4:
-        transposeMatrix<GLfloat,4,4,4,4>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 16);
-        break;
-      default:
-        {
-            unsigned int count = UniformExternalComponentCount(targetUniform->type);
-            unsigned int internalCount = UniformInternalComponentCount(targetUniform->type);
-
-            switch (UniformComponentType(targetUniform->type))
-            {
-              case GL_BOOL:
-                {
-                    GLboolean *boolParams = (GLboolean*)targetUniform->data + mUniformIndex[location].element * internalCount;
-
-                    for (unsigned int i = 0; i < count; ++i)
-                    {
-                        params[i] = (boolParams[i] == GL_FALSE) ? 0.0f : 1.0f;
-                    }
-                }
-                break;
-              case GL_FLOAT:
-                memcpy(params, targetUniform->data + mUniformIndex[location].element * internalCount * sizeof(GLfloat),
-                       count * sizeof(GLfloat));
-                break;
-              case GL_INT:
-                {
-                    GLint *intParams = (GLint*)targetUniform->data + mUniformIndex[location].element * internalCount;
-
-                    for (unsigned int i = 0; i < count; ++i)
-                    {
-                        params[i] = (float)intParams[i];
-                    }
-                }
-                break;
-              default: UNREACHABLE();
-            }
-        }
-    }
-
-    return true;
-}
-
-bool ProgramBinary::getUniformiv(GLint location, GLsizei *bufSize, GLint *params)
-{
-    if (location < 0 || location >= (int)mUniformIndex.size())
-    {
-        return false;
-    }
-
-    Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
-
-    // sized queries -- ensure the provided buffer is large enough
-    if (bufSize)
-    {
-        int requiredBytes = UniformExternalSize(targetUniform->type);
-        if (*bufSize < requiredBytes)
-        {
-            return false;
-        }
-    }
-
-    switch (targetUniform->type)
-    {
-      case GL_FLOAT_MAT2:
-        {
-            transposeMatrix<GLint,2,2,4,2>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 8);
-        }
-        break;
-      case GL_FLOAT_MAT3:
-        {
-            transposeMatrix<GLint,3,3,4,3>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 12);
-        }
-        break;
-      case GL_FLOAT_MAT4:
-        {
-            transposeMatrix<GLint,4,4,4,4>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 16);
-        }
-        break;
-      default:
-        {
-            unsigned int count = UniformExternalComponentCount(targetUniform->type);
-            unsigned int internalCount = UniformInternalComponentCount(targetUniform->type);
-
-            switch (UniformComponentType(targetUniform->type))
-            {
-              case GL_BOOL:
-                {
-                    GLboolean *boolParams = targetUniform->data + mUniformIndex[location].element * internalCount;
-
-                    for (unsigned int i = 0; i < count; ++i)
-                    {
-                        params[i] = (GLint)boolParams[i];
-                    }
-                }
-                break;
-              case GL_FLOAT:
-                {
-                    GLfloat *floatParams = (GLfloat*)targetUniform->data + mUniformIndex[location].element * internalCount;
-
-                    for (unsigned int i = 0; i < count; ++i)
-                    {
-                        params[i] = (GLint)floatParams[i];
-                    }
-                }
-                break;
-              case GL_INT:
-                memcpy(params, targetUniform->data + mUniformIndex[location].element * internalCount * sizeof(GLint),
-                       count * sizeof(GLint));
-                break;
-              default: UNREACHABLE();
-            }
-        }
-    }
-
-    return true;
-}
-
-void ProgramBinary::dirtyAllUniforms()
-{
-    unsigned int numUniforms = mUniforms.size();
-    for (unsigned int index = 0; index < numUniforms; index++)
-    {
-        mUniforms[index]->dirty = true;
-    }
-}
-
-// Applies all the uniforms set for this program object to the Direct3D 9 device
-void ProgramBinary::applyUniforms()
-{
-    for (std::vector<Uniform*>::iterator ub = mUniforms.begin(), ue = mUniforms.end(); ub != ue; ++ub) {
-        Uniform *targetUniform = *ub;
-
-        if (targetUniform->dirty)
-        {
-            int arraySize = targetUniform->arraySize;
-            GLfloat *f = (GLfloat*)targetUniform->data;
-            GLint *i = (GLint*)targetUniform->data;
-            GLboolean *b = (GLboolean*)targetUniform->data;
-
-            switch (targetUniform->type)
-            {
-              case GL_BOOL:       applyUniformnbv(targetUniform, arraySize, 1, b);    break;
-              case GL_BOOL_VEC2:  applyUniformnbv(targetUniform, arraySize, 2, b);    break;
-              case GL_BOOL_VEC3:  applyUniformnbv(targetUniform, arraySize, 3, b);    break;
-              case GL_BOOL_VEC4:  applyUniformnbv(targetUniform, arraySize, 4, b);    break;
-              case GL_FLOAT:
-              case GL_FLOAT_VEC2:
-              case GL_FLOAT_VEC3:
-              case GL_FLOAT_VEC4:
-              case GL_FLOAT_MAT2:
-              case GL_FLOAT_MAT3:
-              case GL_FLOAT_MAT4: applyUniformnfv(targetUniform, f);                  break;
-              case GL_SAMPLER_2D:
-              case GL_SAMPLER_CUBE:
-              case GL_INT:        applyUniform1iv(targetUniform, arraySize, i);       break;
-              case GL_INT_VEC2:   applyUniform2iv(targetUniform, arraySize, i);       break;
-              case GL_INT_VEC3:   applyUniform3iv(targetUniform, arraySize, i);       break;
-              case GL_INT_VEC4:   applyUniform4iv(targetUniform, arraySize, i);       break;
-              default:
-                UNREACHABLE();
-            }
-
-            targetUniform->dirty = false;
-        }
-    }
-}
-
-// Compiles the HLSL code of the attached shaders into executable binaries
-ID3D10Blob *ProgramBinary::compileToBinary(InfoLog &infoLog, const char *hlsl, const char *profile, ID3DXConstantTable **constantTable)
-{
-    if (!hlsl)
-    {
-        return NULL;
-    }
-
-    DWORD result;
-    UINT flags = 0;
-    std::string sourceText;
-    if (perfActive())
-    {
-        flags |= D3DCOMPILE_DEBUG;
-#ifdef NDEBUG
-        flags |= ANGLE_COMPILE_OPTIMIZATION_LEVEL;
-#else
-        flags |= D3DCOMPILE_SKIP_OPTIMIZATION;
-#endif
-
-        std::string sourcePath = getTempPath();
-        sourceText = std::string("#line 2 \"") + sourcePath + std::string("\"\n\n") + std::string(hlsl);
-        writeFile(sourcePath.c_str(), sourceText.c_str(), sourceText.size());
-    }
-    else
-    {
-        flags |= ANGLE_COMPILE_OPTIMIZATION_LEVEL;
-        sourceText = hlsl;
-    }
-
-    ID3D10Blob *binary = NULL;
-    ID3D10Blob *errorMessage = NULL;
-    result = D3DCompile(hlsl, strlen(hlsl), g_fakepath, NULL, NULL, "main", profile, flags, 0, &binary, &errorMessage);
-
-    if (errorMessage)
-    {
-        const char *message = (const char*)errorMessage->GetBufferPointer();
-
-        infoLog.appendSanitized(message);
-        TRACE("\n%s", hlsl);
-        TRACE("\n%s", message);
-
-        errorMessage->Release();
-        errorMessage = NULL;
-    }
-
-    if (FAILED(result))
-    {
-        if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
-        {
-            error(GL_OUT_OF_MEMORY);
-        }
-
-        return NULL;
-    }
-
-    result = D3DXGetShaderConstantTable(static_cast<const DWORD*>(binary->GetBufferPointer()), constantTable);
-
-    if (FAILED(result))
-    {
-        if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
-        {
-            error(GL_OUT_OF_MEMORY);
-        }
-
-        binary->Release();
-
-        return NULL;
-    }
-
-    return binary;
-}
-
-// Packs varyings into generic varying registers, using the algorithm from [OpenGL ES Shading Language 1.00 rev. 17] appendix A section 7 page 111
-// Returns the number of used varying registers, or -1 if unsuccesful
-int ProgramBinary::packVaryings(InfoLog &infoLog, const Varying *packing[][4], FragmentShader *fragmentShader)
-{
-    Context *context = getContext();
-    const int maxVaryingVectors = context->getMaximumVaryingVectors();
-
-    for (VaryingList::iterator varying = fragmentShader->mVaryings.begin(); varying != fragmentShader->mVaryings.end(); varying++)
-    {
-        int n = VariableRowCount(varying->type) * varying->size;
-        int m = VariableColumnCount(varying->type);
-        bool success = false;
-
-        if (m == 2 || m == 3 || m == 4)
-        {
-            for (int r = 0; r <= maxVaryingVectors - n && !success; r++)
-            {
-                bool available = true;
-
-                for (int y = 0; y < n && available; y++)
-                {
-                    for (int x = 0; x < m && available; x++)
-                    {
-                        if (packing[r + y][x])
-                        {
-                            available = false;
-                        }
-                    }
-                }
-
-                if (available)
-                {
-                    varying->reg = r;
-                    varying->col = 0;
-
-                    for (int y = 0; y < n; y++)
-                    {
-                        for (int x = 0; x < m; x++)
-                        {
-                            packing[r + y][x] = &*varying;
-                        }
-                    }
-
-                    success = true;
-                }
-            }
-
-            if (!success && m == 2)
-            {
-                for (int r = maxVaryingVectors - n; r >= 0 && !success; r--)
-                {
-                    bool available = true;
-
-                    for (int y = 0; y < n && available; y++)
-                    {
-                        for (int x = 2; x < 4 && available; x++)
-                        {
-                            if (packing[r + y][x])
-                            {
-                                available = false;
-                            }
-                        }
-                    }
-
-                    if (available)
-                    {
-                        varying->reg = r;
-                        varying->col = 2;
-
-                        for (int y = 0; y < n; y++)
-                        {
-                            for (int x = 2; x < 4; x++)
-                            {
-                                packing[r + y][x] = &*varying;
-                            }
-                        }
-
-                        success = true;
-                    }
-                }
-            }
-        }
-        else if (m == 1)
-        {
-            int space[4] = {0};
-
-            for (int y = 0; y < maxVaryingVectors; y++)
-            {
-                for (int x = 0; x < 4; x++)
-                {
-                    space[x] += packing[y][x] ? 0 : 1;
-                }
-            }
-
-            int column = 0;
-
-            for (int x = 0; x < 4; x++)
-            {
-                if (space[x] >= n && space[x] < space[column])
-                {
-                    column = x;
-                }
-            }
-
-            if (space[column] >= n)
-            {
-                for (int r = 0; r < maxVaryingVectors; r++)
-                {
-                    if (!packing[r][column])
-                    {
-                        varying->reg = r;
-
-                        for (int y = r; y < r + n; y++)
-                        {
-                            packing[y][column] = &*varying;
-                        }
-
-                        break;
-                    }
-                }
-
-                varying->col = column;
-
-                success = true;
-            }
-        }
-        else UNREACHABLE();
-
-        if (!success)
-        {
-            infoLog.append("Could not pack varying %s", varying->name.c_str());
-
-            return -1;
-        }
-    }
-
-    // Return the number of used registers
-    int registers = 0;
-
-    for (int r = 0; r < maxVaryingVectors; r++)
-    {
-        if (packing[r][0] || packing[r][1] || packing[r][2] || packing[r][3])
-        {
-            registers++;
-        }
-    }
-
-    return registers;
-}
-
-bool ProgramBinary::linkVaryings(InfoLog &infoLog, std::string& pixelHLSL, std::string& vertexHLSL, FragmentShader *fragmentShader, VertexShader *vertexShader)
-{
-    if (pixelHLSL.empty() || vertexHLSL.empty())
-    {
-        return false;
-    }
-
-    // Reset the varying register assignments
-    for (VaryingList::iterator fragVar = fragmentShader->mVaryings.begin(); fragVar != fragmentShader->mVaryings.end(); fragVar++)
-    {
-        fragVar->reg = -1;
-        fragVar->col = -1;
-    }
-
-    for (VaryingList::iterator vtxVar = vertexShader->mVaryings.begin(); vtxVar != vertexShader->mVaryings.end(); vtxVar++)
-    {
-        vtxVar->reg = -1;
-        vtxVar->col = -1;
-    }
-
-    // Map the varyings to the register file
-    const Varying *packing[MAX_VARYING_VECTORS_SM3][4] = {NULL};
-    int registers = packVaryings(infoLog, packing, fragmentShader);
-
-    if (registers < 0)
-    {
-        return false;
-    }
-
-    // Write the HLSL input/output declarations
-    Context *context = getContext();
-    const bool sm3 = context->supportsShaderModel3();
-    const int maxVaryingVectors = context->getMaximumVaryingVectors();
-
-    if (registers == maxVaryingVectors && fragmentShader->mUsesFragCoord)
-    {
-        infoLog.append("No varying registers left to support gl_FragCoord");
-
-        return false;
-    }
-
-    for (VaryingList::iterator input = fragmentShader->mVaryings.begin(); input != fragmentShader->mVaryings.end(); input++)
-    {
-        bool matched = false;
-
-        for (VaryingList::iterator output = vertexShader->mVaryings.begin(); output != vertexShader->mVaryings.end(); output++)
-        {
-            if (output->name == input->name)
-            {
-                if (output->type != input->type || output->size != input->size)
-                {
-                    infoLog.append("Type of vertex varying %s does not match that of the fragment varying", output->name.c_str());
-
-                    return false;
-                }
-
-                output->reg = input->reg;
-                output->col = input->col;
-
-                matched = true;
-                break;
-            }
-        }
-
-        if (!matched)
-        {
-            infoLog.append("Fragment varying %s does not match any vertex varying", input->name.c_str());
-
-            return false;
-        }
-    }
-
-    std::string varyingSemantic = (sm3 ? "COLOR" : "TEXCOORD");
-
-    vertexHLSL += "struct VS_INPUT\n"
-                   "{\n";
-
-    int semanticIndex = 0;
-    for (AttributeArray::iterator attribute = vertexShader->mAttributes.begin(); attribute != vertexShader->mAttributes.end(); attribute++)
-    {
-        switch (attribute->type)
-        {
-          case GL_FLOAT:      vertexHLSL += "    float ";    break;
-          case GL_FLOAT_VEC2: vertexHLSL += "    float2 ";   break;
-          case GL_FLOAT_VEC3: vertexHLSL += "    float3 ";   break;
-          case GL_FLOAT_VEC4: vertexHLSL += "    float4 ";   break;
-          case GL_FLOAT_MAT2: vertexHLSL += "    float2x2 "; break;
-          case GL_FLOAT_MAT3: vertexHLSL += "    float3x3 "; break;
-          case GL_FLOAT_MAT4: vertexHLSL += "    float4x4 "; break;
-          default:  UNREACHABLE();
-        }
-
-        vertexHLSL += decorateAttribute(attribute->name) + " : TEXCOORD" + str(semanticIndex) + ";\n";
-
-        semanticIndex += VariableRowCount(attribute->type);
-    }
-
-    vertexHLSL += "};\n"
-                   "\n"
-                   "struct VS_OUTPUT\n"
-                   "{\n"
-                   "    float4 gl_Position : POSITION;\n";
-
-    for (int r = 0; r < registers; r++)
-    {
-        int registerSize = packing[r][3] ? 4 : (packing[r][2] ? 3 : (packing[r][1] ? 2 : 1));
-
-        vertexHLSL += "    float" + str(registerSize) + " v" + str(r) + " : " + varyingSemantic + str(r) + ";\n";
-    }
-
-    if (fragmentShader->mUsesFragCoord)
-    {
-        vertexHLSL += "    float4 gl_FragCoord : " + varyingSemantic + str(registers) + ";\n";
-    }
-
-    if (vertexShader->mUsesPointSize && sm3)
-    {
-        vertexHLSL += "    float gl_PointSize : PSIZE;\n";
-    }
-
-    vertexHLSL += "};\n"
-                   "\n"
-                   "VS_OUTPUT main(VS_INPUT input)\n"
-                   "{\n";
-
-    for (AttributeArray::iterator attribute = vertexShader->mAttributes.begin(); attribute != vertexShader->mAttributes.end(); attribute++)
-    {
-        vertexHLSL += "    " + decorateAttribute(attribute->name) + " = ";
-
-        if (VariableRowCount(attribute->type) > 1)   // Matrix
-        {
-            vertexHLSL += "transpose";
-        }
-
-        vertexHLSL += "(input." + decorateAttribute(attribute->name) + ");\n";
-    }
-
-    vertexHLSL += "\n"
-                   "    gl_main();\n"
-                   "\n"
-                   "    VS_OUTPUT output;\n"
-                   "    output.gl_Position.x = gl_Position.x - dx_HalfPixelSize.x * gl_Position.w;\n"
-                   "    output.gl_Position.y = -(gl_Position.y + dx_HalfPixelSize.y * gl_Position.w);\n"
-                   "    output.gl_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n"
-                   "    output.gl_Position.w = gl_Position.w;\n";
-
-    if (vertexShader->mUsesPointSize && sm3)
-    {
-        vertexHLSL += "    output.gl_PointSize = clamp(gl_PointSize, 1.0, " + str((int)ALIASED_POINT_SIZE_RANGE_MAX_SM3) + ");\n";
-    }
-
-    if (fragmentShader->mUsesFragCoord)
-    {
-        vertexHLSL += "    output.gl_FragCoord = gl_Position;\n";
-    }
-
-    for (VaryingList::iterator varying = vertexShader->mVaryings.begin(); varying != vertexShader->mVaryings.end(); varying++)
-    {
-        if (varying->reg >= 0)
-        {
-            for (int i = 0; i < varying->size; i++)
-            {
-                int rows = VariableRowCount(varying->type);
-
-                for (int j = 0; j < rows; j++)
-                {
-                    int r = varying->reg + i * rows + j;
-                    vertexHLSL += "    output.v" + str(r);
-
-                    bool sharedRegister = false;   // Register used by multiple varyings
-                    
-                    for (int x = 0; x < 4; x++)
-                    {
-                        if (packing[r][x] && packing[r][x] != packing[r][0])
-                        {
-                            sharedRegister = true;
-                            break;
-                        }
-                    }
-
-                    if(sharedRegister)
-                    {
-                        vertexHLSL += ".";
-
-                        for (int x = 0; x < 4; x++)
-                        {
-                            if (packing[r][x] == &*varying)
-                            {
-                                switch(x)
-                                {
-                                  case 0: vertexHLSL += "x"; break;
-                                  case 1: vertexHLSL += "y"; break;
-                                  case 2: vertexHLSL += "z"; break;
-                                  case 3: vertexHLSL += "w"; break;
-                                }
-                            }
-                        }
-                    }
-
-                    vertexHLSL += " = " + varying->name;
-                    
-                    if (varying->array)
-                    {
-                        vertexHLSL += "[" + str(i) + "]";
-                    }
-
-                    if (rows > 1)
-                    {
-                        vertexHLSL += "[" + str(j) + "]";
-                    }
-                    
-                    vertexHLSL += ";\n";
-                }
-            }
-        }
-    }
-
-    vertexHLSL += "\n"
-                   "    return output;\n"
-                   "}\n";
-
-    pixelHLSL += "struct PS_INPUT\n"
-                  "{\n";
-    
-    for (VaryingList::iterator varying = fragmentShader->mVaryings.begin(); varying != fragmentShader->mVaryings.end(); varying++)
-    {
-        if (varying->reg >= 0)
-        {
-            for (int i = 0; i < varying->size; i++)
-            {
-                int rows = VariableRowCount(varying->type);
-                for (int j = 0; j < rows; j++)
-                {
-                    std::string n = str(varying->reg + i * rows + j);
-                    pixelHLSL += "    float4 v" + n + " : " + varyingSemantic + n + ";\n";
-                }
-            }
-        }
-        else UNREACHABLE();
-    }
-
-    if (fragmentShader->mUsesFragCoord)
-    {
-        pixelHLSL += "    float4 gl_FragCoord : " + varyingSemantic + str(registers) + ";\n";
-        if (sm3) {
-            pixelHLSL += "    float2 dx_VPos : VPOS;\n";
-        }
-    }
-
-    if (fragmentShader->mUsesPointCoord && sm3)
-    {
-        pixelHLSL += "    float2 gl_PointCoord : TEXCOORD0;\n";
-    }
-
-    if (fragmentShader->mUsesFrontFacing)
-    {
-        pixelHLSL += "    float vFace : VFACE;\n";
-    }
-
-    pixelHLSL += "};\n"
-                  "\n"
-                  "struct PS_OUTPUT\n"
-                  "{\n"
-                  "    float4 gl_Color[1] : COLOR;\n"
-                  "};\n"
-                  "\n"
-                  "PS_OUTPUT main(PS_INPUT input)\n"
-                  "{\n";
-
-    if (fragmentShader->mUsesFragCoord)
-    {
-        pixelHLSL += "    float rhw = 1.0 / input.gl_FragCoord.w;\n";
-        
-        if (sm3)
-        {
-            pixelHLSL += "    gl_FragCoord.x = input.dx_VPos.x + 0.5;\n"
-                          "    gl_FragCoord.y = input.dx_VPos.y + 0.5;\n";
-        }
-        else
-        {
-            // dx_Coord contains the viewport width/2, height/2, center.x and center.y. See Context::applyRenderTarget()
-            pixelHLSL += "    gl_FragCoord.x = (input.gl_FragCoord.x * rhw) * dx_Coord.x + dx_Coord.z;\n"
-                          "    gl_FragCoord.y = (input.gl_FragCoord.y * rhw) * dx_Coord.y + dx_Coord.w;\n";
-        }
-        
-        pixelHLSL += "    gl_FragCoord.z = (input.gl_FragCoord.z * rhw) * dx_Depth.x + dx_Depth.y;\n"
-                      "    gl_FragCoord.w = rhw;\n";
-    }
-
-    if (fragmentShader->mUsesPointCoord && sm3)
-    {
-        pixelHLSL += "    gl_PointCoord.x = input.gl_PointCoord.x;\n";
-        pixelHLSL += "    gl_PointCoord.y = 1.0 - input.gl_PointCoord.y;\n";
-    }
-
-    if (fragmentShader->mUsesFrontFacing)
-    {
-        pixelHLSL += "    gl_FrontFacing = dx_PointsOrLines || (dx_FrontCCW ? (input.vFace >= 0.0) : (input.vFace <= 0.0));\n";
-    }
-
-    for (VaryingList::iterator varying = fragmentShader->mVaryings.begin(); varying != fragmentShader->mVaryings.end(); varying++)
-    {
-        if (varying->reg >= 0)
-        {
-            for (int i = 0; i < varying->size; i++)
-            {
-                int rows = VariableRowCount(varying->type);
-                for (int j = 0; j < rows; j++)
-                {
-                    std::string n = str(varying->reg + i * rows + j);
-                    pixelHLSL += "    " + varying->name;
-
-                    if (varying->array)
-                    {
-                        pixelHLSL += "[" + str(i) + "]";
-                    }
-
-                    if (rows > 1)
-                    {
-                        pixelHLSL += "[" + str(j) + "]";
-                    }
-
-                    pixelHLSL += " = input.v" + n + ";\n";
-                }
-            }
-        }
-        else UNREACHABLE();
-    }
-
-    pixelHLSL += "\n"
-                  "    gl_main();\n"
-                  "\n"
-                  "    PS_OUTPUT output;\n"                 
-                  "    output.gl_Color[0] = gl_Color[0];\n"
-                  "\n"
-                  "    return output;\n"
-                  "}\n";
-
-    return true;
-}
-
-bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader)
-{
-    if (!fragmentShader || !fragmentShader->isCompiled())
-    {
-        return false;
-    }
-
-    if (!vertexShader || !vertexShader->isCompiled())
-    {
-        return false;
-    }
-
-    std::string pixelHLSL = fragmentShader->getHLSL();
-    std::string vertexHLSL = vertexShader->getHLSL();
-
-    if (!linkVaryings(infoLog, pixelHLSL, vertexHLSL, fragmentShader, vertexShader))
-    {
-        return false;
-    }
-
-    Context *context = getContext();
-    const char *vertexProfile = context->supportsShaderModel3() ? "vs_3_0" : "vs_2_0";
-    const char *pixelProfile = context->supportsShaderModel3() ? "ps_3_0" : "ps_2_0";
-
-    ID3D10Blob *vertexBinary = compileToBinary(infoLog, vertexHLSL.c_str(), vertexProfile, &mConstantTableVS);
-    ID3D10Blob *pixelBinary = compileToBinary(infoLog, pixelHLSL.c_str(), pixelProfile, &mConstantTablePS);
-
-    if (vertexBinary && pixelBinary)
-    {
-        HRESULT vertexResult = mDevice->CreateVertexShader((DWORD*)vertexBinary->GetBufferPointer(), &mVertexExecutable);
-        HRESULT pixelResult = mDevice->CreatePixelShader((DWORD*)pixelBinary->GetBufferPointer(), &mPixelExecutable);
-
-        if (vertexResult == D3DERR_OUTOFVIDEOMEMORY || vertexResult == E_OUTOFMEMORY || pixelResult == D3DERR_OUTOFVIDEOMEMORY || pixelResult == E_OUTOFMEMORY)
-        {
-            return error(GL_OUT_OF_MEMORY, false);
-        }
-
-        ASSERT(SUCCEEDED(vertexResult) && SUCCEEDED(pixelResult));
-
-        vertexBinary->Release();
-        pixelBinary->Release();
-        vertexBinary = NULL;
-        pixelBinary = NULL;
-
-        if (mVertexExecutable && mPixelExecutable)
-        {
-            if (!linkAttributes(infoLog, attributeBindings, fragmentShader, vertexShader))
-            {
-                return false;
-            }
-
-            if (!linkUniforms(infoLog, GL_FRAGMENT_SHADER, mConstantTablePS))
-            {
-                return false;
-            }
-
-            if (!linkUniforms(infoLog, GL_VERTEX_SHADER, mConstantTableVS))
-            {
-                return false;
-            }
-
-            // these uniforms are searched as already-decorated because gl_ and dx_
-            // are reserved prefixes, and do not receive additional decoration
-            mDxDepthRangeLocation = getUniformLocation("dx_DepthRange");
-            mDxDepthLocation = getUniformLocation("dx_Depth");
-            mDxCoordLocation = getUniformLocation("dx_Coord");
-            mDxHalfPixelSizeLocation = getUniformLocation("dx_HalfPixelSize");
-            mDxFrontCCWLocation = getUniformLocation("dx_FrontCCW");
-            mDxPointsOrLinesLocation = getUniformLocation("dx_PointsOrLines");
-
-            context->markDxUniformsDirty();
-
-            return true;
-        }
-    }
-
-    return false;
-}
-
-// Determines the mapping between GL attributes and Direct3D 9 vertex stream usage indices
-bool ProgramBinary::linkAttributes(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader)
-{
-    unsigned int usedLocations = 0;
-
-    // Link attributes that have a binding location
-    for (AttributeArray::iterator attribute = vertexShader->mAttributes.begin(); attribute != vertexShader->mAttributes.end(); attribute++)
-    {
-        int location = attributeBindings.getAttributeBinding(attribute->name);
-
-        if (location != -1)   // Set by glBindAttribLocation
-        {
-            if (!mLinkedAttribute[location].name.empty())
-            {
-                // Multiple active attributes bound to the same location; not an error
-            }
-
-            mLinkedAttribute[location] = *attribute;
-
-            int rows = VariableRowCount(attribute->type);
-
-            if (rows + location > MAX_VERTEX_ATTRIBS)
-            {
-                infoLog.append("Active attribute (%s) at location %d is too big to fit", attribute->name.c_str(), location);
-
-                return false;
-            }
-
-            for (int i = 0; i < rows; i++)
-            {
-                usedLocations |= 1 << (location + i);
-            }
-        }
-    }
-
-    // Link attributes that don't have a binding location
-    for (AttributeArray::iterator attribute = vertexShader->mAttributes.begin(); attribute != vertexShader->mAttributes.end(); attribute++)
-    {
-        int location = attributeBindings.getAttributeBinding(attribute->name);
-
-        if (location == -1)   // Not set by glBindAttribLocation
-        {
-            int rows = VariableRowCount(attribute->type);
-            int availableIndex = AllocateFirstFreeBits(&usedLocations, rows, MAX_VERTEX_ATTRIBS);
-
-            if (availableIndex == -1 || availableIndex + rows > MAX_VERTEX_ATTRIBS)
-            {
-                infoLog.append("Too many active attributes (%s)", attribute->name.c_str());
-
-                return false;   // Fail to link
-            }
-
-            mLinkedAttribute[availableIndex] = *attribute;
-        }
-    }
-
-    for (int attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; )
-    {
-        int index = vertexShader->getSemanticIndex(mLinkedAttribute[attributeIndex].name);
-        int rows = std::max(VariableRowCount(mLinkedAttribute[attributeIndex].type), 1);
-
-        for (int r = 0; r < rows; r++)
-        {
-            mSemanticIndex[attributeIndex++] = index++;
-        }
-    }
-
-    return true;
-}
-
-bool ProgramBinary::linkUniforms(InfoLog &infoLog, GLenum shader, ID3DXConstantTable *constantTable)
-{
-    D3DXCONSTANTTABLE_DESC constantTableDescription;
-
-    constantTable->GetDesc(&constantTableDescription);
-
-    for (unsigned int constantIndex = 0; constantIndex < constantTableDescription.Constants; constantIndex++)
-    {
-        D3DXHANDLE constantHandle = constantTable->GetConstant(0, constantIndex);
-
-        D3DXCONSTANT_DESC constantDescription;
-        UINT descriptionCount = 1;
-        HRESULT result = constantTable->GetConstantDesc(constantHandle, &constantDescription, &descriptionCount);
-        ASSERT(SUCCEEDED(result));
-
-        if (!defineUniform(infoLog, shader, constantHandle, constantDescription))
-        {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-// Adds the description of a constant found in the binary shader to the list of uniforms
-// Returns true if succesful (uniform not already defined)
-bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const D3DXHANDLE &constantHandle, const D3DXCONSTANT_DESC &constantDescription, std::string name)
-{
-    if (constantDescription.RegisterSet == D3DXRS_SAMPLER)
-    {
-        for (unsigned int i = 0; i < constantDescription.RegisterCount; i++)
-        {
-            D3DXHANDLE psConstant = mConstantTablePS->GetConstantByName(NULL, constantDescription.Name);
-            D3DXHANDLE vsConstant = mConstantTableVS->GetConstantByName(NULL, constantDescription.Name);
-
-            if (psConstant)
-            {
-                unsigned int samplerIndex = mConstantTablePS->GetSamplerIndex(psConstant) + i;
-
-                if (samplerIndex < MAX_TEXTURE_IMAGE_UNITS)
-                {
-                    mSamplersPS[samplerIndex].active = true;
-                    mSamplersPS[samplerIndex].textureType = (constantDescription.Type == D3DXPT_SAMPLERCUBE) ? TEXTURE_CUBE : TEXTURE_2D;
-                    mSamplersPS[samplerIndex].logicalTextureUnit = 0;
-                    mUsedPixelSamplerRange = std::max(samplerIndex + 1, mUsedPixelSamplerRange);
-                }
-                else
-                {
-                    infoLog.append("Pixel shader sampler count exceeds MAX_TEXTURE_IMAGE_UNITS (%d).", MAX_TEXTURE_IMAGE_UNITS);
-                    return false;
-                }
-            }
-            
-            if (vsConstant)
-            {
-                unsigned int samplerIndex = mConstantTableVS->GetSamplerIndex(vsConstant) + i;
-
-                if (samplerIndex < getContext()->getMaximumVertexTextureImageUnits())
-                {
-                    mSamplersVS[samplerIndex].active = true;
-                    mSamplersVS[samplerIndex].textureType = (constantDescription.Type == D3DXPT_SAMPLERCUBE) ? TEXTURE_CUBE : TEXTURE_2D;
-                    mSamplersVS[samplerIndex].logicalTextureUnit = 0;
-                    mUsedVertexSamplerRange = std::max(samplerIndex + 1, mUsedVertexSamplerRange);
-                }
-                else
-                {
-                    infoLog.append("Vertex shader sampler count exceeds MAX_VERTEX_TEXTURE_IMAGE_UNITS (%d).", getContext()->getMaximumVertexTextureImageUnits());
-                    return false;
-                }
-            }
-        }
-    }
-
-    switch(constantDescription.Class)
-    {
-      case D3DXPC_STRUCT:
-        {
-            for (unsigned int arrayIndex = 0; arrayIndex < constantDescription.Elements; arrayIndex++)
-            {
-                for (unsigned int field = 0; field < constantDescription.StructMembers; field++)
-                {
-                    D3DXHANDLE fieldHandle = mConstantTablePS->GetConstant(constantHandle, field);
-
-                    D3DXCONSTANT_DESC fieldDescription;
-                    UINT descriptionCount = 1;
-
-                    HRESULT result = mConstantTablePS->GetConstantDesc(fieldHandle, &fieldDescription, &descriptionCount);
-                    ASSERT(SUCCEEDED(result));
-
-                    std::string structIndex = (constantDescription.Elements > 1) ? ("[" + str(arrayIndex) + "]") : "";
-
-                    if (!defineUniform(infoLog, shader, fieldHandle, fieldDescription, name + constantDescription.Name + structIndex + "."))
-                    {
-                        return false;
-                    }
-                }
-            }
-
-            return true;
-        }
-      case D3DXPC_SCALAR:
-      case D3DXPC_VECTOR:
-      case D3DXPC_MATRIX_COLUMNS:
-      case D3DXPC_OBJECT:
-        return defineUniform(shader, constantDescription, name + constantDescription.Name);
-      default:
-        UNREACHABLE();
-        return false;
-    }
-}
-
-bool ProgramBinary::defineUniform(GLenum shader, const D3DXCONSTANT_DESC &constantDescription, const std::string &_name)
-{
-    Uniform *uniform = createUniform(constantDescription, _name);
-
-    if(!uniform)
-    {
-        return false;
-    }
-
-    // Check if already defined
-    GLint location = getUniformLocation(uniform->name);
-    GLenum type = uniform->type;
-
-    if (location >= 0)
-    {
-        delete uniform;
-        uniform = mUniforms[mUniformIndex[location].index];
-    }
-
-    if (shader == GL_FRAGMENT_SHADER) uniform->ps.set(constantDescription);
-    if (shader == GL_VERTEX_SHADER)   uniform->vs.set(constantDescription);
-
-    if (location >= 0)
-    {
-        return uniform->type == type;
-    }
-
-    mUniforms.push_back(uniform);
-    unsigned int uniformIndex = mUniforms.size() - 1;
-
-    for (unsigned int i = 0; i < uniform->arraySize; ++i)
-    {
-        mUniformIndex.push_back(UniformLocation(_name, i, uniformIndex));
-    }
-
-    return true;
-}
-
-Uniform *ProgramBinary::createUniform(const D3DXCONSTANT_DESC &constantDescription, const std::string &_name)
-{
-    if (constantDescription.Rows == 1)   // Vectors and scalars
-    {
-        switch (constantDescription.Type)
-        {
-          case D3DXPT_SAMPLER2D:
-            switch (constantDescription.Columns)
-            {
-              case 1: return new Uniform(GL_SAMPLER_2D, _name, constantDescription.Elements);
-              default: UNREACHABLE();
-            }
-            break;
-          case D3DXPT_SAMPLERCUBE:
-            switch (constantDescription.Columns)
-            {
-              case 1: return new Uniform(GL_SAMPLER_CUBE, _name, constantDescription.Elements);
-              default: UNREACHABLE();
-            }
-            break;
-          case D3DXPT_BOOL:
-            switch (constantDescription.Columns)
-            {
-              case 1: return new Uniform(GL_BOOL, _name, constantDescription.Elements);
-              case 2: return new Uniform(GL_BOOL_VEC2, _name, constantDescription.Elements);
-              case 3: return new Uniform(GL_BOOL_VEC3, _name, constantDescription.Elements);
-              case 4: return new Uniform(GL_BOOL_VEC4, _name, constantDescription.Elements);
-              default: UNREACHABLE();
-            }
-            break;
-          case D3DXPT_INT:
-            switch (constantDescription.Columns)
-            {
-              case 1: return new Uniform(GL_INT, _name, constantDescription.Elements);
-              case 2: return new Uniform(GL_INT_VEC2, _name, constantDescription.Elements);
-              case 3: return new Uniform(GL_INT_VEC3, _name, constantDescription.Elements);
-              case 4: return new Uniform(GL_INT_VEC4, _name, constantDescription.Elements);
-              default: UNREACHABLE();
-            }
-            break;
-          case D3DXPT_FLOAT:
-            switch (constantDescription.Columns)
-            {
-              case 1: return new Uniform(GL_FLOAT, _name, constantDescription.Elements);
-              case 2: return new Uniform(GL_FLOAT_VEC2, _name, constantDescription.Elements);
-              case 3: return new Uniform(GL_FLOAT_VEC3, _name, constantDescription.Elements);
-              case 4: return new Uniform(GL_FLOAT_VEC4, _name, constantDescription.Elements);
-              default: UNREACHABLE();
-            }
-            break;
-          default:
-            UNREACHABLE();
-        }
-    }
-    else if (constantDescription.Rows == constantDescription.Columns)  // Square matrices
-    {
-        switch (constantDescription.Type)
-        {
-          case D3DXPT_FLOAT:
-            switch (constantDescription.Rows)
-            {
-              case 2: return new Uniform(GL_FLOAT_MAT2, _name, constantDescription.Elements);
-              case 3: return new Uniform(GL_FLOAT_MAT3, _name, constantDescription.Elements);
-              case 4: return new Uniform(GL_FLOAT_MAT4, _name, constantDescription.Elements);
-              default: UNREACHABLE();
-            }
-            break;
-          default: UNREACHABLE();
-        }
-    }
-    else UNREACHABLE();
-
-    return 0;
-}
-
-// This method needs to match OutputHLSL::decorate
-std::string ProgramBinary::decorateAttribute(const std::string &name)
-{
-    if (name.compare(0, 3, "gl_") != 0 && name.compare(0, 3, "dx_") != 0)
-    {
-        return "_" + name;
-    }
-    
-    return name;
-}
-
-std::string ProgramBinary::undecorateUniform(const std::string &_name)
-{
-    std::string name = _name;
-    
-    // Remove any structure field decoration
-    size_t pos = 0;
-    while ((pos = name.find("._", pos)) != std::string::npos)
-    {
-        name.replace(pos, 2, ".");
-    }
-
-    // Remove the leading decoration
-    if (name[0] == '_')
-    {
-        return name.substr(1);
-    }
-    else if (name.compare(0, 3, "ar_") == 0)
-    {
-        return name.substr(3);
-    }
-    
-    return name;
-}
-
-void ProgramBinary::applyUniformnbv(Uniform *targetUniform, GLsizei count, int width, const GLboolean *v)
-{
-    float vector[D3D9_MAX_FLOAT_CONSTANTS * 4];
-    BOOL boolVector[D3D9_MAX_BOOL_CONSTANTS];
-
-    if (targetUniform->ps.float4Index >= 0 || targetUniform->vs.float4Index >= 0)
-    {
-        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;
-                }
-                else
-                {
-                    vector[i * 4 + j] = 0.0f;
-                }
-            }
-        }
-    }
-
-    if (targetUniform->ps.boolIndex >= 0 || targetUniform->vs.boolIndex >= 0)
-    {
-        int psCount = targetUniform->ps.boolIndex >= 0 ? targetUniform->ps.registerCount : 0;
-        int vsCount = targetUniform->vs.boolIndex >= 0 ? 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.float4Index >= 0)
-    {
-        mDevice->SetPixelShaderConstantF(targetUniform->ps.float4Index, vector, targetUniform->ps.registerCount);
-    }
-        
-    if (targetUniform->ps.boolIndex >= 0)
-    {
-        mDevice->SetPixelShaderConstantB(targetUniform->ps.boolIndex, boolVector, targetUniform->ps.registerCount);
-    }
-    
-    if (targetUniform->vs.float4Index >= 0)
-    {
-        mDevice->SetVertexShaderConstantF(targetUniform->vs.float4Index, vector, targetUniform->vs.registerCount);
-    }
-        
-    if (targetUniform->vs.boolIndex >= 0)
-    {
-        mDevice->SetVertexShaderConstantB(targetUniform->vs.boolIndex, boolVector, targetUniform->vs.registerCount);
-    }
-}
-
-bool ProgramBinary::applyUniformnfv(Uniform *targetUniform, const GLfloat *v)
-{
-    if (targetUniform->ps.registerCount)
-    {
-        mDevice->SetPixelShaderConstantF(targetUniform->ps.float4Index, v, targetUniform->ps.registerCount);
-    }
-
-    if (targetUniform->vs.registerCount)
-    {
-        mDevice->SetVertexShaderConstantF(targetUniform->vs.float4Index, v, targetUniform->vs.registerCount);
-    }
-
-    return true;
-}
-
-bool ProgramBinary::applyUniform1iv(Uniform *targetUniform, GLsizei count, const GLint *v)
-{
-    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)
-    {
-        if (targetUniform->ps.samplerIndex >= 0)
-        {
-            unsigned int firstIndex = targetUniform->ps.samplerIndex;
-
-            for (int i = 0; i < count; i++)
-            {
-                unsigned int samplerIndex = firstIndex + i;
-
-                if (samplerIndex < MAX_TEXTURE_IMAGE_UNITS)
-                {
-                    ASSERT(mSamplersPS[samplerIndex].active);
-                    mSamplersPS[samplerIndex].logicalTextureUnit = v[i];
-                }
-            }
-        }
-        else
-        {
-            ASSERT(targetUniform->ps.float4Index >= 0);
-            mDevice->SetPixelShaderConstantF(targetUniform->ps.float4Index, (const float*)vector, targetUniform->ps.registerCount);
-        }
-    }
-
-    if (targetUniform->vs.registerCount)
-    {
-        if (targetUniform->vs.samplerIndex >= 0)
-        {
-            unsigned int firstIndex = targetUniform->vs.samplerIndex;
-
-            for (int i = 0; i < count; i++)
-            {
-                unsigned int samplerIndex = firstIndex + i;
-
-                if (samplerIndex < MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF)
-                {
-                    ASSERT(mSamplersVS[samplerIndex].active);
-                    mSamplersVS[samplerIndex].logicalTextureUnit = v[i];
-                }
-            }
-        }
-        else
-        {
-            ASSERT(targetUniform->vs.float4Index >= 0);
-            mDevice->SetVertexShaderConstantF(targetUniform->vs.float4Index, (const float *)vector, targetUniform->vs.registerCount);
-        }
-    }
-
-    return true;
-}
-
-bool ProgramBinary::applyUniform2iv(Uniform *targetUniform, GLsizei count, const GLint *v)
-{
-    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);
-
-    return true;
-}
-
-bool ProgramBinary::applyUniform3iv(Uniform *targetUniform, GLsizei count, const GLint *v)
-{
-    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);
-
-    return true;
-}
-
-bool ProgramBinary::applyUniform4iv(Uniform *targetUniform, GLsizei count, const GLint *v)
-{
-    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);
-
-    return true;
-}
-
-void ProgramBinary::applyUniformniv(Uniform *targetUniform, GLsizei count, const D3DXVECTOR4 *vector)
-{
-    if (targetUniform->ps.registerCount)
-    {
-        ASSERT(targetUniform->ps.float4Index >= 0);
-        mDevice->SetPixelShaderConstantF(targetUniform->ps.float4Index, (const float *)vector, targetUniform->ps.registerCount);
-    }
-
-    if (targetUniform->vs.registerCount)
-    {
-        ASSERT(targetUniform->vs.float4Index >= 0);
-        mDevice->SetVertexShaderConstantF(targetUniform->vs.float4Index, (const float *)vector, targetUniform->vs.registerCount);
-    }
-}
-
-bool ProgramBinary::isValidated() const 
-{
-    return mValidated;
-}
-
-void ProgramBinary::getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
-    // Skip over inactive attributes
-    unsigned int activeAttribute = 0;
-    unsigned int attribute;
-    for (attribute = 0; attribute < MAX_VERTEX_ATTRIBS; attribute++)
-    {
-        if (mLinkedAttribute[attribute].name.empty())
-        {
-            continue;
-        }
-
-        if (activeAttribute == index)
-        {
-            break;
-        }
-
-        activeAttribute++;
-    }
-
-    if (bufsize > 0)
-    {
-        const char *string = mLinkedAttribute[attribute].name.c_str();
-
-        strncpy(name, string, bufsize);
-        name[bufsize - 1] = '\0';
-
-        if (length)
-        {
-            *length = strlen(name);
-        }
-    }
-
-    *size = 1;   // Always a single 'type' instance
-
-    *type = mLinkedAttribute[attribute].type;
-}
-
-GLint ProgramBinary::getActiveAttributeCount()
-{
-    int count = 0;
-
-    for (int attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; attributeIndex++)
-    {
-        if (!mLinkedAttribute[attributeIndex].name.empty())
-        {
-            count++;
-        }
-    }
-
-    return count;
-}
-
-GLint ProgramBinary::getActiveAttributeMaxLength()
-{
-    int maxLength = 0;
-
-    for (int attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; attributeIndex++)
-    {
-        if (!mLinkedAttribute[attributeIndex].name.empty())
-        {
-            maxLength = std::max((int)(mLinkedAttribute[attributeIndex].name.length() + 1), maxLength);
-        }
-    }
-
-    return maxLength;
-}
-
-void ProgramBinary::getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
-    // Skip over internal uniforms
-    unsigned int activeUniform = 0;
-    unsigned int uniform;
-    for (uniform = 0; uniform < mUniforms.size(); uniform++)
-    {
-        if (mUniforms[uniform]->name.compare(0, 3, "dx_") == 0)
-        {
-            continue;
-        }
-
-        if (activeUniform == index)
-        {
-            break;
-        }
-
-        activeUniform++;
-    }
-
-    ASSERT(uniform < mUniforms.size());   // index must be smaller than getActiveUniformCount()
-
-    if (bufsize > 0)
-    {
-        std::string string = mUniforms[uniform]->name;
-
-        if (mUniforms[uniform]->isArray())
-        {
-            string += "[0]";
-        }
-
-        strncpy(name, string.c_str(), bufsize);
-        name[bufsize - 1] = '\0';
-
-        if (length)
-        {
-            *length = strlen(name);
-        }
-    }
-
-    *size = mUniforms[uniform]->arraySize;
-
-    *type = mUniforms[uniform]->type;
-}
-
-GLint ProgramBinary::getActiveUniformCount()
-{
-    int count = 0;
-
-    unsigned int numUniforms = mUniforms.size();
-    for (unsigned int uniformIndex = 0; uniformIndex < numUniforms; uniformIndex++)
-    {
-        if (mUniforms[uniformIndex]->name.compare(0, 3, "dx_") != 0)
-        {
-            count++;
-        }
-    }
-
-    return count;
-}
-
-GLint ProgramBinary::getActiveUniformMaxLength()
-{
-    int maxLength = 0;
-
-    unsigned int numUniforms = mUniforms.size();
-    for (unsigned int uniformIndex = 0; uniformIndex < numUniforms; uniformIndex++)
-    {
-        if (!mUniforms[uniformIndex]->name.empty() && mUniforms[uniformIndex]->name.compare(0, 3, "dx_") != 0)
-        {
-            int length = (int)(mUniforms[uniformIndex]->name.length() + 1);
-            if (mUniforms[uniformIndex]->isArray())
-            {
-                length += 3;  // Counting in "[0]".
-            }
-            maxLength = std::max(length, maxLength);
-        }
-    }
-
-    return maxLength;
-}
-
-void ProgramBinary::validate(InfoLog &infoLog)
-{
-    applyUniforms();
-    if (!validateSamplers(&infoLog))
-    {
-        mValidated = false;
-    }
-    else
-    {
-        mValidated = true;
-    }
-}
-
-bool ProgramBinary::validateSamplers(InfoLog *infoLog)
-{
-    // if any two active samplers in a program are of different types, but refer to the same
-    // texture image unit, and this is the current program, then ValidateProgram will fail, and
-    // DrawArrays and DrawElements will issue the INVALID_OPERATION error.
-
-    const unsigned int maxCombinedTextureImageUnits = getContext()->getMaximumCombinedTextureImageUnits();
-    TextureType textureUnitType[MAX_COMBINED_TEXTURE_IMAGE_UNITS_VTF];
-
-    for (unsigned int i = 0; i < MAX_COMBINED_TEXTURE_IMAGE_UNITS_VTF; ++i)
-    {
-        textureUnitType[i] = TEXTURE_UNKNOWN;
-    }
-
-    for (unsigned int i = 0; i < mUsedPixelSamplerRange; ++i)
-    {
-        if (mSamplersPS[i].active)
-        {
-            unsigned int unit = mSamplersPS[i].logicalTextureUnit;
-            
-            if (unit >= maxCombinedTextureImageUnits)
-            {
-                if (infoLog)
-                {
-                    infoLog->append("Sampler uniform (%d) exceeds MAX_COMBINED_TEXTURE_IMAGE_UNITS (%d)", unit, maxCombinedTextureImageUnits);
-                }
-
-                return false;
-            }
-
-            if (textureUnitType[unit] != TEXTURE_UNKNOWN)
-            {
-                if (mSamplersPS[i].textureType != textureUnitType[unit])
-                {
-                    if (infoLog)
-                    {
-                        infoLog->append("Samplers of conflicting types refer to the same texture image unit (%d).", unit);
-                    }
-
-                    return false;
-                }
-            }
-            else
-            {
-                textureUnitType[unit] = mSamplersPS[i].textureType;
-            }
-        }
-    }
-
-    for (unsigned int i = 0; i < mUsedVertexSamplerRange; ++i)
-    {
-        if (mSamplersVS[i].active)
-        {
-            unsigned int unit = mSamplersVS[i].logicalTextureUnit;
-            
-            if (unit >= maxCombinedTextureImageUnits)
-            {
-                if (infoLog)
-                {
-                    infoLog->append("Sampler uniform (%d) exceeds MAX_COMBINED_TEXTURE_IMAGE_UNITS (%d)", unit, maxCombinedTextureImageUnits);
-                }
-
-                return false;
-            }
-
-            if (textureUnitType[unit] != TEXTURE_UNKNOWN)
-            {
-                if (mSamplersVS[i].textureType != textureUnitType[unit])
-                {
-                    if (infoLog)
-                    {
-                        infoLog->append("Samplers of conflicting types refer to the same texture image unit (%d).", unit);
-                    }
-
-                    return false;
-                }
-            }
-            else
-            {
-                textureUnitType[unit] = mSamplersVS[i].textureType;
-            }
-        }
-    }
-
-    return true;
-}
-
-GLint ProgramBinary::getDxDepthRangeLocation() const
-{
-    return mDxDepthRangeLocation;
-}
-
-GLint ProgramBinary::getDxDepthLocation() const
-{
-    return mDxDepthLocation;
-}
-
-GLint ProgramBinary::getDxCoordLocation() const
-{
-    return mDxCoordLocation;
-}
-
-GLint ProgramBinary::getDxHalfPixelSizeLocation() const
-{
-    return mDxHalfPixelSizeLocation;
-}
-
-GLint ProgramBinary::getDxFrontCCWLocation() const
-{
-    return mDxFrontCCWLocation;
-}
-
-GLint ProgramBinary::getDxPointsOrLinesLocation() const
-{
-    return mDxPointsOrLinesLocation;
-}
-
-}
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.h b/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.h
deleted file mode 100644
index 1e9c5e2..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.h
+++ /dev/null
@@ -1,211 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Program.h: Defines the gl::Program class. Implements GL program objects
-// and related functionality. [OpenGL ES 2.0.24] section 2.10.3 page 28.
-
-#ifndef LIBGLESV2_PROGRAM_BINARY_H_
-#define LIBGLESV2_PROGRAM_BINARY_H_
-
-#include <d3dx9.h>
-#include <d3dcompiler.h>
-#include <string>
-#include <vector>
-
-#include "libGLESv2/Shader.h"
-#include "libGLESv2/Context.h"
-
-namespace gl
-{
-class FragmentShader;
-class VertexShader;
-
-// Helper struct representing a single shader uniform
-struct Uniform
-{
-    Uniform(GLenum type, const std::string &_name, unsigned int arraySize);
-
-    ~Uniform();
-
-    bool isArray();
-
-    const GLenum type;
-    const std::string _name;   // Decorated name
-    const std::string name;    // Undecorated name
-    const unsigned int arraySize;
-
-    unsigned char *data;
-    bool dirty;
-
-    struct RegisterInfo
-    {
-        RegisterInfo()
-        {
-            float4Index = -1;
-            samplerIndex = -1;
-            boolIndex = -1;
-            registerCount = 0;
-        }
-
-        void set(const D3DXCONSTANT_DESC &constantDescription)
-        {
-            switch(constantDescription.RegisterSet)
-            {
-              case D3DXRS_BOOL:    boolIndex = constantDescription.RegisterIndex;    break;
-              case D3DXRS_FLOAT4:  float4Index = constantDescription.RegisterIndex;  break;
-              case D3DXRS_SAMPLER: samplerIndex = constantDescription.RegisterIndex; break;
-              default: UNREACHABLE();
-            }
-            
-            ASSERT(registerCount == 0 || registerCount == (int)constantDescription.RegisterCount);
-            registerCount = constantDescription.RegisterCount;
-        }
-
-        int float4Index;
-        int samplerIndex;
-        int boolIndex;
-
-        int registerCount;
-    };
-
-    RegisterInfo ps;
-    RegisterInfo vs;
-};
-
-// Struct used for correlating uniforms/elements of uniform arrays to handles
-struct UniformLocation
-{
-    UniformLocation(const std::string &_name, unsigned int element, unsigned int index);
-
-    std::string name;
-    unsigned int element;
-    unsigned int index;
-};
-
-// This is the result of linking a program. It is the state that would be passed to ProgramBinary.
-class ProgramBinary
-{
-  public:
-    ProgramBinary();
-    ~ProgramBinary();
-
-    IDirect3DPixelShader9 *getPixelShader();
-    IDirect3DVertexShader9 *getVertexShader();
-
-    GLuint getAttributeLocation(const char *name);
-    int getSemanticIndex(int attributeIndex);
-
-    GLint getSamplerMapping(SamplerType type, unsigned int samplerIndex);
-    TextureType getSamplerTextureType(SamplerType type, unsigned int samplerIndex);
-    GLint getUsedSamplerRange(SamplerType type);
-
-    GLint getUniformLocation(std::string name);
-    bool setUniform1fv(GLint location, GLsizei count, const GLfloat *v);
-    bool setUniform2fv(GLint location, GLsizei count, const GLfloat *v);
-    bool setUniform3fv(GLint location, GLsizei count, const GLfloat *v);
-    bool setUniform4fv(GLint location, GLsizei count, const GLfloat *v);
-    bool setUniformMatrix2fv(GLint location, GLsizei count, const GLfloat *value);
-    bool setUniformMatrix3fv(GLint location, GLsizei count, const GLfloat *value);
-    bool setUniformMatrix4fv(GLint location, GLsizei count, const GLfloat *value);
-    bool setUniform1iv(GLint location, GLsizei count, const GLint *v);
-    bool setUniform2iv(GLint location, GLsizei count, const GLint *v);
-    bool setUniform3iv(GLint location, GLsizei count, const GLint *v);
-    bool setUniform4iv(GLint location, GLsizei count, const GLint *v);
-
-    bool getUniformfv(GLint location, GLsizei *bufSize, GLfloat *params);
-    bool getUniformiv(GLint location, GLsizei *bufSize, GLint *params);
-
-    GLint getDxDepthRangeLocation() const;
-    GLint getDxDepthLocation() const;
-    GLint getDxCoordLocation() const;
-    GLint getDxHalfPixelSizeLocation() const;
-    GLint getDxFrontCCWLocation() const;
-    GLint getDxPointsOrLinesLocation() const;
-
-    void dirtyAllUniforms();
-    void applyUniforms();
-
-    bool link(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader);
-    void getAttachedShaders(GLsizei maxCount, GLsizei *count, GLuint *shaders);
-
-    void getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-    GLint getActiveAttributeCount();
-    GLint getActiveAttributeMaxLength();
-
-    void getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-    GLint getActiveUniformCount();
-    GLint getActiveUniformMaxLength();
-
-    void validate(InfoLog &infoLog);
-    bool validateSamplers(InfoLog *infoLog);
-    bool isValidated() const;
-
-    static std::string decorateAttribute(const std::string &name);    // Prepend an underscore
-    static std::string undecorateUniform(const std::string &_name);   // Remove leading underscore
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(ProgramBinary);
-
-    ID3D10Blob *compileToBinary(InfoLog &infoLog, const char *hlsl, const char *profile, ID3DXConstantTable **constantTable);
-
-    int packVaryings(InfoLog &infoLog, const Varying *packing[][4], FragmentShader *fragmentShader);
-    bool linkVaryings(InfoLog &infoLog, std::string& pixelHLSL, std::string& vertexHLSL, FragmentShader *fragmentShader, VertexShader *vertexShader);
-
-    bool linkAttributes(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader);
-
-    bool linkUniforms(InfoLog &infoLog, GLenum shader, ID3DXConstantTable *constantTable);
-    bool defineUniform(InfoLog &infoLog, GLenum shader, const D3DXHANDLE &constantHandle, const D3DXCONSTANT_DESC &constantDescription, std::string name = "");
-    bool defineUniform(GLenum shader, const D3DXCONSTANT_DESC &constantDescription, const std::string &name);
-    Uniform *createUniform(const D3DXCONSTANT_DESC &constantDescription, const std::string &name);
-    bool applyUniformnfv(Uniform *targetUniform, const GLfloat *v);
-    bool applyUniform1iv(Uniform *targetUniform, GLsizei count, const GLint *v);
-    bool applyUniform2iv(Uniform *targetUniform, GLsizei count, const GLint *v);
-    bool applyUniform3iv(Uniform *targetUniform, GLsizei count, const GLint *v);
-    bool applyUniform4iv(Uniform *targetUniform, GLsizei count, const GLint *v);
-    void applyUniformniv(Uniform *targetUniform, GLsizei count, const D3DXVECTOR4 *vector);
-    void applyUniformnbv(Uniform *targetUniform, GLsizei count, int width, const GLboolean *v);
-
-    IDirect3DDevice9 *mDevice;
-
-    IDirect3DPixelShader9 *mPixelExecutable;
-    IDirect3DVertexShader9 *mVertexExecutable;
-
-    // These are only used during linking.
-    ID3DXConstantTable *mConstantTablePS;
-    ID3DXConstantTable *mConstantTableVS;
-
-    Attribute mLinkedAttribute[MAX_VERTEX_ATTRIBS];
-    int mSemanticIndex[MAX_VERTEX_ATTRIBS];
-
-    struct Sampler
-    {
-        bool active;
-        GLint logicalTextureUnit;
-        TextureType textureType;
-    };
-
-    Sampler mSamplersPS[MAX_TEXTURE_IMAGE_UNITS];
-    Sampler mSamplersVS[MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF];
-    GLuint mUsedVertexSamplerRange;
-    GLuint mUsedPixelSamplerRange;
-
-    typedef std::vector<Uniform*> UniformArray;
-    UniformArray mUniforms;
-    typedef std::vector<UniformLocation> UniformIndex;
-    UniformIndex mUniformIndex;
-
-    GLint mDxDepthRangeLocation;
-    GLint mDxDepthLocation;
-    GLint mDxCoordLocation;
-    GLint mDxHalfPixelSizeLocation;
-    GLint mDxFrontCCWLocation;
-    GLint mDxPointsOrLinesLocation;
-
-    bool mValidated;
-};
-}
-
-#endif   // LIBGLESV2_PROGRAM_BINARY_H_
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Query.cpp b/Source/ThirdParty/ANGLE/src/libGLESv2/Query.cpp
deleted file mode 100644
index 10edda5..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Query.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-//
-// 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
-}
-}
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Query.h b/Source/ThirdParty/ANGLE/src/libGLESv2/Query.h
deleted file mode 100644
index 79357a0..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Query.h
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// 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_
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/README b/Source/ThirdParty/ANGLE/src/libGLESv2/README
new file mode 100644
index 0000000..527d3f5
--- /dev/null
+++ b/Source/ThirdParty/ANGLE/src/libGLESv2/README
@@ -0,0 +1 @@
+This directory's contents are not synced from the ANGLE project because no platform in WebKit needs them yet.
\ No newline at end of file
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.cpp b/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.cpp
deleted file mode 100644
index 4b911e8..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.cpp
+++ /dev/null
@@ -1,577 +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.
-//
-
-// Renderbuffer.cpp: the gl::Renderbuffer class and its derived classes
-// Colorbuffer, Depthbuffer and Stencilbuffer. Implements GL renderbuffer
-// objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108.
-
-#include "libGLESv2/Renderbuffer.h"
-
-#include "libGLESv2/main.h"
-#include "libGLESv2/Texture.h"
-#include "libGLESv2/utilities.h"
-
-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());
-}
-
-GLuint RenderbufferInterface::getBlueSize() const
-{
-    return dx2es::GetBlueSize(getD3DFormat());
-}
-
-GLuint RenderbufferInterface::getAlphaSize() const
-{
-    return dx2es::GetAlphaSize(getD3DFormat());
-}
-
-GLuint RenderbufferInterface::getDepthSize() const
-{
-    return dx2es::GetDepthSize(getD3DFormat());
-}
-
-GLuint RenderbufferInterface::getStencilSize() const
-{
-    return dx2es::GetStencilSize(getD3DFormat());
-}
-
-///// RenderbufferTexture2D Implementation ////////
-
-RenderbufferTexture2D::RenderbufferTexture2D(Texture2D *texture, GLenum target) : mTarget(target)
-{
-    mTexture2D.set(texture);
-}
-
-RenderbufferTexture2D::~RenderbufferTexture2D()
-{
-    mTexture2D.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 RenderbufferTexture2D::addProxyRef(const Renderbuffer *proxy)
-{
-    mTexture2D->addProxyRef(proxy);
-}
-
-void RenderbufferTexture2D::releaseProxy(const Renderbuffer *proxy)
-{
-    mTexture2D->releaseProxy(proxy);
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *RenderbufferTexture2D::getRenderTarget()
-{
-    return mTexture2D->getRenderTarget(mTarget);
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *RenderbufferTexture2D::getDepthStencil()
-{
-    return mTexture2D->getDepthStencil(mTarget);
-}
-
-GLsizei RenderbufferTexture2D::getWidth() const
-{
-    return mTexture2D->getWidth(0);
-}
-
-GLsizei RenderbufferTexture2D::getHeight() const
-{
-    return mTexture2D->getHeight(0);
-}
-
-GLenum RenderbufferTexture2D::getInternalFormat() const
-{
-    return mTexture2D->getInternalFormat(0);
-}
-
-D3DFORMAT RenderbufferTexture2D::getD3DFormat() const
-{
-    return mTexture2D->getD3DFormat(0);
-}
-
-GLsizei RenderbufferTexture2D::getSamples() const
-{
-    return 0;
-}
-
-unsigned int RenderbufferTexture2D::getSerial() const
-{
-    return mTexture2D->getRenderTargetSerial(mTarget);
-}
-
-///// RenderbufferTextureCubeMap Implementation ////////
-
-RenderbufferTextureCubeMap::RenderbufferTextureCubeMap(TextureCubeMap *texture, GLenum target) : mTarget(target)
-{
-    mTextureCubeMap.set(texture);
-}
-
-RenderbufferTextureCubeMap::~RenderbufferTextureCubeMap()
-{
-    mTextureCubeMap.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 RenderbufferTextureCubeMap::addProxyRef(const Renderbuffer *proxy)
-{
-    mTextureCubeMap->addProxyRef(proxy);
-}
-
-void RenderbufferTextureCubeMap::releaseProxy(const Renderbuffer *proxy)
-{
-    mTextureCubeMap->releaseProxy(proxy);
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *RenderbufferTextureCubeMap::getRenderTarget()
-{
-    return mTextureCubeMap->getRenderTarget(mTarget);
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *RenderbufferTextureCubeMap::getDepthStencil()
-{
-    return NULL;
-}
-
-GLsizei RenderbufferTextureCubeMap::getWidth() const
-{
-    return mTextureCubeMap->getWidth(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0);
-}
-
-GLsizei RenderbufferTextureCubeMap::getHeight() const
-{
-    return mTextureCubeMap->getHeight(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0);
-}
-
-GLenum RenderbufferTextureCubeMap::getInternalFormat() const
-{
-    return mTextureCubeMap->getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0);
-}
-
-D3DFORMAT RenderbufferTextureCubeMap::getD3DFormat() const
-{
-    return mTextureCubeMap->getD3DFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0);
-}
-
-GLsizei RenderbufferTextureCubeMap::getSamples() const
-{
-    return 0;
-}
-
-unsigned int RenderbufferTextureCubeMap::getSerial() const
-{
-    return mTextureCubeMap->getRenderTargetSerial(mTarget);
-}
-
-////// Renderbuffer Implementation //////
-
-Renderbuffer::Renderbuffer(GLuint id, RenderbufferInterface *instance) : RefCountObject(id)
-{
-    ASSERT(instance != NULL);
-    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();
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *Renderbuffer::getRenderTarget()
-{
-    return mInstance->getRenderTarget();
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *Renderbuffer::getDepthStencil()
-{
-    return mInstance->getDepthStencil();
-}
-
-GLsizei Renderbuffer::getWidth() const
-{
-    return mInstance->getWidth();
-}
-
-GLsizei Renderbuffer::getHeight() const
-{
-    return mInstance->getHeight();
-}
-
-GLenum Renderbuffer::getInternalFormat() const
-{
-    return mInstance->getInternalFormat();
-}
-
-D3DFORMAT Renderbuffer::getD3DFormat() const
-{
-    return mInstance->getD3DFormat();
-}
-
-GLuint Renderbuffer::getRedSize() const
-{
-    return mInstance->getRedSize();
-}
-
-GLuint Renderbuffer::getGreenSize() const
-{
-    return mInstance->getGreenSize();
-}
-
-GLuint Renderbuffer::getBlueSize() const
-{
-    return mInstance->getBlueSize();
-}
-
-GLuint Renderbuffer::getAlphaSize() const
-{
-    return mInstance->getAlphaSize();
-}
-
-GLuint Renderbuffer::getDepthSize() const
-{
-    return mInstance->getDepthSize();
-}
-
-GLuint Renderbuffer::getStencilSize() const
-{
-    return mInstance->getStencilSize();
-}
-
-GLsizei Renderbuffer::getSamples() const
-{
-    return mInstance->getSamples();
-}
-
-unsigned int Renderbuffer::getSerial() const
-{
-    return mInstance->getSerial();
-}
-
-void Renderbuffer::setStorage(RenderbufferStorage *newStorage)
-{
-    ASSERT(newStorage != NULL);
-
-    delete mInstance;
-    mInstance = newStorage;
-}
-
-RenderbufferStorage::RenderbufferStorage() : mSerial(issueSerial())
-{
-    mWidth = 0;
-    mHeight = 0;
-    mInternalFormat = GL_RGBA4;
-    mD3DFormat = D3DFMT_A8R8G8B8;
-    mSamples = 0;
-}
-
-RenderbufferStorage::~RenderbufferStorage()
-{
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *RenderbufferStorage::getRenderTarget()
-{
-    return NULL;
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *RenderbufferStorage::getDepthStencil()
-{
-    return NULL;
-}
-
-GLsizei RenderbufferStorage::getWidth() const
-{
-    return mWidth;
-}
-
-GLsizei RenderbufferStorage::getHeight() const
-{
-    return mHeight;
-}
-
-GLenum RenderbufferStorage::getInternalFormat() const
-{
-    return mInternalFormat;
-}
-
-D3DFORMAT RenderbufferStorage::getD3DFormat() const
-{
-    return mD3DFormat;
-}
-
-GLsizei RenderbufferStorage::getSamples() const
-{
-    return mSamples;
-}
-
-unsigned int RenderbufferStorage::getSerial() const
-{
-    return mSerial;
-}
-
-unsigned int RenderbufferStorage::issueSerial()
-{
-    return mCurrentSerial++;
-}
-
-unsigned int RenderbufferStorage::issueCubeSerials()
-{
-    unsigned int firstSerial = mCurrentSerial;
-    mCurrentSerial += 6;
-    return firstSerial;
-}
-
-Colorbuffer::Colorbuffer(IDirect3DSurface9 *renderTarget) : mRenderTarget(renderTarget)
-{
-    if (renderTarget)
-    {
-        renderTarget->AddRef();
-
-        D3DSURFACE_DESC description;
-        renderTarget->GetDesc(&description);
-
-        mWidth = description.Width;
-        mHeight = description.Height;
-        mInternalFormat = dx2es::ConvertBackBufferFormat(description.Format);
-        mD3DFormat = description.Format;
-        mSamples = dx2es::GetSamplesFromMultisampleType(description.MultiSampleType);
-    }
-}
-
-Colorbuffer::Colorbuffer(int width, int height, GLenum format, GLsizei samples) : mRenderTarget(NULL)
-{
-    IDirect3DDevice9 *device = getDevice();
-
-    D3DFORMAT requestedFormat = es2dx::ConvertRenderbufferFormat(format);
-    int supportedSamples = getContext()->getNearestSupportedSamples(requestedFormat, samples);
-
-    if (supportedSamples == -1)
-    {
-        error(GL_OUT_OF_MEMORY);
-
-        return;
-    }
-
-    if (width > 0 && height > 0)
-    {
-        HRESULT result = device->CreateRenderTarget(width, height, requestedFormat, 
-                                                    es2dx::GetMultisampleTypeFromSamples(supportedSamples), 0, FALSE, &mRenderTarget, NULL);
-
-        if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
-        {
-            error(GL_OUT_OF_MEMORY);
-
-            return;
-        }
-
-        ASSERT(SUCCEEDED(result));
-    }
-
-    mWidth = width;
-    mHeight = height;
-    mInternalFormat = format;
-    mD3DFormat = requestedFormat;
-    mSamples = supportedSamples;
-}
-
-Colorbuffer::~Colorbuffer()
-{
-    if (mRenderTarget)
-    {
-        mRenderTarget->Release();
-    }
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *Colorbuffer::getRenderTarget()
-{
-    if (mRenderTarget)
-    {
-        mRenderTarget->AddRef();
-    }
-
-    return mRenderTarget;
-}
-
-DepthStencilbuffer::DepthStencilbuffer(IDirect3DSurface9 *depthStencil) : mDepthStencil(depthStencil)
-{
-    if (depthStencil)
-    {
-        depthStencil->AddRef();
-
-        D3DSURFACE_DESC description;
-        depthStencil->GetDesc(&description);
-
-        mWidth = description.Width;
-        mHeight = description.Height;
-        mInternalFormat = dx2es::ConvertDepthStencilFormat(description.Format);
-        mSamples = dx2es::GetSamplesFromMultisampleType(description.MultiSampleType); 
-        mD3DFormat = description.Format;
-    }
-}
-
-DepthStencilbuffer::DepthStencilbuffer(int width, int height, GLsizei samples)
-{
-    IDirect3DDevice9 *device = getDevice();
-
-    mDepthStencil = NULL;
-    
-    int supportedSamples = getContext()->getNearestSupportedSamples(D3DFMT_D24S8, samples);
-
-    if (supportedSamples == -1)
-    {
-        error(GL_OUT_OF_MEMORY);
-
-        return;
-    }
-
-    if (width > 0 && height > 0)
-    {
-        HRESULT result = device->CreateDepthStencilSurface(width, height, D3DFMT_D24S8, es2dx::GetMultisampleTypeFromSamples(supportedSamples),
-                                                           0, FALSE, &mDepthStencil, 0);
-
-        if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
-        {
-            error(GL_OUT_OF_MEMORY);
-
-            return;
-        }
-
-        ASSERT(SUCCEEDED(result));
-    }
-
-    mWidth = width;
-    mHeight = height;
-    mInternalFormat = GL_DEPTH24_STENCIL8_OES;
-    mD3DFormat = D3DFMT_D24S8;
-    mSamples = supportedSamples;
-}
-
-DepthStencilbuffer::~DepthStencilbuffer()
-{
-    if (mDepthStencil)
-    {
-        mDepthStencil->Release();
-    }
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *DepthStencilbuffer::getDepthStencil()
-{
-    if (mDepthStencil)
-    {
-        mDepthStencil->AddRef();
-    }
-
-    return mDepthStencil;
-}
-
-Depthbuffer::Depthbuffer(IDirect3DSurface9 *depthStencil) : DepthStencilbuffer(depthStencil)
-{
-    if (depthStencil)
-    {
-        mInternalFormat = GL_DEPTH_COMPONENT16;   // If the renderbuffer parameters are queried, the calling function
-                                                  // will expect one of the valid renderbuffer formats for use in 
-                                                  // glRenderbufferStorage
-    }
-}
-
-Depthbuffer::Depthbuffer(int width, int height, GLsizei samples) : DepthStencilbuffer(width, height, samples)
-{
-    if (mDepthStencil)
-    {
-        mInternalFormat = GL_DEPTH_COMPONENT16;   // If the renderbuffer parameters are queried, the calling function
-                                                  // will expect one of the valid renderbuffer formats for use in 
-                                                  // glRenderbufferStorage
-    }
-}
-
-Depthbuffer::~Depthbuffer()
-{
-}
-
-Stencilbuffer::Stencilbuffer(IDirect3DSurface9 *depthStencil) : DepthStencilbuffer(depthStencil)
-{
-    if (depthStencil)
-    {
-        mInternalFormat = GL_STENCIL_INDEX8;   // If the renderbuffer parameters are queried, the calling function
-                                               // will expect one of the valid renderbuffer formats for use in 
-                                               // glRenderbufferStorage
-    }
-}
-
-Stencilbuffer::Stencilbuffer(int width, int height, GLsizei samples) : DepthStencilbuffer(width, height, samples)
-{
-    if (mDepthStencil)
-    {
-        mInternalFormat = GL_STENCIL_INDEX8;   // If the renderbuffer parameters are queried, the calling function
-                                               // will expect one of the valid renderbuffer formats for use in 
-                                               // glRenderbufferStorage
-    }
-}
-
-Stencilbuffer::~Stencilbuffer()
-{
-}
-
-}
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.h b/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.h
deleted file mode 100644
index e6d5ddb..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.h
+++ /dev/null
@@ -1,257 +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.
-//
-
-// Renderbuffer.h: Defines the wrapper class gl::Renderbuffer, as well as the
-// class hierarchy used to store its contents: RenderbufferStorage, Colorbuffer,
-// DepthStencilbuffer, Depthbuffer and Stencilbuffer. Implements GL renderbuffer
-// objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108.
-
-#ifndef LIBGLESV2_RENDERBUFFER_H_
-#define LIBGLESV2_RENDERBUFFER_H_
-
-#define GL_APICALL
-#include <GLES2/gl2.h>
-#include <d3d9.h>
-
-#include "common/angleutils.h"
-#include "common/RefCountObject.h"
-
-namespace gl
-{
-class Texture2D;
-class TextureCubeMap;
-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;
-
-    GLuint getRedSize() const;
-    GLuint getGreenSize() const;
-    GLuint getBlueSize() const;
-    GLuint getAlphaSize() const;
-    GLuint getDepthSize() const;
-    GLuint getStencilSize() const;
-
-    virtual unsigned int getSerial() const = 0;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(RenderbufferInterface);
-};
-
-class RenderbufferTexture2D : public RenderbufferInterface
-{
-  public:
-    RenderbufferTexture2D(Texture2D *texture, GLenum target);
-
-    virtual ~RenderbufferTexture2D();
-
-    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(RenderbufferTexture2D);
-
-    BindingPointer <Texture2D> mTexture2D;
-    GLenum mTarget;
-};
-
-class RenderbufferTextureCubeMap : public RenderbufferInterface
-{
-  public:
-    RenderbufferTextureCubeMap(TextureCubeMap *texture, GLenum target);
-
-    virtual ~RenderbufferTextureCubeMap();
-
-    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(RenderbufferTextureCubeMap);
-
-    BindingPointer <TextureCubeMap> mTextureCubeMap;
-    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
-{
-  public:
-    RenderbufferStorage();
-
-    virtual ~RenderbufferStorage() = 0;
-
-    virtual IDirect3DSurface9 *getRenderTarget();
-    virtual 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;
-
-    static unsigned int issueSerial();
-    static unsigned int issueCubeSerials();
-
-  protected:
-    GLsizei mWidth;
-    GLsizei mHeight;
-    GLenum mInternalFormat;
-    D3DFORMAT mD3DFormat;
-    GLsizei mSamples;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(RenderbufferStorage);
-
-    const unsigned int mSerial;
-
-    static unsigned int mCurrentSerial;
-};
-
-// Renderbuffer implements the GL renderbuffer object.
-// It's only a proxy for a RenderbufferInterface instance; the internal object
-// 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;
-    GLuint getGreenSize() const;
-    GLuint getBlueSize() const;
-    GLuint getAlphaSize() const;
-    GLuint getDepthSize() const;
-    GLuint getStencilSize() const;
-    GLsizei getSamples() const;
-
-    unsigned int getSerial() const;
-
-    void setStorage(RenderbufferStorage *newStorage);
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Renderbuffer);
-
-    RenderbufferInterface *mInstance;
-};
-
-class Colorbuffer : public RenderbufferStorage
-{
-  public:
-    explicit Colorbuffer(IDirect3DSurface9 *renderTarget);
-    Colorbuffer(GLsizei width, GLsizei height, GLenum format, GLsizei samples);
-
-    virtual ~Colorbuffer();
-
-    virtual IDirect3DSurface9 *getRenderTarget();
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Colorbuffer);
-
-    IDirect3DSurface9 *mRenderTarget;
-};
-
-class DepthStencilbuffer : public RenderbufferStorage
-{
-  public:
-    explicit DepthStencilbuffer(IDirect3DSurface9 *depthStencil);
-    DepthStencilbuffer(GLsizei width, GLsizei height, GLsizei samples);
-
-    ~DepthStencilbuffer();
-
-    virtual IDirect3DSurface9 *getDepthStencil();
-
-  protected:
-    IDirect3DSurface9 *mDepthStencil;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(DepthStencilbuffer);
-};
-
-class Depthbuffer : public DepthStencilbuffer
-{
-  public:
-    explicit Depthbuffer(IDirect3DSurface9 *depthStencil);
-    Depthbuffer(GLsizei width, GLsizei height, GLsizei samples);
-
-    virtual ~Depthbuffer();
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Depthbuffer);
-};
-
-class Stencilbuffer : public DepthStencilbuffer
-{
-  public:
-    explicit Stencilbuffer(IDirect3DSurface9 *depthStencil);
-    Stencilbuffer(GLsizei width, GLsizei height, GLsizei samples);
-
-    virtual ~Stencilbuffer();
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Stencilbuffer);
-};
-}
-
-#endif   // LIBGLESV2_RENDERBUFFER_H_
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.cpp b/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.cpp
deleted file mode 100644
index ae26352..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.cpp
+++ /dev/null
@@ -1,320 +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.
-//
-
-// ResourceManager.cpp: Implements the gl::ResourceManager class, which tracks and 
-// retrieves objects which may be shared by multiple Contexts.
-
-#include "libGLESv2/ResourceManager.h"
-
-#include "libGLESv2/Buffer.h"
-#include "libGLESv2/Program.h"
-#include "libGLESv2/RenderBuffer.h"
-#include "libGLESv2/Shader.h"
-#include "libGLESv2/Texture.h"
-
-namespace gl
-{
-ResourceManager::ResourceManager()
-{
-    mRefCount = 1;
-}
-
-ResourceManager::~ResourceManager()
-{
-    while (!mBufferMap.empty())
-    {
-        deleteBuffer(mBufferMap.begin()->first);
-    }
-
-    while (!mProgramMap.empty())
-    {
-        deleteProgram(mProgramMap.begin()->first);
-    }
-
-    while (!mShaderMap.empty())
-    {
-        deleteShader(mShaderMap.begin()->first);
-    }
-
-    while (!mRenderbufferMap.empty())
-    {
-        deleteRenderbuffer(mRenderbufferMap.begin()->first);
-    }
-
-    while (!mTextureMap.empty())
-    {
-        deleteTexture(mTextureMap.begin()->first);
-    }
-}
-
-void ResourceManager::addRef()
-{
-    mRefCount++;
-}
-
-void ResourceManager::release()
-{
-    if (--mRefCount == 0)
-    {
-        delete this;
-    }
-}
-
-// Returns an unused buffer name
-GLuint ResourceManager::createBuffer()
-{
-    GLuint handle = mBufferHandleAllocator.allocate();
-
-    mBufferMap[handle] = NULL;
-
-    return handle;
-}
-
-// Returns an unused shader/program name
-GLuint ResourceManager::createShader(GLenum type)
-{
-    GLuint handle = mProgramShaderHandleAllocator.allocate();
-
-    if (type == GL_VERTEX_SHADER)
-    {
-        mShaderMap[handle] = new VertexShader(this, handle);
-    }
-    else if (type == GL_FRAGMENT_SHADER)
-    {
-        mShaderMap[handle] = new FragmentShader(this, handle);
-    }
-    else UNREACHABLE();
-
-    return handle;
-}
-
-// Returns an unused program/shader name
-GLuint ResourceManager::createProgram()
-{
-    GLuint handle = mProgramShaderHandleAllocator.allocate();
-
-    mProgramMap[handle] = new Program(this, handle);
-
-    return handle;
-}
-
-// Returns an unused texture name
-GLuint ResourceManager::createTexture()
-{
-    GLuint handle = mTextureHandleAllocator.allocate();
-
-    mTextureMap[handle] = NULL;
-
-    return handle;
-}
-
-// Returns an unused renderbuffer name
-GLuint ResourceManager::createRenderbuffer()
-{
-    GLuint handle = mRenderbufferHandleAllocator.allocate();
-
-    mRenderbufferMap[handle] = NULL;
-
-    return handle;
-}
-
-void ResourceManager::deleteBuffer(GLuint buffer)
-{
-    BufferMap::iterator bufferObject = mBufferMap.find(buffer);
-
-    if (bufferObject != mBufferMap.end())
-    {
-        mBufferHandleAllocator.release(bufferObject->first);
-        if (bufferObject->second) bufferObject->second->release();
-        mBufferMap.erase(bufferObject);
-    }
-}
-
-void ResourceManager::deleteShader(GLuint shader)
-{
-    ShaderMap::iterator shaderObject = mShaderMap.find(shader);
-
-    if (shaderObject != mShaderMap.end())
-    {
-        if (shaderObject->second->getRefCount() == 0)
-        {
-            mProgramShaderHandleAllocator.release(shaderObject->first);
-            delete shaderObject->second;
-            mShaderMap.erase(shaderObject);
-        }
-        else
-        {
-            shaderObject->second->flagForDeletion();
-        }
-    }
-}
-
-void ResourceManager::deleteProgram(GLuint program)
-{
-    ProgramMap::iterator programObject = mProgramMap.find(program);
-
-    if (programObject != mProgramMap.end())
-    {
-        if (programObject->second->getRefCount() == 0)
-        {
-            mProgramShaderHandleAllocator.release(programObject->first);
-            delete programObject->second;
-            mProgramMap.erase(programObject);
-        }
-        else
-        { 
-            programObject->second->flagForDeletion();
-        }
-    }
-}
-
-void ResourceManager::deleteTexture(GLuint texture)
-{
-    TextureMap::iterator textureObject = mTextureMap.find(texture);
-
-    if (textureObject != mTextureMap.end())
-    {
-        mTextureHandleAllocator.release(textureObject->first);
-        if (textureObject->second) textureObject->second->release();
-        mTextureMap.erase(textureObject);
-    }
-}
-
-void ResourceManager::deleteRenderbuffer(GLuint renderbuffer)
-{
-    RenderbufferMap::iterator renderbufferObject = mRenderbufferMap.find(renderbuffer);
-
-    if (renderbufferObject != mRenderbufferMap.end())
-    {
-        mRenderbufferHandleAllocator.release(renderbufferObject->first);
-        if (renderbufferObject->second) renderbufferObject->second->release();
-        mRenderbufferMap.erase(renderbufferObject);
-    }
-}
-
-Buffer *ResourceManager::getBuffer(unsigned int handle)
-{
-    BufferMap::iterator buffer = mBufferMap.find(handle);
-
-    if (buffer == mBufferMap.end())
-    {
-        return NULL;
-    }
-    else
-    {
-        return buffer->second;
-    }
-}
-
-Shader *ResourceManager::getShader(unsigned int handle)
-{
-    ShaderMap::iterator shader = mShaderMap.find(handle);
-
-    if (shader == mShaderMap.end())
-    {
-        return NULL;
-    }
-    else
-    {
-        return shader->second;
-    }
-}
-
-Texture *ResourceManager::getTexture(unsigned int handle)
-{
-    if (handle == 0) return NULL;
-
-    TextureMap::iterator texture = mTextureMap.find(handle);
-
-    if (texture == mTextureMap.end())
-    {
-        return NULL;
-    }
-    else
-    {
-        return texture->second;
-    }
-}
-
-Program *ResourceManager::getProgram(unsigned int handle)
-{
-    ProgramMap::iterator program = mProgramMap.find(handle);
-
-    if (program == mProgramMap.end())
-    {
-        return NULL;
-    }
-    else
-    {
-        return program->second;
-    }
-}
-
-Renderbuffer *ResourceManager::getRenderbuffer(unsigned int handle)
-{
-    RenderbufferMap::iterator renderbuffer = mRenderbufferMap.find(handle);
-
-    if (renderbuffer == mRenderbufferMap.end())
-    {
-        return NULL;
-    }
-    else
-    {
-        return renderbuffer->second;
-    }
-}
-
-void ResourceManager::setRenderbuffer(GLuint handle, Renderbuffer *buffer)
-{
-    mRenderbufferMap[handle] = buffer;
-}
-
-void ResourceManager::checkBufferAllocation(unsigned int buffer)
-{
-    if (buffer != 0 && !getBuffer(buffer))
-    {
-        Buffer *bufferObject = new Buffer(buffer);
-        mBufferMap[buffer] = bufferObject;
-        bufferObject->addRef();
-    }
-}
-
-void ResourceManager::checkTextureAllocation(GLuint texture, TextureType type)
-{
-    if (!getTexture(texture) && texture != 0)
-    {
-        Texture *textureObject;
-
-        if (type == TEXTURE_2D)
-        {
-            textureObject = new Texture2D(texture);
-        }
-        else if (type == TEXTURE_CUBE)
-        {
-            textureObject = new TextureCubeMap(texture);
-        }
-        else
-        {
-            UNREACHABLE();
-            return;
-        }
-
-        mTextureMap[texture] = textureObject;
-        textureObject->addRef();
-    }
-}
-
-void ResourceManager::checkRenderbufferAllocation(GLuint renderbuffer)
-{
-    if (renderbuffer != 0 && !getRenderbuffer(renderbuffer))
-    {
-        Renderbuffer *renderbufferObject = new Renderbuffer(renderbuffer, new Colorbuffer(0, 0, GL_RGBA4, 0));
-        mRenderbufferMap[renderbuffer] = renderbufferObject;
-        renderbufferObject->addRef();
-    }
-}
-
-}
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.h b/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.h
deleted file mode 100644
index 5185fc9..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.h
+++ /dev/null
@@ -1,104 +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.
-//
-
-// ResourceManager.h : Defines the ResourceManager class, which tracks objects
-// shared by multiple GL contexts.
-
-#ifndef LIBGLESV2_RESOURCEMANAGER_H_
-#define LIBGLESV2_RESOURCEMANAGER_H_
-
-#define GL_APICALL
-#include <GLES2/gl2.h>
-
-#include <hash_map>
-
-#include "common/angleutils.h"
-#include "libGLESv2/HandleAllocator.h"
-
-namespace gl
-{
-class Buffer;
-class Shader;
-class Program;
-class Texture;
-class Renderbuffer;
-
-enum TextureType
-{
-    TEXTURE_2D,
-    TEXTURE_CUBE,
-
-    TEXTURE_TYPE_COUNT,
-    TEXTURE_UNKNOWN
-};
-
-enum SamplerType
-{
-    SAMPLER_PIXEL,
-    SAMPLER_VERTEX
-};
-
-class ResourceManager
-{
-  public:
-    ResourceManager();
-    ~ResourceManager();
-
-    void addRef();
-    void release();
-
-    GLuint createBuffer();
-    GLuint createShader(GLenum type);
-    GLuint createProgram();
-    GLuint createTexture();
-    GLuint createRenderbuffer();
-
-    void deleteBuffer(GLuint buffer);
-    void deleteShader(GLuint shader);
-    void deleteProgram(GLuint program);
-    void deleteTexture(GLuint texture);
-    void deleteRenderbuffer(GLuint renderbuffer);
-
-    Buffer *getBuffer(GLuint handle);
-    Shader *getShader(GLuint handle);
-    Program *getProgram(GLuint handle);
-    Texture *getTexture(GLuint handle);
-    Renderbuffer *getRenderbuffer(GLuint handle);
-    
-    void setRenderbuffer(GLuint handle, Renderbuffer *renderbuffer);
-
-    void checkBufferAllocation(unsigned int buffer);
-    void checkTextureAllocation(GLuint texture, TextureType type);
-    void checkRenderbufferAllocation(GLuint renderbuffer);
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(ResourceManager);
-
-    std::size_t mRefCount;
-
-    typedef stdext::hash_map<GLuint, Buffer*> BufferMap;
-    BufferMap mBufferMap;
-    HandleAllocator mBufferHandleAllocator;
-
-    typedef stdext::hash_map<GLuint, Shader*> ShaderMap;
-    ShaderMap mShaderMap;
-
-    typedef stdext::hash_map<GLuint, Program*> ProgramMap;
-    ProgramMap mProgramMap;
-    HandleAllocator mProgramShaderHandleAllocator;
-
-    typedef stdext::hash_map<GLuint, Texture*> TextureMap;
-    TextureMap mTextureMap;
-    HandleAllocator mTextureHandleAllocator;
-
-    typedef stdext::hash_map<GLuint, Renderbuffer*> RenderbufferMap;
-    RenderbufferMap mRenderbufferMap;
-    HandleAllocator mRenderbufferHandleAllocator;
-};
-
-}
-
-#endif // LIBGLESV2_RESOURCEMANAGER_H_
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.cpp b/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.cpp
deleted file mode 100644
index 57fd3d5..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.cpp
+++ /dev/null
@@ -1,584 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Shader.cpp: Implements the gl::Shader class and its  derived classes
-// VertexShader and FragmentShader. Implements GL shader objects and related
-// functionality. [OpenGL ES 2.0.24] section 2.10 page 24 and section 3.8 page 84.
-
-#include "libGLESv2/Shader.h"
-
-#include <string>
-
-#include "GLSLANG/Shaderlang.h"
-#include "libGLESv2/main.h"
-#include "libGLESv2/utilities.h"
-
-namespace gl
-{
-void *Shader::mFragmentCompiler = NULL;
-void *Shader::mVertexCompiler = NULL;
-
-Shader::Shader(ResourceManager *manager, GLuint handle) : mHandle(handle), mResourceManager(manager)
-{
-    mSource = NULL;
-    mHlsl = NULL;
-    mInfoLog = NULL;
-
-    uncompile();
-    initializeCompiler();
-
-    mRefCount = 0;
-    mDeleteStatus = false;
-}
-
-Shader::~Shader()
-{
-    delete[] mSource;
-    delete[] mHlsl;
-    delete[] mInfoLog;
-}
-
-GLuint Shader::getHandle() const
-{
-    return mHandle;
-}
-
-void Shader::setSource(GLsizei count, const char **string, const GLint *length)
-{
-    delete[] mSource;
-    int totalLength = 0;
-
-    for (int i = 0; i < count; i++)
-    {
-        if (length && length[i] >= 0)
-        {
-            totalLength += length[i];
-        }
-        else
-        {
-            totalLength += (int)strlen(string[i]);
-        }
-    }
-
-    mSource = new char[totalLength + 1];
-    char *code = mSource;
-
-    for (int i = 0; i < count; i++)
-    {
-        int stringLength;
-
-        if (length && length[i] >= 0)
-        {
-            stringLength = length[i];
-        }
-        else
-        {
-            stringLength = (int)strlen(string[i]);
-        }
-
-        strncpy(code, string[i], stringLength);
-        code += stringLength;
-    }
-
-    mSource[totalLength] = '\0';
-}
-
-int Shader::getInfoLogLength() const
-{
-    if (!mInfoLog)
-    {
-        return 0;
-    }
-    else
-    {
-       return strlen(mInfoLog) + 1;
-    }
-}
-
-void Shader::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog)
-{
-    int index = 0;
-
-    if (bufSize > 0)
-    {
-        if (mInfoLog)
-        {
-            index = std::min(bufSize - 1, (int)strlen(mInfoLog));
-            memcpy(infoLog, mInfoLog, index);
-        }
-
-        infoLog[index] = '\0';
-    }
-
-    if (length)
-    {
-        *length = index;
-    }
-}
-
-int Shader::getSourceLength() const
-{
-    if (!mSource)
-    {
-        return 0;
-    }
-    else
-    {
-       return strlen(mSource) + 1;
-    }
-}
-
-int Shader::getTranslatedSourceLength() const
-{
-    if (!mHlsl)
-    {
-        return 0;
-    }
-    else
-    {
-       return strlen(mHlsl) + 1;
-    }
-}
-
-void Shader::getSourceImpl(char *source, GLsizei bufSize, GLsizei *length, char *buffer)
-{
-    int index = 0;
-
-    if (bufSize > 0)
-    {
-        if (source)
-        {
-            index = std::min(bufSize - 1, (int)strlen(source));
-            memcpy(buffer, source, index);
-        }
-
-        buffer[index] = '\0';
-    }
-
-    if (length)
-    {
-        *length = index;
-    }
-}
-
-void Shader::getSource(GLsizei bufSize, GLsizei *length, char *buffer)
-{
-    getSourceImpl(mSource, bufSize, length, buffer);
-}
-
-void Shader::getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer)
-{
-    getSourceImpl(mHlsl, bufSize, length, buffer);
-}
-
-bool Shader::isCompiled()
-{
-    return mHlsl != NULL;
-}
-
-const char *Shader::getHLSL()
-{
-    return mHlsl;
-}
-
-void Shader::addRef()
-{
-    mRefCount++;
-}
-
-void Shader::release()
-{
-    mRefCount--;
-
-    if (mRefCount == 0 && mDeleteStatus)
-    {
-        mResourceManager->deleteShader(mHandle);
-    }
-}
-
-unsigned int Shader::getRefCount() const
-{
-    return mRefCount;
-}
-
-bool Shader::isFlaggedForDeletion() const
-{
-    return mDeleteStatus;
-}
-
-void Shader::flagForDeletion()
-{
-    mDeleteStatus = true;
-}
-
-// Perform a one-time initialization of the shader compiler (or after being destructed by releaseCompiler)
-void Shader::initializeCompiler()
-{
-    if (!mFragmentCompiler)
-    {
-        int result = ShInitialize();
-
-        if (result)
-        {
-            ShBuiltInResources resources;
-            ShInitBuiltInResources(&resources);
-            Context *context = getContext();
-
-            resources.MaxVertexAttribs = MAX_VERTEX_ATTRIBS;
-            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);
-        }
-    }
-}
-
-void Shader::releaseCompiler()
-{
-    ShDestruct(mFragmentCompiler);
-    ShDestruct(mVertexCompiler);
-
-    mFragmentCompiler = NULL;
-    mVertexCompiler = NULL;
-
-    ShFinalize();
-}
-
-void Shader::parseVaryings()
-{
-    if (mHlsl)
-    {
-        const char *input = strstr(mHlsl, "// Varyings") + 12;
-
-        while(true)
-        {
-            char varyingType[256];
-            char varyingName[256];
-
-            int matches = sscanf(input, "static %255s %255s", varyingType, varyingName);
-
-            if (matches != 2)
-            {
-                break;
-            }
-
-            char *array = strstr(varyingName, "[");
-            int size = 1;
-
-            if (array)
-            {
-                size = atoi(array + 1);
-                *array = '\0';
-            }
-
-            mVaryings.push_back(Varying(parseType(varyingType), varyingName, size, array != NULL));
-
-            input = strstr(input, ";") + 2;
-        }
-
-        mUsesFragCoord = strstr(mHlsl, "GL_USES_FRAG_COORD") != NULL;
-        mUsesFrontFacing = strstr(mHlsl, "GL_USES_FRONT_FACING") != NULL;
-        mUsesPointSize = strstr(mHlsl, "GL_USES_POINT_SIZE") != NULL;
-        mUsesPointCoord = strstr(mHlsl, "GL_USES_POINT_COORD") != NULL;
-    }
-}
-
-// initialize/clean up previous state
-void Shader::uncompile()
-{
-    // set by compileToHLSL
-    delete[] mHlsl;
-    mHlsl = NULL;
-    delete[] mInfoLog;
-    mInfoLog = NULL;
-
-    // set by parseVaryings
-    mVaryings.clear();
-
-    mUsesFragCoord = false;
-    mUsesFrontFacing = false;
-    mUsesPointSize = false;
-    mUsesPointCoord = false;
-}
-
-void Shader::compileToHLSL(void *compiler)
-{
-    // ensure we don't pass a NULL source to the compiler
-    char *source = "\0";
-    if (mSource)
-    {
-        source = mSource;
-    }
-
-    // ensure the compiler is loaded
-    initializeCompiler();
-
-    int compileOptions = SH_OBJECT_CODE;
-    std::string sourcePath;
-    if (perfActive())
-    {
-        sourcePath = getTempPath();
-        writeFile(sourcePath.c_str(), source, strlen(source));
-        compileOptions |= SH_LINE_DIRECTIVES;
-    }
-
-    int result;
-    if (sourcePath.empty())
-    {
-        result = ShCompile(compiler, &source, 1, compileOptions);
-    }
-    else
-    {
-        const char* sourceStrings[2] =
-        {
-            sourcePath.c_str(),
-            source
-        };
-
-        result = ShCompile(compiler, sourceStrings, 2, compileOptions | SH_SOURCE_PATH);
-    }
-
-    if (result)
-    {
-        int objCodeLen = 0;
-        ShGetInfo(compiler, SH_OBJECT_CODE_LENGTH, &objCodeLen);
-        mHlsl = new char[objCodeLen];
-        ShGetObjectCode(compiler, mHlsl);
-    }
-    else
-    {
-        int infoLogLen = 0;
-        ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &infoLogLen);
-        mInfoLog = new char[infoLogLen];
-        ShGetInfoLog(compiler, mInfoLog);
-
-        TRACE("\n%s", mInfoLog);
-    }
-}
-
-GLenum Shader::parseType(const std::string &type)
-{
-    if (type == "float")
-    {
-        return GL_FLOAT;
-    }
-    else if (type == "float2")
-    {
-        return GL_FLOAT_VEC2;
-    }
-    else if (type == "float3")
-    {
-        return GL_FLOAT_VEC3;
-    }
-    else if (type == "float4")
-    {
-        return GL_FLOAT_VEC4;
-    }
-    else if (type == "float2x2")
-    {
-        return GL_FLOAT_MAT2;
-    }
-    else if (type == "float3x3")
-    {
-        return GL_FLOAT_MAT3;
-    }
-    else if (type == "float4x4")
-    {
-        return GL_FLOAT_MAT4;
-    }
-    else UNREACHABLE();
-
-    return GL_NONE;
-}
-
-// true if varying x has a higher priority in packing than y
-bool Shader::compareVarying(const Varying &x, const Varying &y)
-{
-    if(x.type == y.type)
-    {
-        return x.size > y.size;
-    }
-
-    switch (x.type)
-    {
-      case GL_FLOAT_MAT4: return true;
-      case GL_FLOAT_MAT2:
-        switch(y.type)
-        {
-          case GL_FLOAT_MAT4: return false;
-          case GL_FLOAT_MAT2: return true;
-          case GL_FLOAT_VEC4: return true;
-          case GL_FLOAT_MAT3: return true;
-          case GL_FLOAT_VEC3: return true;
-          case GL_FLOAT_VEC2: return true;
-          case GL_FLOAT:      return true;
-          default: UNREACHABLE();
-        }
-        break;
-      case GL_FLOAT_VEC4:
-        switch(y.type)
-        {
-          case GL_FLOAT_MAT4: return false;
-          case GL_FLOAT_MAT2: return false;
-          case GL_FLOAT_VEC4: return true;
-          case GL_FLOAT_MAT3: return true;
-          case GL_FLOAT_VEC3: return true;
-          case GL_FLOAT_VEC2: return true;
-          case GL_FLOAT:      return true;
-          default: UNREACHABLE();
-        }
-        break;
-      case GL_FLOAT_MAT3:
-        switch(y.type)
-        {
-          case GL_FLOAT_MAT4: return false;
-          case GL_FLOAT_MAT2: return false;
-          case GL_FLOAT_VEC4: return false;
-          case GL_FLOAT_MAT3: return true;
-          case GL_FLOAT_VEC3: return true;
-          case GL_FLOAT_VEC2: return true;
-          case GL_FLOAT:      return true;
-          default: UNREACHABLE();
-        }
-        break;
-      case GL_FLOAT_VEC3:
-        switch(y.type)
-        {
-          case GL_FLOAT_MAT4: return false;
-          case GL_FLOAT_MAT2: return false;
-          case GL_FLOAT_VEC4: return false;
-          case GL_FLOAT_MAT3: return false;
-          case GL_FLOAT_VEC3: return true;
-          case GL_FLOAT_VEC2: return true;
-          case GL_FLOAT:      return true;
-          default: UNREACHABLE();
-        }
-        break;
-      case GL_FLOAT_VEC2:
-        switch(y.type)
-        {
-          case GL_FLOAT_MAT4: return false;
-          case GL_FLOAT_MAT2: return false;
-          case GL_FLOAT_VEC4: return false;
-          case GL_FLOAT_MAT3: return false;
-          case GL_FLOAT_VEC3: return false;
-          case GL_FLOAT_VEC2: return true;
-          case GL_FLOAT:      return true;
-          default: UNREACHABLE();
-        }
-        break;
-      case GL_FLOAT: return false;
-      default: UNREACHABLE();
-    }
-
-    return false;
-}
-
-VertexShader::VertexShader(ResourceManager *manager, GLuint handle) : Shader(manager, handle)
-{
-}
-
-VertexShader::~VertexShader()
-{
-}
-
-GLenum VertexShader::getType()
-{
-    return GL_VERTEX_SHADER;
-}
-
-void VertexShader::uncompile()
-{
-    Shader::uncompile();
-
-    // set by ParseAttributes
-    mAttributes.clear();
-};
-
-void VertexShader::compile()
-{
-    uncompile();
-
-    compileToHLSL(mVertexCompiler);
-    parseAttributes();
-    parseVaryings();
-}
-
-int VertexShader::getSemanticIndex(const std::string &attributeName)
-{
-    if (!attributeName.empty())
-    {
-        int semanticIndex = 0;
-        for (AttributeArray::iterator attribute = mAttributes.begin(); attribute != mAttributes.end(); attribute++)
-        {
-            if (attribute->name == attributeName)
-            {
-                return semanticIndex;
-            }
-
-            semanticIndex += VariableRowCount(attribute->type);
-        }
-    }
-
-    return -1;
-}
-
-void VertexShader::parseAttributes()
-{
-    const char *hlsl = getHLSL();
-    if (hlsl)
-    {
-        const char *input = strstr(hlsl, "// Attributes") + 14;
-
-        while(true)
-        {
-            char attributeType[256];
-            char attributeName[256];
-
-            int matches = sscanf(input, "static %255s _%255s", attributeType, attributeName);
-
-            if (matches != 2)
-            {
-                break;
-            }
-
-            mAttributes.push_back(Attribute(parseType(attributeType), attributeName));
-
-            input = strstr(input, ";") + 2;
-        }
-    }
-}
-
-FragmentShader::FragmentShader(ResourceManager *manager, GLuint handle) : Shader(manager, handle)
-{
-}
-
-FragmentShader::~FragmentShader()
-{
-}
-
-GLenum FragmentShader::getType()
-{
-    return GL_FRAGMENT_SHADER;
-}
-
-void FragmentShader::compile()
-{
-    uncompile();
-
-    compileToHLSL(mFragmentCompiler);
-    parseVaryings();
-    mVaryings.sort(compareVarying);
-}
-}
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.h b/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.h
deleted file mode 100644
index 43083ec..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.h
+++ /dev/null
@@ -1,166 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Shader.h: Defines the abstract gl::Shader class and its concrete derived
-// classes VertexShader and FragmentShader. Implements GL shader objects and
-// related functionality. [OpenGL ES 2.0.24] section 2.10 page 24 and section
-// 3.8 page 84.
-
-#ifndef LIBGLESV2_SHADER_H_
-#define LIBGLESV2_SHADER_H_
-
-#define GL_APICALL
-#include <GLES2/gl2.h>
-#include <d3dx9.h>
-#include <list>
-#include <vector>
-
-#include "libGLESv2/ResourceManager.h"
-
-namespace gl
-{
-struct Varying
-{
-    Varying(GLenum type, const std::string &name, int size, bool array)
-        : type(type), name(name), size(size), array(array), reg(-1), col(-1)
-    {
-    }
-
-    GLenum type;
-    std::string name;
-    int size;   // Number of 'type' elements
-    bool array;
-
-    int reg;    // First varying register, assigned during link
-    int col;    // First register element, assigned during link
-};
-
-typedef std::list<Varying> VaryingList;
-
-class Shader
-{
-    friend class ProgramBinary;
-
-  public:
-    Shader(ResourceManager *manager, GLuint handle);
-
-    virtual ~Shader();
-
-    virtual GLenum getType() = 0;
-    GLuint getHandle() const;
-
-    void deleteSource();
-    void setSource(GLsizei count, const char **string, const GLint *length);
-    int getInfoLogLength() const;
-    void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog);
-    int getSourceLength() const;
-    void getSource(GLsizei bufSize, GLsizei *length, char *buffer);
-    int getTranslatedSourceLength() const;
-    void getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer);
-
-    virtual void compile() = 0;
-    virtual void uncompile();
-    bool isCompiled();
-    const char *getHLSL();
-
-    void addRef();
-    void release();
-    unsigned int getRefCount() const;
-    bool isFlaggedForDeletion() const;
-    void flagForDeletion();
-
-    static void releaseCompiler();
-
-  protected:
-    void parseVaryings();
-
-    void compileToHLSL(void *compiler);
-
-    void getSourceImpl(char *source, GLsizei bufSize, GLsizei *length, char *buffer);
-
-    static GLenum parseType(const std::string &type);
-    static bool compareVarying(const Varying &x, const Varying &y);
-
-    VaryingList mVaryings;
-
-    bool mUsesFragCoord;
-    bool mUsesFrontFacing;
-    bool mUsesPointSize;
-    bool mUsesPointCoord;
-
-    static void *mFragmentCompiler;
-    static void *mVertexCompiler;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Shader);
-
-    void initializeCompiler();
-
-    const GLuint mHandle;
-    unsigned int mRefCount;     // Number of program objects this shader is attached to
-    bool mDeleteStatus;         // Flag to indicate that the shader can be deleted when no longer in use
-
-    char *mSource;
-    char *mHlsl;
-    char *mInfoLog;
-
-    ResourceManager *mResourceManager;
-};
-
-struct Attribute
-{
-    Attribute() : type(GL_NONE), name("")
-    {
-    }
-
-    Attribute(GLenum type, const std::string &name) : type(type), name(name)
-    {
-    }
-
-    GLenum type;
-    std::string name;
-};
-
-typedef std::vector<Attribute> AttributeArray;
-
-class VertexShader : public Shader
-{
-    friend class ProgramBinary;
-
-  public:
-    VertexShader(ResourceManager *manager, GLuint handle);
-
-    ~VertexShader();
-
-    virtual GLenum getType();
-    virtual void compile();
-    virtual void uncompile();
-    int getSemanticIndex(const std::string &attributeName);
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(VertexShader);
-
-    void parseAttributes();
-
-    AttributeArray mAttributes;
-};
-
-class FragmentShader : public Shader
-{
-  public:
-    FragmentShader(ResourceManager *manager, GLuint handle);
-
-    ~FragmentShader();
-
-    virtual GLenum getType();
-    virtual void compile();
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(FragmentShader);
-};
-}
-
-#endif   // LIBGLESV2_SHADER_H_
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.cpp b/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.cpp
deleted file mode 100644
index 6ff2453..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.cpp
+++ /dev/null
@@ -1,2909 +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.
-//
-
-// Texture.cpp: Implements the gl::Texture class and its derived classes
-// Texture2D and TextureCubeMap. Implements GL texture objects and related
-// functionality. [OpenGL ES 2.0.24] section 3.7 page 63.
-
-#include "libGLESv2/Texture.h"
-
-#include <d3dx9tex.h>
-
-#include <algorithm>
-#include <intrin.h>
-
-#include "common/debug.h"
-
-#include "libEGL/Display.h"
-
-#include "libGLESv2/main.h"
-#include "libGLESv2/mathutil.h"
-#include "libGLESv2/utilities.h"
-#include "libGLESv2/Blit.h"
-#include "libGLESv2/Framebuffer.h"
-
-namespace gl
-{
-unsigned int TextureStorage::mCurrentTextureSerial = 1;
-
-static D3DFORMAT ConvertTextureFormatType(GLenum format, GLenum type)
-{
-    if (IsDepthTexture(format))
-    {
-        return D3DFMT_INTZ;
-    }
-    else if (format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT ||
-             format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT)
-    {
-        return D3DFMT_DXT1;
-    }
-    else if (format == GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE)
-    {
-        return D3DFMT_DXT3;
-    }
-    else if (format == GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE)
-    {
-        return D3DFMT_DXT5;
-    }
-    else if (type == GL_FLOAT)
-    {
-        return D3DFMT_A32B32G32R32F;
-    }
-    else if (type == GL_HALF_FLOAT_OES)
-    {
-        return D3DFMT_A16B16G16R16F;
-    }
-    else if (type == GL_UNSIGNED_BYTE)
-    {
-        if (format == GL_LUMINANCE && getContext()->supportsLuminanceTextures())
-        {
-            return D3DFMT_L8;
-        }
-        else if (format == GL_LUMINANCE_ALPHA && getContext()->supportsLuminanceAlphaTextures())
-        {
-            return D3DFMT_A8L8;
-        }
-        else if (format == GL_RGB)
-        {
-            return D3DFMT_X8R8G8B8;
-        }
-
-        return D3DFMT_A8R8G8B8;
-    }
-
-    return D3DFMT_A8R8G8B8;
-}
-
-static bool IsTextureFormatRenderable(D3DFORMAT format)
-{
-    if (format == D3DFMT_INTZ)
-    {
-        return true;
-    }
-    switch(format)
-    {
-      case D3DFMT_L8:
-      case D3DFMT_A8L8:
-      case D3DFMT_DXT1:
-      case D3DFMT_DXT3:
-      case D3DFMT_DXT5:
-        return false;
-      case D3DFMT_A8R8G8B8:
-      case D3DFMT_X8R8G8B8:
-      case D3DFMT_A16B16G16R16F:
-      case D3DFMT_A32B32G32R32F:
-        return true;
-      default:
-        UNREACHABLE();
-    }
-
-    return false;
-}
-
-static inline DWORD GetTextureUsage(D3DFORMAT d3dfmt, GLenum glusage, bool forceRenderable)
-{
-    DWORD d3dusage = 0;
-
-    if (d3dfmt == D3DFMT_INTZ)
-    {
-        d3dusage |= D3DUSAGE_DEPTHSTENCIL;
-    }
-    else if(forceRenderable || (IsTextureFormatRenderable(d3dfmt) && (glusage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE)))
-    {
-        d3dusage |= D3DUSAGE_RENDERTARGET;
-    }
-    return d3dusage;
-}
-
-Image::Image()
-{
-    mWidth = 0; 
-    mHeight = 0;
-    mFormat = GL_NONE;
-    mType = GL_UNSIGNED_BYTE;
-
-    mSurface = NULL;
-
-    mDirty = false;
-
-    mD3DPool = D3DPOOL_SYSTEMMEM;
-    mD3DFormat = D3DFMT_UNKNOWN;
-}
-
-Image::~Image()
-{
-    if (mSurface)
-    {
-        mSurface->Release();
-    }
-}
-
-bool Image::redefine(GLenum format, GLsizei width, GLsizei height, GLenum type, bool forceRelease)
-{
-    if (mWidth != width ||
-        mHeight != height ||
-        mFormat != format ||
-        mType != type ||
-        forceRelease)
-    {
-        mWidth = width;
-        mHeight = height;
-        mFormat = format;
-        mType = type;
-        // compute the d3d format that will be used
-        mD3DFormat = ConvertTextureFormatType(mFormat, mType);
-
-        if (mSurface)
-        {
-            mSurface->Release();
-            mSurface = NULL;
-        }
-
-        return true;
-    }
-
-    return false;
-}
-
-void Image::createSurface()
-{
-    if(mSurface)
-    {
-        return;
-    }
-
-    IDirect3DTexture9 *newTexture = NULL;
-    IDirect3DSurface9 *newSurface = NULL;
-    const D3DPOOL poolToUse = D3DPOOL_SYSTEMMEM;
-    const D3DFORMAT d3dFormat = getD3DFormat();
-    ASSERT(d3dFormat != D3DFMT_INTZ); // We should never get here for depth textures
-
-    if (mWidth != 0 && mHeight != 0)
-    {
-        int levelToFetch = 0;
-        GLsizei requestWidth = mWidth;
-        GLsizei requestHeight = mHeight;
-        if (IsCompressed(mFormat) && (mWidth % 4 != 0 || mHeight % 4 != 0))
-        {
-            bool isMult4 = false;
-            int upsampleCount = 0;
-            while (!isMult4)
-            {
-                requestWidth <<= 1;
-                requestHeight <<= 1;
-                upsampleCount++;
-                if (requestWidth % 4 == 0 && requestHeight % 4 == 0)
-                {
-                    isMult4 = true;
-                }
-            }
-            levelToFetch = upsampleCount;
-        }
-
-        HRESULT result = getDevice()->CreateTexture(requestWidth, requestHeight, levelToFetch + 1, NULL, d3dFormat,
-                                                    poolToUse, &newTexture, NULL);
-
-        if (FAILED(result))
-        {
-            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
-            ERR("Creating image surface failed.");
-            return error(GL_OUT_OF_MEMORY);
-        }
-
-        newTexture->GetSurfaceLevel(levelToFetch, &newSurface);
-        newTexture->Release();
-    }
-
-    mSurface = newSurface;
-    mDirty = false;
-    mD3DPool = poolToUse;
-}
-
-HRESULT Image::lock(D3DLOCKED_RECT *lockedRect, const RECT *rect)
-{
-    createSurface();
-
-    HRESULT result = D3DERR_INVALIDCALL;
-
-    if (mSurface)
-    {
-        result = mSurface->LockRect(lockedRect, rect, 0);
-        ASSERT(SUCCEEDED(result));
-
-        mDirty = true;
-    }
-
-    return result;
-}
-
-void Image::unlock()
-{
-    if (mSurface)
-    {
-        HRESULT result = mSurface->UnlockRect();
-        ASSERT(SUCCEEDED(result));
-    }
-}
-
-bool Image::isRenderableFormat() const
-{    
-    return IsTextureFormatRenderable(getD3DFormat());
-}
-
-D3DFORMAT Image::getD3DFormat() const
-{
-    // this should only happen if the image hasn't been redefined first
-    // which would be a bug by the caller
-    ASSERT(mD3DFormat != D3DFMT_UNKNOWN);
-
-    return mD3DFormat;
-}
-
-IDirect3DSurface9 *Image::getSurface()
-{
-    createSurface();
-
-    return mSurface;
-}
-
-void Image::setManagedSurface(IDirect3DSurface9 *surface)
-{
-    if (mSurface)
-    {
-        D3DXLoadSurfaceFromSurface(surface, NULL, NULL, mSurface, NULL, NULL, D3DX_FILTER_BOX, 0);
-        mSurface->Release();
-    }
-
-    D3DSURFACE_DESC desc;
-    surface->GetDesc(&desc);
-    ASSERT(desc.Pool == D3DPOOL_MANAGED);
-
-    mSurface = surface;
-    mD3DPool = desc.Pool;
-}
-
-void Image::updateSurface(IDirect3DSurface9 *destSurface, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
-{
-    IDirect3DSurface9 *sourceSurface = getSurface();
-
-    if (sourceSurface && sourceSurface != destSurface)
-    {
-        RECT rect;
-        rect.left = xoffset;
-        rect.top = yoffset;
-        rect.right = xoffset + width;
-        rect.bottom = yoffset + height;
-
-        if (mD3DPool == D3DPOOL_MANAGED)
-        {
-            HRESULT result = D3DXLoadSurfaceFromSurface(destSurface, NULL, &rect, sourceSurface, NULL, &rect, D3DX_FILTER_BOX, 0);
-            ASSERT(SUCCEEDED(result));
-        }
-        else
-        {
-            // UpdateSurface: source must be SYSTEMMEM, dest must be DEFAULT pools 
-            POINT point = {rect.left, rect.top};
-            HRESULT result = getDevice()->UpdateSurface(sourceSurface, &rect, destSurface, &point);
-            ASSERT(SUCCEEDED(result));
-        }
-    }
-}
-
-// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input
-// into the target pixel rectangle.
-void Image::loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum type,
-                     GLint unpackAlignment, const void *input)
-{
-    RECT lockRect =
-    {
-        xoffset, yoffset,
-        xoffset + width, yoffset + height
-    };
-
-    D3DLOCKED_RECT locked;
-    HRESULT result = lock(&locked, &lockRect);
-    if (FAILED(result))
-    {
-        return;
-    }
-
-    GLsizei inputPitch = ComputePitch(width, mFormat, type, unpackAlignment);
-
-    switch (type)
-    {
-      case GL_UNSIGNED_BYTE:
-        switch (mFormat)
-        {
-          case GL_ALPHA:
-            if (supportsSSE2())
-            {
-                loadAlphaDataSSE2(width, height, inputPitch, input, locked.Pitch, locked.pBits);
-            }
-            else
-            {
-                loadAlphaData(width, height, inputPitch, input, locked.Pitch, locked.pBits);
-            }
-            break;
-          case GL_LUMINANCE:
-            loadLuminanceData(width, height, inputPitch, input, locked.Pitch, locked.pBits, getD3DFormat() == D3DFMT_L8);
-            break;
-          case GL_LUMINANCE_ALPHA:
-            loadLuminanceAlphaData(width, height, inputPitch, input, locked.Pitch, locked.pBits, getD3DFormat() == D3DFMT_A8L8);
-            break;
-          case GL_RGB:
-            loadRGBUByteData(width, height, inputPitch, input, locked.Pitch, locked.pBits);
-            break;
-          case GL_RGBA:
-            if (supportsSSE2())
-            {
-                loadRGBAUByteDataSSE2(width, height, inputPitch, input, locked.Pitch, locked.pBits);
-            }
-            else
-            {
-                loadRGBAUByteData(width, height, inputPitch, input, locked.Pitch, locked.pBits);
-            }
-            break;
-          case GL_BGRA_EXT:
-            loadBGRAData(width, height, inputPitch, input, locked.Pitch, locked.pBits);
-            break;
-          default: UNREACHABLE();
-        }
-        break;
-      case GL_UNSIGNED_SHORT_5_6_5:
-        switch (mFormat)
-        {
-          case GL_RGB:
-            loadRGB565Data(width, height, inputPitch, input, locked.Pitch, locked.pBits);
-            break;
-          default: UNREACHABLE();
-        }
-        break;
-      case GL_UNSIGNED_SHORT_4_4_4_4:
-        switch (mFormat)
-        {
-          case GL_RGBA:
-            loadRGBA4444Data(width, height, inputPitch, input, locked.Pitch, locked.pBits);
-            break;
-          default: UNREACHABLE();
-        }
-        break;
-      case GL_UNSIGNED_SHORT_5_5_5_1:
-        switch (mFormat)
-        {
-          case GL_RGBA:
-            loadRGBA5551Data(width, height, inputPitch, input, locked.Pitch, locked.pBits);
-            break;
-          default: UNREACHABLE();
-        }
-        break;
-      case GL_FLOAT:
-        switch (mFormat)
-        {
-          // float textures are converted to RGBA, not BGRA, as they're stored that way in D3D
-          case GL_ALPHA:
-            loadAlphaFloatData(width, height, inputPitch, input, locked.Pitch, locked.pBits);
-            break;
-          case GL_LUMINANCE:
-            loadLuminanceFloatData(width, height, inputPitch, input, locked.Pitch, locked.pBits);
-            break;
-          case GL_LUMINANCE_ALPHA:
-            loadLuminanceAlphaFloatData(width, height, inputPitch, input, locked.Pitch, locked.pBits);
-            break;
-          case GL_RGB:
-            loadRGBFloatData(width, height, inputPitch, input, locked.Pitch, locked.pBits);
-            break;
-          case GL_RGBA:
-            loadRGBAFloatData(width, height, inputPitch, input, locked.Pitch, locked.pBits);
-            break;
-          default: UNREACHABLE();
-        }
-        break;
-      case GL_HALF_FLOAT_OES:
-        switch (mFormat)
-        {
-          // float textures are converted to RGBA, not BGRA, as they're stored that way in D3D
-          case GL_ALPHA:
-            loadAlphaHalfFloatData(width, height, inputPitch, input, locked.Pitch, locked.pBits);
-            break;
-          case GL_LUMINANCE:
-            loadLuminanceHalfFloatData(width, height, inputPitch, input, locked.Pitch, locked.pBits);
-            break;
-          case GL_LUMINANCE_ALPHA:
-            loadLuminanceAlphaHalfFloatData(width, height, inputPitch, input, locked.Pitch, locked.pBits);
-            break;
-          case GL_RGB:
-            loadRGBHalfFloatData(width, height, inputPitch, input, locked.Pitch, locked.pBits);
-            break;
-          case GL_RGBA:
-            loadRGBAHalfFloatData(width, height, inputPitch, input, locked.Pitch, locked.pBits);
-            break;
-          default: UNREACHABLE();
-        }
-        break;
-      default: UNREACHABLE();
-    }
-
-    unlock();
-}
-
-void Image::loadAlphaData(GLsizei width, GLsizei height,
-                          int inputPitch, const void *input, size_t outputPitch, void *output) const
-{
-    const unsigned char *source = NULL;
-    unsigned char *dest = NULL;
-    
-    for (int y = 0; y < height; y++)
-    {
-        source = static_cast<const unsigned char*>(input) + y * inputPitch;
-        dest = static_cast<unsigned char*>(output) + y * outputPitch;
-        for (int x = 0; x < width; x++)
-        {
-            dest[4 * x + 0] = 0;
-            dest[4 * x + 1] = 0;
-            dest[4 * x + 2] = 0;
-            dest[4 * x + 3] = source[x];
-        }
-    }
-}
-
-void Image::loadAlphaDataSSE2(GLsizei width, GLsizei height,
-                              int inputPitch, const void *input, size_t outputPitch, void *output) const
-{
-    const unsigned char *source = NULL;
-    unsigned int *dest = NULL;
-    __m128i zeroWide = _mm_setzero_si128();
-
-    for (int y = 0; y < height; y++)
-    {
-        source = static_cast<const unsigned char*>(input) + y * inputPitch;
-        dest = reinterpret_cast<unsigned int*>(static_cast<unsigned char*>(output) + y * outputPitch);
-
-        int x;
-        // Make output writes aligned
-        for (x = 0; ((reinterpret_cast<intptr_t>(&dest[x]) & 0xF) != 0 && x < width); x++)
-        {
-            dest[x] = static_cast<unsigned int>(source[x]) << 24;
-        }
-
-        for (; x + 7 < width; x += 8)
-        {
-            __m128i sourceData = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(&source[x]));
-            // Interleave each byte to 16bit, make the lower byte to zero
-            sourceData = _mm_unpacklo_epi8(zeroWide, sourceData);
-            // Interleave each 16bit to 32bit, make the lower 16bit to zero
-            __m128i lo = _mm_unpacklo_epi16(zeroWide, sourceData);
-            __m128i hi = _mm_unpackhi_epi16(zeroWide, sourceData);
-
-            _mm_store_si128(reinterpret_cast<__m128i*>(&dest[x]), lo);
-            _mm_store_si128(reinterpret_cast<__m128i*>(&dest[x + 4]), hi);
-        }
-
-        // Handle the remainder
-        for (; x < width; x++)
-        {
-            dest[x] = static_cast<unsigned int>(source[x]) << 24;
-        }
-    }
-}
-
-void Image::loadAlphaFloatData(GLsizei width, GLsizei height,
-                               int inputPitch, const void *input, size_t outputPitch, void *output) const
-{
-    const float *source = NULL;
-    float *dest = NULL;
-
-    for (int y = 0; y < height; y++)
-    {
-        source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
-        dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
-        for (int x = 0; x < width; x++)
-        {
-            dest[4 * x + 0] = 0;
-            dest[4 * x + 1] = 0;
-            dest[4 * x + 2] = 0;
-            dest[4 * x + 3] = source[x];
-        }
-    }
-}
-
-void Image::loadAlphaHalfFloatData(GLsizei width, GLsizei height,
-                                   int inputPitch, const void *input, size_t outputPitch, void *output) const
-{
-    const unsigned short *source = NULL;
-    unsigned short *dest = NULL;
-
-    for (int y = 0; y < height; y++)
-    {
-        source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
-        dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(output) + y * outputPitch);
-        for (int x = 0; x < width; x++)
-        {
-            dest[4 * x + 0] = 0;
-            dest[4 * x + 1] = 0;
-            dest[4 * x + 2] = 0;
-            dest[4 * x + 3] = source[x];
-        }
-    }
-}
-
-void Image::loadLuminanceData(GLsizei width, GLsizei height,
-                              int inputPitch, const void *input, size_t outputPitch, void *output, bool native) const
-{
-    const unsigned char *source = NULL;
-    unsigned char *dest = NULL;
-
-    for (int y = 0; y < height; y++)
-    {
-        source = static_cast<const unsigned char*>(input) + y * inputPitch;
-        dest = static_cast<unsigned char*>(output) + y * outputPitch;
-
-        if (!native)   // BGRA8 destination format
-        {
-            for (int x = 0; x < width; x++)
-            {
-                dest[4 * x + 0] = source[x];
-                dest[4 * x + 1] = source[x];
-                dest[4 * x + 2] = source[x];
-                dest[4 * x + 3] = 0xFF;
-            }
-        }
-        else   // L8 destination format
-        {
-            memcpy(dest, source, width);
-        }
-    }
-}
-
-void Image::loadLuminanceFloatData(GLsizei width, GLsizei height,
-                                   int inputPitch, const void *input, size_t outputPitch, void *output) const
-{
-    const float *source = NULL;
-    float *dest = NULL;
-
-    for (int y = 0; y < height; y++)
-    {
-        source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
-        dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
-        for (int x = 0; x < width; x++)
-        {
-            dest[4 * x + 0] = source[x];
-            dest[4 * x + 1] = source[x];
-            dest[4 * x + 2] = source[x];
-            dest[4 * x + 3] = 1.0f;
-        }
-    }
-}
-
-void Image::loadLuminanceHalfFloatData(GLsizei width, GLsizei height,
-                                       int inputPitch, const void *input, size_t outputPitch, void *output) const
-{
-    const unsigned short *source = NULL;
-    unsigned short *dest = NULL;
-
-    for (int y = 0; y < height; y++)
-    {
-        source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
-        dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(output) + y * outputPitch);
-        for (int x = 0; x < width; x++)
-        {
-            dest[4 * x + 0] = source[x];
-            dest[4 * x + 1] = source[x];
-            dest[4 * x + 2] = source[x];
-            dest[4 * x + 3] = 0x3C00; // SEEEEEMMMMMMMMMM, S = 0, E = 15, M = 0: 16bit flpt representation of 1
-        }
-    }
-}
-
-void Image::loadLuminanceAlphaData(GLsizei width, GLsizei height,
-                                   int inputPitch, const void *input, size_t outputPitch, void *output, bool native) const
-{
-    const unsigned char *source = NULL;
-    unsigned char *dest = NULL;
-
-    for (int y = 0; y < height; y++)
-    {
-        source = static_cast<const unsigned char*>(input) + y * inputPitch;
-        dest = static_cast<unsigned char*>(output) + y * outputPitch;
-        
-        if (!native)   // BGRA8 destination format
-        {
-            for (int x = 0; x < width; x++)
-            {
-                dest[4 * x + 0] = source[2*x+0];
-                dest[4 * x + 1] = source[2*x+0];
-                dest[4 * x + 2] = source[2*x+0];
-                dest[4 * x + 3] = source[2*x+1];
-            }
-        }
-        else
-        {
-            memcpy(dest, source, width * 2);
-        }
-    }
-}
-
-void Image::loadLuminanceAlphaFloatData(GLsizei width, GLsizei height,
-                                        int inputPitch, const void *input, size_t outputPitch, void *output) const
-{
-    const float *source = NULL;
-    float *dest = NULL;
-
-    for (int y = 0; y < height; y++)
-    {
-        source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
-        dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
-        for (int x = 0; x < width; x++)
-        {
-            dest[4 * x + 0] = source[2*x+0];
-            dest[4 * x + 1] = source[2*x+0];
-            dest[4 * x + 2] = source[2*x+0];
-            dest[4 * x + 3] = source[2*x+1];
-        }
-    }
-}
-
-void Image::loadLuminanceAlphaHalfFloatData(GLsizei width, GLsizei height,
-                                            int inputPitch, const void *input, size_t outputPitch, void *output) const
-{
-    const unsigned short *source = NULL;
-    unsigned short *dest = NULL;
-
-    for (int y = 0; y < height; y++)
-    {
-        source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
-        dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(output) + y * outputPitch);
-        for (int x = 0; x < width; x++)
-        {
-            dest[4 * x + 0] = source[2*x+0];
-            dest[4 * x + 1] = source[2*x+0];
-            dest[4 * x + 2] = source[2*x+0];
-            dest[4 * x + 3] = source[2*x+1];
-        }
-    }
-}
-
-void Image::loadRGBUByteData(GLsizei width, GLsizei height,
-                             int inputPitch, const void *input, size_t outputPitch, void *output) const
-{
-    const unsigned char *source = NULL;
-    unsigned char *dest = NULL;
-
-    for (int y = 0; y < height; y++)
-    {
-        source = static_cast<const unsigned char*>(input) + y * inputPitch;
-        dest = static_cast<unsigned char*>(output) + y * outputPitch;
-        for (int x = 0; x < width; x++)
-        {
-            dest[4 * x + 0] = source[x * 3 + 2];
-            dest[4 * x + 1] = source[x * 3 + 1];
-            dest[4 * x + 2] = source[x * 3 + 0];
-            dest[4 * x + 3] = 0xFF;
-        }
-    }
-}
-
-void Image::loadRGB565Data(GLsizei width, GLsizei height,
-                           int inputPitch, const void *input, size_t outputPitch, void *output) const
-{
-    const unsigned short *source = NULL;
-    unsigned char *dest = NULL;
-
-    for (int y = 0; y < height; y++)
-    {
-        source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
-        dest = static_cast<unsigned char*>(output) + y * outputPitch;
-        for (int x = 0; x < width; x++)
-        {
-            unsigned short rgba = source[x];
-            dest[4 * x + 0] = ((rgba & 0x001F) << 3) | ((rgba & 0x001F) >> 2);
-            dest[4 * x + 1] = ((rgba & 0x07E0) >> 3) | ((rgba & 0x07E0) >> 9);
-            dest[4 * x + 2] = ((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13);
-            dest[4 * x + 3] = 0xFF;
-        }
-    }
-}
-
-void Image::loadRGBFloatData(GLsizei width, GLsizei height,
-                             int inputPitch, const void *input, size_t outputPitch, void *output) const
-{
-    const float *source = NULL;
-    float *dest = NULL;
-
-    for (int y = 0; y < height; y++)
-    {
-        source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
-        dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
-        for (int x = 0; x < width; x++)
-        {
-            dest[4 * x + 0] = source[x * 3 + 0];
-            dest[4 * x + 1] = source[x * 3 + 1];
-            dest[4 * x + 2] = source[x * 3 + 2];
-            dest[4 * x + 3] = 1.0f;
-        }
-    }
-}
-
-void Image::loadRGBHalfFloatData(GLsizei width, GLsizei height,
-                                 int inputPitch, const void *input, size_t outputPitch, void *output) const
-{
-    const unsigned short *source = NULL;
-    unsigned short *dest = NULL;
-
-    for (int y = 0; y < height; y++)
-    {
-        source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
-        dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(output) + y * outputPitch);
-        for (int x = 0; x < width; x++)
-        {
-            dest[4 * x + 0] = source[x * 3 + 0];
-            dest[4 * x + 1] = source[x * 3 + 1];
-            dest[4 * x + 2] = source[x * 3 + 2];
-            dest[4 * x + 3] = 0x3C00; // SEEEEEMMMMMMMMMM, S = 0, E = 15, M = 0: 16bit flpt representation of 1
-        }
-    }
-}
-
-void Image::loadRGBAUByteDataSSE2(GLsizei width, GLsizei height,
-                                  int inputPitch, const void *input, size_t outputPitch, void *output) const
-{
-    const unsigned int *source = NULL;
-    unsigned int *dest = NULL;
-    __m128i brMask = _mm_set1_epi32(0x00ff00ff);
-
-    for (int y = 0; y < height; y++)
-    {
-        source = reinterpret_cast<const unsigned int*>(static_cast<const unsigned char*>(input) + y * inputPitch);
-        dest = reinterpret_cast<unsigned int*>(static_cast<unsigned char*>(output) + y * outputPitch);
-        int x = 0;
-
-        // Make output writes aligned
-        for (x = 0; ((reinterpret_cast<intptr_t>(&dest[x]) & 15) != 0) && x < width; x++)
-        {
-            unsigned int rgba = source[x];
-            dest[x] = (_rotl(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
-        }
-
-        for (; x + 3 < width; x += 4)
-        {
-            __m128i sourceData = _mm_loadu_si128(reinterpret_cast<const __m128i*>(&source[x]));
-            // Mask out g and a, which don't change
-            __m128i gaComponents = _mm_andnot_si128(brMask, sourceData);
-            // Mask out b and r
-            __m128i brComponents = _mm_and_si128(sourceData, brMask);
-            // Swap b and r
-            __m128i brSwapped = _mm_shufflehi_epi16(_mm_shufflelo_epi16(brComponents, _MM_SHUFFLE(2, 3, 0, 1)), _MM_SHUFFLE(2, 3, 0, 1));
-            __m128i result = _mm_or_si128(gaComponents, brSwapped);
-            _mm_store_si128(reinterpret_cast<__m128i*>(&dest[x]), result);
-        }
-
-        // Perform leftover writes
-        for (; x < width; x++)
-        {
-            unsigned int rgba = source[x];
-            dest[x] = (_rotl(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
-        }
-    }
-}
-
-void Image::loadRGBAUByteData(GLsizei width, GLsizei height,
-                              int inputPitch, const void *input, size_t outputPitch, void *output) const
-{
-    const unsigned int *source = NULL;
-    unsigned int *dest = NULL;
-    for (int y = 0; y < height; y++)
-    {
-        source = reinterpret_cast<const unsigned int*>(static_cast<const unsigned char*>(input) + y * inputPitch);
-        dest = reinterpret_cast<unsigned int*>(static_cast<unsigned char*>(output) + y * outputPitch);
-
-        for (int x = 0; x < width; x++)
-        {
-            unsigned int rgba = source[x];
-            dest[x] = (_rotl(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
-        }
-    }
-}
-
-void Image::loadRGBA4444Data(GLsizei width, GLsizei height,
-                             int inputPitch, const void *input, size_t outputPitch, void *output) const
-{
-    const unsigned short *source = NULL;
-    unsigned char *dest = NULL;
-
-    for (int y = 0; y < height; y++)
-    {
-        source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
-        dest = static_cast<unsigned char*>(output) + y * outputPitch;
-        for (int x = 0; x < width; x++)
-        {
-            unsigned short rgba = source[x];
-            dest[4 * x + 0] = ((rgba & 0x00F0) << 0) | ((rgba & 0x00F0) >> 4);
-            dest[4 * x + 1] = ((rgba & 0x0F00) >> 4) | ((rgba & 0x0F00) >> 8);
-            dest[4 * x + 2] = ((rgba & 0xF000) >> 8) | ((rgba & 0xF000) >> 12);
-            dest[4 * x + 3] = ((rgba & 0x000F) << 4) | ((rgba & 0x000F) >> 0);
-        }
-    }
-}
-
-void Image::loadRGBA5551Data(GLsizei width, GLsizei height,
-                             int inputPitch, const void *input, size_t outputPitch, void *output) const
-{
-    const unsigned short *source = NULL;
-    unsigned char *dest = NULL;
-
-    for (int y = 0; y < height; y++)
-    {
-        source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
-        dest = static_cast<unsigned char*>(output) + y * outputPitch;
-        for (int x = 0; x < width; x++)
-        {
-            unsigned short rgba = source[x];
-            dest[4 * x + 0] = ((rgba & 0x003E) << 2) | ((rgba & 0x003E) >> 3);
-            dest[4 * x + 1] = ((rgba & 0x07C0) >> 3) | ((rgba & 0x07C0) >> 8);
-            dest[4 * x + 2] = ((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13);
-            dest[4 * x + 3] = (rgba & 0x0001) ? 0xFF : 0;
-        }
-    }
-}
-
-void Image::loadRGBAFloatData(GLsizei width, GLsizei height,
-                              int inputPitch, const void *input, size_t outputPitch, void *output) const
-{
-    const float *source = NULL;
-    float *dest = NULL;
-
-    for (int y = 0; y < height; y++)
-    {
-        source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
-        dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
-        memcpy(dest, source, width * 16);
-    }
-}
-
-void Image::loadRGBAHalfFloatData(GLsizei width, GLsizei height,
-                                  int inputPitch, const void *input, size_t outputPitch, void *output) const
-{
-    const unsigned char *source = NULL;
-    unsigned char *dest = NULL;
-
-    for (int y = 0; y < height; y++)
-    {
-        source = static_cast<const unsigned char*>(input) + y * inputPitch;
-        dest = static_cast<unsigned char*>(output) + y * outputPitch;
-        memcpy(dest, source, width * 8);
-    }
-}
-
-void Image::loadBGRAData(GLsizei width, GLsizei height,
-                         int inputPitch, const void *input, size_t outputPitch, void *output) const
-{
-    const unsigned char *source = NULL;
-    unsigned char *dest = NULL;
-
-    for (int y = 0; y < height; y++)
-    {
-        source = static_cast<const unsigned char*>(input) + y * inputPitch;
-        dest = static_cast<unsigned char*>(output) + y * outputPitch;
-        memcpy(dest, source, width*4);
-    }
-}
-
-void Image::loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
-                               const void *input) {
-    ASSERT(xoffset % 4 == 0);
-    ASSERT(yoffset % 4 == 0);
-
-    RECT lockRect = {
-        xoffset, yoffset,
-        xoffset + width, yoffset + height
-    };
-
-    D3DLOCKED_RECT locked;
-    HRESULT result = lock(&locked, &lockRect);
-    if (FAILED(result))
-    {
-        return;
-    }
-
-    GLsizei inputSize = ComputeCompressedSize(width, height, mFormat);
-    GLsizei inputPitch = ComputeCompressedPitch(width, mFormat);
-    int rows = inputSize / inputPitch;
-    for (int i = 0; i < rows; ++i)
-    {
-        memcpy((void*)((BYTE*)locked.pBits + i * locked.Pitch), (void*)((BYTE*)input + i * inputPitch), inputPitch);
-    }
-
-    unlock();
-}
-
-// This implements glCopyTex[Sub]Image2D for non-renderable internal texture formats and incomplete textures
-void Image::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, IDirect3DSurface9 *renderTarget)
-{
-    IDirect3DDevice9 *device = getDevice();
-    IDirect3DSurface9 *renderTargetData = NULL;
-    D3DSURFACE_DESC description;
-    renderTarget->GetDesc(&description);
-    
-    HRESULT result = device->CreateOffscreenPlainSurface(description.Width, description.Height, description.Format, D3DPOOL_SYSTEMMEM, &renderTargetData, NULL);
-
-    if (FAILED(result))
-    {
-        ERR("Could not create matching destination surface.");
-        return error(GL_OUT_OF_MEMORY);
-    }
-
-    result = device->GetRenderTargetData(renderTarget, renderTargetData);
-
-    if (FAILED(result))
-    {
-        ERR("GetRenderTargetData unexpectedly failed.");
-        renderTargetData->Release();
-        return error(GL_OUT_OF_MEMORY);
-    }
-
-    RECT sourceRect = {x, y, x + width, y + height};
-    RECT destRect = {xoffset, yoffset, xoffset + width, yoffset + height};
-
-    if (isRenderableFormat())
-    {
-        result = D3DXLoadSurfaceFromSurface(getSurface(), NULL, &destRect, renderTargetData, NULL, &sourceRect, D3DX_FILTER_BOX, 0);
-        
-        if (FAILED(result))
-        {
-            ERR("Copying surfaces unexpectedly failed.");
-            renderTargetData->Release();
-            return error(GL_OUT_OF_MEMORY);
-        }
-    }
-    else
-    {
-        D3DLOCKED_RECT sourceLock = {0};
-        result = renderTargetData->LockRect(&sourceLock, &sourceRect, 0);
-
-        if (FAILED(result))
-        {
-            ERR("Failed to lock the source surface (rectangle might be invalid).");
-            renderTargetData->Release();
-            return error(GL_OUT_OF_MEMORY);
-        }
-
-        D3DLOCKED_RECT destLock = {0};
-        result = lock(&destLock, &destRect);
-        
-        if (FAILED(result))
-        {
-            ERR("Failed to lock the destination surface (rectangle might be invalid).");
-            renderTargetData->UnlockRect();
-            renderTargetData->Release();
-            return error(GL_OUT_OF_MEMORY);
-        }
-
-        if (destLock.pBits && sourceLock.pBits)
-        {
-            unsigned char *source = (unsigned char*)sourceLock.pBits;
-            unsigned char *dest = (unsigned char*)destLock.pBits;
-
-            switch (description.Format)
-            {
-              case D3DFMT_X8R8G8B8:
-              case D3DFMT_A8R8G8B8:
-                switch(getD3DFormat())
-                {
-                  case D3DFMT_L8:
-                    for(int y = 0; y < height; y++)
-                    {
-                        for(int x = 0; x < width; x++)
-                        {
-                            dest[x] = source[x * 4 + 2];
-                        }
-
-                        source += sourceLock.Pitch;
-                        dest += destLock.Pitch;
-                    }
-                    break;
-                  case D3DFMT_A8L8:
-                    for(int y = 0; y < height; y++)
-                    {
-                        for(int x = 0; x < width; x++)
-                        {
-                            dest[x * 2 + 0] = source[x * 4 + 2];
-                            dest[x * 2 + 1] = source[x * 4 + 3];
-                        }
-
-                        source += sourceLock.Pitch;
-                        dest += destLock.Pitch;
-                    }
-                    break;
-                  default:
-                    UNREACHABLE();
-                }
-                break;
-              case D3DFMT_R5G6B5:
-                switch(getD3DFormat())
-                {
-                  case D3DFMT_L8:
-                    for(int y = 0; y < height; y++)
-                    {
-                        for(int x = 0; x < width; x++)
-                        {
-                            unsigned char red = source[x * 2 + 1] & 0xF8;
-                            dest[x] = red | (red >> 5);
-                        }
-
-                        source += sourceLock.Pitch;
-                        dest += destLock.Pitch;
-                    }
-                    break;
-                  default:
-                    UNREACHABLE();
-                }
-                break;
-              case D3DFMT_A1R5G5B5:
-                switch(getD3DFormat())
-                {
-                  case D3DFMT_L8:
-                    for(int y = 0; y < height; y++)
-                    {
-                        for(int x = 0; x < width; x++)
-                        {
-                            unsigned char red = source[x * 2 + 1] & 0x7C;
-                            dest[x] = (red << 1) | (red >> 4);
-                        }
-
-                        source += sourceLock.Pitch;
-                        dest += destLock.Pitch;
-                    }
-                    break;
-                  case D3DFMT_A8L8:
-                    for(int y = 0; y < height; y++)
-                    {
-                        for(int x = 0; x < width; x++)
-                        {
-                            unsigned char red = source[x * 2 + 1] & 0x7C;
-                            dest[x * 2 + 0] = (red << 1) | (red >> 4);
-                            dest[x * 2 + 1] = (signed char)source[x * 2 + 1] >> 7;
-                        }
-
-                        source += sourceLock.Pitch;
-                        dest += destLock.Pitch;
-                    }
-                    break;
-                  default:
-                    UNREACHABLE();
-                }
-                break;
-              default:
-                UNREACHABLE();
-            }
-        }
-
-        unlock();
-        renderTargetData->UnlockRect();
-    }
-
-    renderTargetData->Release();
-
-    mDirty = true;
-}
-
-TextureStorage::TextureStorage(DWORD usage)
-    : mD3DUsage(usage),
-      mD3DPool(getDisplay()->getTexturePool(usage)),
-      mTextureSerial(issueTextureSerial())
-{
-}
-
-TextureStorage::~TextureStorage()
-{
-}
-
-bool TextureStorage::isRenderTarget() const
-{
-    return (mD3DUsage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL)) != 0;
-}
-
-bool TextureStorage::isManaged() const
-{
-    return (mD3DPool == D3DPOOL_MANAGED);
-}
-
-D3DPOOL TextureStorage::getPool() const
-{
-    return mD3DPool;
-}
-
-DWORD TextureStorage::getUsage() const
-{
-    return mD3DUsage;
-}
-
-unsigned int TextureStorage::getTextureSerial() const
-{
-    return mTextureSerial;
-}
-
-unsigned int TextureStorage::issueTextureSerial()
-{
-    return mCurrentTextureSerial++;
-}
-
-Texture::Texture(GLuint id) : RefCountObject(id)
-{
-    mMinFilter = GL_NEAREST_MIPMAP_LINEAR;
-    mMagFilter = GL_LINEAR;
-    mWrapS = GL_REPEAT;
-    mWrapT = GL_REPEAT;
-    mDirtyParameters = true;
-    mUsage = GL_NONE;
-    
-    mDirtyImages = true;
-
-    mImmutable = false;
-}
-
-Texture::~Texture()
-{
-}
-
-// Returns true on successful filter state update (valid enum parameter)
-bool Texture::setMinFilter(GLenum filter)
-{
-    switch (filter)
-    {
-      case GL_NEAREST:
-      case GL_LINEAR:
-      case GL_NEAREST_MIPMAP_NEAREST:
-      case GL_LINEAR_MIPMAP_NEAREST:
-      case GL_NEAREST_MIPMAP_LINEAR:
-      case GL_LINEAR_MIPMAP_LINEAR:
-        {
-            if (mMinFilter != filter)
-            {
-                mMinFilter = filter;
-                mDirtyParameters = true;
-            }
-            return true;
-        }
-      default:
-        return false;
-    }
-}
-
-// Returns true on successful filter state update (valid enum parameter)
-bool Texture::setMagFilter(GLenum filter)
-{
-    switch (filter)
-    {
-      case GL_NEAREST:
-      case GL_LINEAR:
-        {
-            if (mMagFilter != filter)
-            {
-                mMagFilter = filter;
-                mDirtyParameters = true;
-            }
-            return true;
-        }
-      default:
-        return false;
-    }
-}
-
-// Returns true on successful wrap state update (valid enum parameter)
-bool Texture::setWrapS(GLenum wrap)
-{
-    switch (wrap)
-    {
-      case GL_REPEAT:
-      case GL_CLAMP_TO_EDGE:
-      case GL_MIRRORED_REPEAT:
-        {
-            if (mWrapS != wrap)
-            {
-                mWrapS = wrap;
-                mDirtyParameters = true;
-            }
-            return true;
-        }
-      default:
-        return false;
-    }
-}
-
-// Returns true on successful wrap state update (valid enum parameter)
-bool Texture::setWrapT(GLenum wrap)
-{
-    switch (wrap)
-    {
-      case GL_REPEAT:
-      case GL_CLAMP_TO_EDGE:
-      case GL_MIRRORED_REPEAT:
-        {
-            if (mWrapT != wrap)
-            {
-                mWrapT = wrap;
-                mDirtyParameters = true;
-            }
-            return true;
-        }
-      default:
-        return false;
-    }
-}
-
-// Returns true on successful usage state update (valid enum parameter)
-bool Texture::setUsage(GLenum usage)
-{
-    switch (usage)
-    {
-      case GL_NONE:
-      case GL_FRAMEBUFFER_ATTACHMENT_ANGLE:
-        mUsage = usage;
-        return true;
-      default:
-        return false;
-    }
-}
-
-GLenum Texture::getMinFilter() const
-{
-    return mMinFilter;
-}
-
-GLenum Texture::getMagFilter() const
-{
-    return mMagFilter;
-}
-
-GLenum Texture::getWrapS() const
-{
-    return mWrapS;
-}
-
-GLenum Texture::getWrapT() const
-{
-    return mWrapT;
-}
-
-GLenum Texture::getUsage() const
-{
-    return mUsage;
-}
-
-void Texture::setImage(GLint unpackAlignment, const void *pixels, Image *image)
-{
-    if (pixels != NULL)
-    {
-        image->loadData(0, 0, image->getWidth(), image->getHeight(), image->getType(), unpackAlignment, pixels);
-        mDirtyImages = true;
-    }
-}
-
-void Texture::setCompressedImage(GLsizei imageSize, const void *pixels, Image *image)
-{
-    if (pixels != NULL)
-    {
-        image->loadCompressedData(0, 0, image->getWidth(), image->getHeight(), pixels);
-        mDirtyImages = true;
-    }
-}
-
-bool Texture::subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image)
-{
-    if (pixels != NULL)
-    {
-        image->loadData(xoffset, yoffset, width, height, type, unpackAlignment, pixels);
-        mDirtyImages = true;
-    }
-
-    return true;
-}
-
-bool Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, Image *image)
-{
-    if (pixels != NULL)
-    {
-        image->loadCompressedData(xoffset, yoffset, width, height, pixels);
-        mDirtyImages = true;
-    }
-
-    return true;
-}
-
-IDirect3DBaseTexture9 *Texture::getTexture()
-{
-    if (!isSamplerComplete())
-    {
-        return NULL;
-    }
-
-    // ensure the underlying texture is created
-    if (getStorage(false) == NULL)
-    {
-        return NULL;
-    }
-
-    updateTexture();
-
-    return getBaseTexture();
-}
-
-bool Texture::hasDirtyParameters() const
-{
-    return mDirtyParameters;
-}
-
-bool Texture::hasDirtyImages() const
-{
-    return mDirtyImages;
-}
-
-void Texture::resetDirty()
-{
-    mDirtyParameters = false;
-    mDirtyImages = false;
-}
-
-unsigned int Texture::getTextureSerial()
-{
-    TextureStorage *texture = getStorage(false);
-    return texture ? texture->getTextureSerial() : 0;
-}
-
-unsigned int Texture::getRenderTargetSerial(GLenum target)
-{
-    TextureStorage *texture = getStorage(true);
-    return texture ? texture->getRenderTargetSerial(target) : 0;
-}
-
-bool Texture::isImmutable() const
-{
-    return mImmutable;
-}
-
-GLint Texture::creationLevels(GLsizei width, GLsizei height) const
-{
-    if ((isPow2(width) && isPow2(height)) || getContext()->supportsNonPower2Texture())
-    {
-        return 0;   // Maximum number of levels
-    }
-    else
-    {
-        // OpenGL ES 2.0 without GL_OES_texture_npot does not permit NPOT mipmaps.
-        return 1;
-    }
-}
-
-GLint Texture::creationLevels(GLsizei size) const
-{
-    return creationLevels(size, size);
-}
-
-int Texture::levelCount() const
-{
-    return getBaseTexture() ? getBaseTexture()->GetLevelCount() : 0;
-}
-
-Blit *Texture::getBlitter()
-{
-    Context *context = getContext();
-    return context->getBlitter();
-}
-
-bool Texture::copyToRenderTarget(IDirect3DSurface9 *dest, IDirect3DSurface9 *source, bool fromManaged)
-{
-    if (source && dest)
-    {
-        HRESULT result;
-
-        if (fromManaged)
-        {
-            result = D3DXLoadSurfaceFromSurface(dest, NULL, NULL, source, NULL, NULL, D3DX_FILTER_BOX, 0);
-        }
-        else
-        {
-            egl::Display *display = getDisplay();
-            IDirect3DDevice9 *device = display->getDevice();
-
-            display->endScene();
-            result = device->StretchRect(source, NULL, dest, NULL, D3DTEXF_NONE);
-        }
-
-        if (FAILED(result))
-        {
-            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
-            return false;
-        }
-    }
-
-    return true;
-}
-
-TextureStorage2D::TextureStorage2D(IDirect3DTexture9 *surfaceTexture) : TextureStorage(D3DUSAGE_RENDERTARGET), mRenderTargetSerial(RenderbufferStorage::issueSerial())
-{
-    mTexture = surfaceTexture;
-}
-
-TextureStorage2D::TextureStorage2D(int levels, D3DFORMAT format, DWORD usage, int width, int height)
-    : TextureStorage(usage), mRenderTargetSerial(RenderbufferStorage::issueSerial())
-{
-    mTexture = NULL;
-    // if the width or height is not positive this should be treated as an incomplete texture
-    // we handle that here by skipping the d3d texture creation
-    if (width > 0 && height > 0)
-    {
-        IDirect3DDevice9 *device = getDevice();
-        HRESULT result = device->CreateTexture(width, height, levels, getUsage(), format, getPool(), &mTexture, NULL);
-
-        if (FAILED(result))
-        {
-            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
-            error(GL_OUT_OF_MEMORY);
-        }
-    }
-}
-
-TextureStorage2D::~TextureStorage2D()
-{
-    if (mTexture)
-    {
-        mTexture->Release();
-    }
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *TextureStorage2D::getSurfaceLevel(int level)
-{
-    IDirect3DSurface9 *surface = NULL;
-
-    if (mTexture)
-    {
-        HRESULT result = mTexture->GetSurfaceLevel(level, &surface);
-        ASSERT(SUCCEEDED(result));
-    }
-
-    return surface;
-}
-
-IDirect3DBaseTexture9 *TextureStorage2D::getBaseTexture() const
-{
-    return mTexture;
-}
-
-unsigned int TextureStorage2D::getRenderTargetSerial(GLenum target) const
-{
-    return mRenderTargetSerial;
-}
-
-Texture2D::Texture2D(GLuint id) : Texture(id)
-{
-    mTexStorage = NULL;
-    mSurface = NULL;
-    mColorbufferProxy = NULL;
-    mProxyRefs = 0;
-}
-
-Texture2D::~Texture2D()
-{
-    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)
-        return mImageArray[level].getWidth();
-    else
-        return 0;
-}
-
-GLsizei Texture2D::getHeight(GLint level) const
-{
-    if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
-        return mImageArray[level].getHeight();
-    else
-        return 0;
-}
-
-GLenum Texture2D::getInternalFormat(GLint level) const
-{
-    if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
-        return mImageArray[level].getFormat();
-    else
-        return GL_NONE;
-}
-
-D3DFORMAT Texture2D::getD3DFormat(GLint level) const
-{
-    if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
-        return mImageArray[level].getD3DFormat();
-    else
-        return D3DFMT_UNKNOWN;
-}
-
-void Texture2D::redefineImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLenum type)
-{
-    releaseTexImage();
-
-    bool redefined = mImageArray[level].redefine(format, width, height, type, false);
-
-    if (mTexStorage && redefined)
-    {
-        for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
-        {
-            mImageArray[i].markDirty();
-        }
-
-        delete mTexStorage;
-        mTexStorage = NULL;
-        mDirtyImages = true;
-    }
-}
-
-void Texture2D::setImage(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
-{
-    redefineImage(level, format, width, height, type);
-
-    Texture::setImage(unpackAlignment, pixels, &mImageArray[level]);
-}
-
-void Texture2D::bindTexImage(egl::Surface *surface)
-{
-    releaseTexImage();
-
-    GLenum format;
-
-    switch(surface->getFormat())
-    {
-      case D3DFMT_A8R8G8B8:
-        format = GL_RGBA;
-        break;
-      case D3DFMT_X8R8G8B8:
-        format = GL_RGB;
-        break;
-      default:
-        UNIMPLEMENTED();
-        return;
-    }
-
-    mImageArray[0].redefine(format, surface->getWidth(), surface->getHeight(), GL_UNSIGNED_BYTE, true);
-
-    delete mTexStorage;
-    mTexStorage = new TextureStorage2D(surface->getOffscreenTexture());
-
-    mDirtyImages = true;
-    mSurface = surface;
-    mSurface->setBoundTexture(this);
-}
-
-void Texture2D::releaseTexImage()
-{
-    if (mSurface)
-    {
-        mSurface->setBoundTexture(NULL);
-        mSurface = NULL;
-
-        if (mTexStorage)
-        {
-            delete mTexStorage;
-            mTexStorage = NULL;
-        }
-
-        for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
-        {
-            mImageArray[i].redefine(GL_RGBA, 0, 0, GL_UNSIGNED_BYTE, true);
-        }
-    }
-}
-
-void Texture2D::setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels)
-{
-    redefineImage(level, format, width, height, GL_UNSIGNED_BYTE);
-
-    Texture::setCompressedImage(imageSize, pixels, &mImageArray[level]);
-}
-
-void Texture2D::commitRect(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
-{
-    ASSERT(mImageArray[level].getSurface() != NULL);
-
-    if (level < levelCount())
-    {
-        IDirect3DSurface9 *destLevel = mTexStorage->getSurfaceLevel(level);
-
-        if (destLevel)
-        {
-            Image *image = &mImageArray[level];
-            image->updateSurface(destLevel, xoffset, yoffset, width, height);
-
-            destLevel->Release();
-            image->markClean();
-        }
-    }
-}
-
-void Texture2D::subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
-{
-    if (Texture::subImage(xoffset, yoffset, width, height, format, type, unpackAlignment, pixels, &mImageArray[level]))
-    {
-        commitRect(level, xoffset, yoffset, width, height);
-    }
-}
-
-void Texture2D::subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels)
-{
-    if (Texture::subImageCompressed(xoffset, yoffset, width, height, format, imageSize, pixels, &mImageArray[level]))
-    {
-        commitRect(level, xoffset, yoffset, width, height);
-    }
-}
-
-void Texture2D::copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
-{
-    IDirect3DSurface9 *renderTarget = source->getRenderTarget();
-
-    if (!renderTarget)
-    {
-        ERR("Failed to retrieve the render target.");
-        return error(GL_OUT_OF_MEMORY);
-    }
-
-    redefineImage(level, format, width, height, GL_UNSIGNED_BYTE);
-   
-    if (!mImageArray[level].isRenderableFormat())
-    {
-        mImageArray[level].copy(0, 0, x, y, width, height, renderTarget);
-        mDirtyImages = true;
-    }
-    else
-    {
-        if (!mTexStorage || !mTexStorage->isRenderTarget())
-        {
-            convertToRenderTarget();
-        }
-        
-        mImageArray[level].markClean();
-
-        if (width != 0 && height != 0 && level < levelCount())
-        {
-            RECT sourceRect;
-            sourceRect.left = x;
-            sourceRect.right = x + width;
-            sourceRect.top = y;
-            sourceRect.bottom = y + height;
-            
-            IDirect3DSurface9 *dest = mTexStorage->getSurfaceLevel(level);
-
-            if (dest)
-            {
-                getBlitter()->copy(renderTarget, sourceRect, format, 0, 0, dest);
-                dest->Release();
-            }
-        }
-    }
-
-    renderTarget->Release();
-}
-
-void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
-{
-    if (xoffset + width > mImageArray[level].getWidth() || yoffset + height > mImageArray[level].getHeight())
-    {
-        return error(GL_INVALID_VALUE);
-    }
-
-    IDirect3DSurface9 *renderTarget = source->getRenderTarget();
-
-    if (!renderTarget)
-    {
-        ERR("Failed to retrieve the render target.");
-        return error(GL_OUT_OF_MEMORY);
-    }
-
-    if (!mImageArray[level].isRenderableFormat() || (!mTexStorage && !isSamplerComplete()))
-    {
-        mImageArray[level].copy(xoffset, yoffset, x, y, width, height, renderTarget);
-        mDirtyImages = true;
-    }
-    else
-    {
-        if (!mTexStorage || !mTexStorage->isRenderTarget())
-        {
-            convertToRenderTarget();
-        }
-        
-        updateTexture();
-
-        if (level < levelCount())
-        {
-            RECT sourceRect;
-            sourceRect.left = x;
-            sourceRect.right = x + width;
-            sourceRect.top = y;
-            sourceRect.bottom = y + height;
-
-
-            IDirect3DSurface9 *dest = mTexStorage->getSurfaceLevel(level);
-
-            if (dest)
-            {
-                getBlitter()->copy(renderTarget, sourceRect, mImageArray[0].getFormat(), xoffset, yoffset, dest);
-                dest->Release();
-            }
-        }
-    }
-
-    renderTarget->Release();
-}
-
-void Texture2D::storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
-{
-    GLenum format = gl::ExtractFormat(internalformat);
-    GLenum type = gl::ExtractType(internalformat);
-    D3DFORMAT d3dfmt = ConvertTextureFormatType(format, type);
-    DWORD d3dusage = GetTextureUsage(d3dfmt, mUsage, false);
-
-    delete mTexStorage;
-    mTexStorage = new TextureStorage2D(levels, d3dfmt, d3dusage, width, height);
-    mImmutable = true;
-
-    for (int level = 0; level < levels; level++)
-    {
-        mImageArray[level].redefine(format, width, height, type, true);
-        width = std::max(1, width >> 1);
-        height = std::max(1, height >> 1);
-    }
-
-    for (int level = levels; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
-    {
-        mImageArray[level].redefine(GL_NONE, 0, 0, GL_UNSIGNED_BYTE, true);
-    }
-
-    if (mTexStorage->isManaged())
-    {
-        int levels = levelCount();
-
-        for (int level = 0; level < levels; level++)
-        {
-            IDirect3DSurface9 *surface = mTexStorage->getSurfaceLevel(level);
-            mImageArray[level].setManagedSurface(surface);
-        }
-    }
-}
-
-// Tests for 2D texture sampling completeness. [OpenGL ES 2.0.24] section 3.8.2 page 85.
-bool Texture2D::isSamplerComplete() const
-{
-    GLsizei width = mImageArray[0].getWidth();
-    GLsizei height = mImageArray[0].getHeight();
-
-    if (width <= 0 || height <= 0)
-    {
-        return false;
-    }
-
-    bool mipmapping = false;
-
-    switch (mMinFilter)
-    {
-      case GL_NEAREST:
-      case GL_LINEAR:
-        mipmapping = false;
-        break;
-      case GL_NEAREST_MIPMAP_NEAREST:
-      case GL_LINEAR_MIPMAP_NEAREST:
-      case GL_NEAREST_MIPMAP_LINEAR:
-      case GL_LINEAR_MIPMAP_LINEAR:
-        mipmapping = true;
-        break;
-      default: UNREACHABLE();
-    }
-
-    if ((getInternalFormat(0) == GL_FLOAT && !getContext()->supportsFloat32LinearFilter()) ||
-        (getInternalFormat(0) == GL_HALF_FLOAT_OES && !getContext()->supportsFloat16LinearFilter()))
-    {
-        if (mMagFilter != GL_NEAREST || (mMinFilter != GL_NEAREST && mMinFilter != GL_NEAREST_MIPMAP_NEAREST))
-        {
-            return false;
-        }
-    }
-
-    bool npotSupport = getContext()->supportsNonPower2Texture();
-
-    if (!npotSupport)
-    {
-        if ((getWrapS() != GL_CLAMP_TO_EDGE && !isPow2(width)) ||
-            (getWrapT() != GL_CLAMP_TO_EDGE && !isPow2(height)))
-        {
-            return false;
-        }
-    }
-
-    if (mipmapping)
-    {
-        if (!npotSupport)
-        {
-            if (!isPow2(width) || !isPow2(height))
-            {
-                return false;
-            }
-        }
-
-        if (!isMipmapComplete())
-        {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-// Tests for 2D texture (mipmap) completeness. [OpenGL ES 2.0.24] section 3.7.10 page 81.
-bool Texture2D::isMipmapComplete() const
-{
-    if (isImmutable())
-    {
-        return true;
-    }
-
-    GLsizei width = mImageArray[0].getWidth();
-    GLsizei height = mImageArray[0].getHeight();
-
-    if (width <= 0 || height <= 0)
-    {
-        return false;
-    }
-
-    int q = log2(std::max(width, height));
-
-    for (int level = 1; level <= q; level++)
-    {
-        if (mImageArray[level].getFormat() != mImageArray[0].getFormat())
-        {
-            return false;
-        }
-
-        if (mImageArray[level].getType() != mImageArray[0].getType())
-        {
-            return false;
-        }
-
-        if (mImageArray[level].getWidth() != std::max(1, width >> level))
-        {
-            return false;
-        }
-
-        if (mImageArray[level].getHeight() != std::max(1, height >> level))
-        {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-bool Texture2D::isCompressed(GLint level) const
-{
-    return IsCompressed(getInternalFormat(level));
-}
-
-bool Texture2D::isDepth(GLint level) const
-{
-    return IsDepthTexture(getInternalFormat(level));
-}
-
-IDirect3DBaseTexture9 *Texture2D::getBaseTexture() const
-{
-    return mTexStorage ? mTexStorage->getBaseTexture() : NULL;
-}
-
-// Constructs a Direct3D 9 texture resource from the texture images
-void Texture2D::createTexture()
-{
-    GLsizei width = mImageArray[0].getWidth();
-    GLsizei height = mImageArray[0].getHeight();
-    GLint levels = creationLevels(width, height);
-    D3DFORMAT d3dfmt = mImageArray[0].getD3DFormat();
-    DWORD d3dusage = GetTextureUsage(d3dfmt, mUsage, false);
-
-    delete mTexStorage;
-    mTexStorage = new TextureStorage2D(levels, d3dfmt, d3dusage, width, height);
-    
-    if (mTexStorage->isManaged())
-    {
-        int levels = levelCount();
-
-        for (int level = 0; level < levels; level++)
-        {
-            IDirect3DSurface9 *surface = mTexStorage->getSurfaceLevel(level);
-            mImageArray[level].setManagedSurface(surface);
-        }
-    }
-
-    mDirtyImages = true;
-}
-
-void Texture2D::updateTexture()
-{
-    int levels = levelCount();
-
-    for (int level = 0; level < levels; level++)
-    {
-        Image *image = &mImageArray[level];
-
-        if (image->isDirty())
-        {
-            commitRect(level, 0, 0, mImageArray[level].getWidth(), mImageArray[level].getHeight());
-        }
-    }
-}
-
-void Texture2D::convertToRenderTarget()
-{
-    TextureStorage2D *newTexStorage = NULL;
-
-    if (mImageArray[0].getWidth() != 0 && mImageArray[0].getHeight() != 0)
-    {
-        GLsizei width = mImageArray[0].getWidth();
-        GLsizei height = mImageArray[0].getHeight();
-        GLint levels = creationLevels(width, height);
-        D3DFORMAT d3dfmt = mImageArray[0].getD3DFormat();
-        DWORD d3dusage = GetTextureUsage(d3dfmt, GL_FRAMEBUFFER_ATTACHMENT_ANGLE, true);
-
-        newTexStorage = new TextureStorage2D(levels, d3dfmt, d3dusage, width, height);
-
-        if (mTexStorage != NULL)
-        {
-            int levels = levelCount();
-            for (int i = 0; i < levels; i++)
-            {
-                IDirect3DSurface9 *source = mTexStorage->getSurfaceLevel(i);
-                IDirect3DSurface9 *dest = newTexStorage->getSurfaceLevel(i);
-
-                if (!copyToRenderTarget(dest, source, mTexStorage->isManaged()))
-                {   
-                   delete newTexStorage;
-                   if (source) source->Release();
-                   if (dest) dest->Release();
-                   return error(GL_OUT_OF_MEMORY);
-                }
-
-                if (source) source->Release();
-                if (dest) dest->Release();
-            }
-        }
-    }
-
-    delete mTexStorage;
-    mTexStorage = newTexStorage;
-
-    mDirtyImages = true;
-}
-
-void Texture2D::generateMipmaps()
-{
-    if (!getContext()->supportsNonPower2Texture())
-    {
-        if (!isPow2(mImageArray[0].getWidth()) || !isPow2(mImageArray[0].getHeight()))
-        {
-            return error(GL_INVALID_OPERATION);
-        }
-    }
-
-    // Purge array levels 1 through q and reset them to represent the generated mipmap levels.
-    unsigned int q = log2(std::max(mImageArray[0].getWidth(), mImageArray[0].getHeight()));
-    for (unsigned int i = 1; i <= q; i++)
-    {
-        redefineImage(i, mImageArray[0].getFormat(), 
-                         std::max(mImageArray[0].getWidth() >> i, 1),
-                         std::max(mImageArray[0].getHeight() >> i, 1),
-                         mImageArray[0].getType());
-    }
-
-    if (mTexStorage && mTexStorage->isRenderTarget())
-    {
-        for (unsigned int i = 1; i <= q; i++)
-        {
-            IDirect3DSurface9 *upper = mTexStorage->getSurfaceLevel(i - 1);
-            IDirect3DSurface9 *lower = mTexStorage->getSurfaceLevel(i);
-
-            if (upper != NULL && lower != NULL)
-            {
-                getBlitter()->boxFilter(upper, lower);
-            }
-
-            if (upper != NULL) upper->Release();
-            if (lower != NULL) lower->Release();
-
-            mImageArray[i].markClean();
-        }
-    }
-    else
-    {
-        for (unsigned int i = 1; i <= q; i++)
-        {
-            if (mImageArray[i].getSurface() == NULL)
-            {
-                return error(GL_OUT_OF_MEMORY);
-            }
-
-            if (FAILED(D3DXLoadSurfaceFromSurface(mImageArray[i].getSurface(), NULL, NULL, mImageArray[i - 1].getSurface(), NULL, NULL, D3DX_FILTER_BOX, 0)))
-            {
-                ERR(" failed to load filter %d to %d.", i - 1, i);
-            }
-
-            mImageArray[i].markDirty();
-        }
-    }
-}
-
-Renderbuffer *Texture2D::getRenderbuffer(GLenum target)
-{
-    if (target != GL_TEXTURE_2D)
-    {
-        return error(GL_INVALID_OPERATION, (Renderbuffer *)NULL);
-    }
-
-    if (mColorbufferProxy == NULL)
-    {
-        mColorbufferProxy = new Renderbuffer(id(), new RenderbufferTexture2D(this, target));
-    }
-
-    return mColorbufferProxy;
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *Texture2D::getRenderTarget(GLenum target)
-{
-    ASSERT(target == GL_TEXTURE_2D);
-
-    // ensure the underlying texture is created
-    if (getStorage(true) == NULL)
-    {
-        return NULL;
-    }
-
-    updateTexture();
-    
-    // ensure this is NOT a depth texture
-    if (isDepth(0))
-    {
-        return NULL;
-    }
-    return mTexStorage->getSurfaceLevel(0);
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *Texture2D::getDepthStencil(GLenum target)
-{
-    ASSERT(target == GL_TEXTURE_2D);
-
-    // ensure the underlying texture is created
-    if (getStorage(true) == NULL)
-    {
-        return NULL;
-    }
-
-    updateTexture();
-
-    // ensure this is actually a depth texture
-    if (!isDepth(0))
-    {
-        return NULL;
-    }
-    return mTexStorage->getSurfaceLevel(0);
-}
-
-TextureStorage *Texture2D::getStorage(bool renderTarget)
-{
-    if (!mTexStorage || (renderTarget && !mTexStorage->isRenderTarget()))
-    {
-        if (renderTarget)
-        {
-            convertToRenderTarget();
-        }
-        else
-        {
-            createTexture();
-        }
-    }
-
-    return mTexStorage;
-}
-
-TextureStorageCubeMap::TextureStorageCubeMap(int levels, D3DFORMAT format, DWORD usage, int size)
-    : TextureStorage(usage), mFirstRenderTargetSerial(RenderbufferStorage::issueCubeSerials())
-{
-    mTexture = NULL;
-    // if the size is not positive this should be treated as an incomplete texture
-    // we handle that here by skipping the d3d texture creation
-    if (size > 0)
-    {
-        IDirect3DDevice9 *device = getDevice();
-        HRESULT result = device->CreateCubeTexture(size, levels, getUsage(), format, getPool(), &mTexture, NULL);
-
-        if (FAILED(result))
-        {
-            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
-            error(GL_OUT_OF_MEMORY);
-        }
-    }
-}
-
-TextureStorageCubeMap::~TextureStorageCubeMap()
-{
-    if (mTexture)
-    {
-        mTexture->Release();
-    }
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *TextureStorageCubeMap::getCubeMapSurface(GLenum faceTarget, int level)
-{
-    IDirect3DSurface9 *surface = NULL;
-
-    if (mTexture)
-    {
-        HRESULT result = mTexture->GetCubeMapSurface(es2dx::ConvertCubeFace(faceTarget), level, &surface);
-        ASSERT(SUCCEEDED(result));
-    }
-
-    return surface;
-}
-
-IDirect3DBaseTexture9 *TextureStorageCubeMap::getBaseTexture() const
-{
-    return mTexture;
-}
-
-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] = 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(GLenum target, GLint level) const
-{
-    if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
-        return mImageArray[faceIndex(target)][level].getWidth();
-    else
-        return 0;
-}
-
-GLsizei TextureCubeMap::getHeight(GLenum target, GLint level) const
-{
-    if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
-        return mImageArray[faceIndex(target)][level].getHeight();
-    else
-        return 0;
-}
-
-GLenum TextureCubeMap::getInternalFormat(GLenum target, GLint level) const
-{
-    if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
-        return mImageArray[faceIndex(target)][level].getFormat();
-    else
-        return GL_NONE;
-}
-
-D3DFORMAT TextureCubeMap::getD3DFormat(GLenum target, GLint level) const
-{
-    if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
-        return mImageArray[faceIndex(target)][level].getD3DFormat();
-    else
-        return D3DFMT_UNKNOWN;
-}
-
-void TextureCubeMap::setImagePosX(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
-{
-    setImage(0, level, width, height, format, type, unpackAlignment, pixels);
-}
-
-void TextureCubeMap::setImageNegX(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
-{
-    setImage(1, level, width, height, format, type, unpackAlignment, pixels);
-}
-
-void TextureCubeMap::setImagePosY(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
-{
-    setImage(2, level, width, height, format, type, unpackAlignment, pixels);
-}
-
-void TextureCubeMap::setImageNegY(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
-{
-    setImage(3, level, width, height, format, type, unpackAlignment, pixels);
-}
-
-void TextureCubeMap::setImagePosZ(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
-{
-    setImage(4, level, width, height, format, type, unpackAlignment, pixels);
-}
-
-void TextureCubeMap::setImageNegZ(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
-{
-    setImage(5, level, width, height, format, type, unpackAlignment, pixels);
-}
-
-void TextureCubeMap::setCompressedImage(GLenum face, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels)
-{
-    redefineImage(faceIndex(face), level, format, width, height, GL_UNSIGNED_BYTE);
-
-    Texture::setCompressedImage(imageSize, pixels, &mImageArray[faceIndex(face)][level]);
-}
-
-void TextureCubeMap::commitRect(int face, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
-{
-    ASSERT(mImageArray[face][level].getSurface() != NULL);
-
-    if (level < levelCount())
-    {
-        IDirect3DSurface9 *destLevel = mTexStorage->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level);
-        ASSERT(destLevel != NULL);
-
-        if (destLevel != NULL)
-        {
-            Image *image = &mImageArray[face][level];
-            image->updateSurface(destLevel, xoffset, yoffset, width, height);
-
-            destLevel->Release();
-            image->markClean();
-        }
-    }
-}
-
-void TextureCubeMap::subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
-{
-    if (Texture::subImage(xoffset, yoffset, width, height, format, type, unpackAlignment, pixels, &mImageArray[faceIndex(target)][level]))
-    {
-        commitRect(faceIndex(target), level, xoffset, yoffset, width, height);
-    }
-}
-
-void TextureCubeMap::subImageCompressed(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels)
-{
-    if (Texture::subImageCompressed(xoffset, yoffset, width, height, format, imageSize, pixels, &mImageArray[faceIndex(target)][level]))
-    {
-        commitRect(faceIndex(target), level, xoffset, yoffset, width, height);
-    }
-}
-
-// Tests for cube map sampling completeness. [OpenGL ES 2.0.24] section 3.8.2 page 86.
-bool TextureCubeMap::isSamplerComplete() const
-{
-    int size = mImageArray[0][0].getWidth();
-
-    bool mipmapping;
-
-    switch (mMinFilter)
-    {
-      case GL_NEAREST:
-      case GL_LINEAR:
-        mipmapping = false;
-        break;
-      case GL_NEAREST_MIPMAP_NEAREST:
-      case GL_LINEAR_MIPMAP_NEAREST:
-      case GL_NEAREST_MIPMAP_LINEAR:
-      case GL_LINEAR_MIPMAP_LINEAR:
-        mipmapping = true;
-        break;
-      default:
-        UNREACHABLE();
-        return false;
-    }
-
-    if ((getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0) == GL_FLOAT && !getContext()->supportsFloat32LinearFilter()) ||
-        (getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0) == GL_HALF_FLOAT_OES && !getContext()->supportsFloat16LinearFilter()))
-    {
-        if (mMagFilter != GL_NEAREST || (mMinFilter != GL_NEAREST && mMinFilter != GL_NEAREST_MIPMAP_NEAREST))
-        {
-            return false;
-        }
-    }
-
-    if (!isPow2(size) && !getContext()->supportsNonPower2Texture())
-    {
-        if (getWrapS() != GL_CLAMP_TO_EDGE || getWrapT() != GL_CLAMP_TO_EDGE || mipmapping)
-        {
-            return false;
-        }
-    }
-
-    if (!mipmapping)
-    {
-        if (!isCubeComplete())
-        {
-            return false;
-        }
-    }
-    else
-    {
-        if (!isMipmapCubeComplete())   // Also tests for isCubeComplete()
-        {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-// Tests for cube texture completeness. [OpenGL ES 2.0.24] section 3.7.10 page 81.
-bool TextureCubeMap::isCubeComplete() const
-{
-    if (mImageArray[0][0].getWidth() <= 0 || mImageArray[0][0].getHeight() != mImageArray[0][0].getWidth())
-    {
-        return false;
-    }
-
-    for (unsigned int face = 1; face < 6; face++)
-    {
-        if (mImageArray[face][0].getWidth() != mImageArray[0][0].getWidth() ||
-            mImageArray[face][0].getWidth() != mImageArray[0][0].getHeight() ||
-            mImageArray[face][0].getFormat() != mImageArray[0][0].getFormat() ||
-            mImageArray[face][0].getType() != mImageArray[0][0].getType())
-        {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-bool TextureCubeMap::isMipmapCubeComplete() const
-{
-    if (isImmutable())
-    {
-        return true;
-    }
-
-    if (!isCubeComplete())
-    {
-        return false;
-    }
-
-    GLsizei size = mImageArray[0][0].getWidth();
-
-    int q = log2(size);
-
-    for (int face = 0; face < 6; face++)
-    {
-        for (int level = 1; level <= q; level++)
-        {
-            if (mImageArray[face][level].getFormat() != mImageArray[0][0].getFormat())
-            {
-                return false;
-            }
-
-            if (mImageArray[face][level].getType() != mImageArray[0][0].getType())
-            {
-                return false;
-            }
-
-            if (mImageArray[face][level].getWidth() != std::max(1, size >> level))
-            {
-                return false;
-            }
-        }
-    }
-
-    return true;
-}
-
-bool TextureCubeMap::isCompressed(GLenum target, GLint level) const
-{
-    return IsCompressed(getInternalFormat(target, level));
-}
-
-IDirect3DBaseTexture9 *TextureCubeMap::getBaseTexture() const
-{
-    return mTexStorage ? mTexStorage->getBaseTexture() : NULL;
-}
-
-// Constructs a Direct3D 9 texture resource from the texture images, or returns an existing one
-void TextureCubeMap::createTexture()
-{
-    GLsizei size = mImageArray[0][0].getWidth();
-    GLint levels = creationLevels(size, 0);
-    D3DFORMAT d3dfmt = mImageArray[0][0].getD3DFormat();
-    DWORD d3dusage = GetTextureUsage(d3dfmt, mUsage, false);
-
-    delete mTexStorage;
-    mTexStorage = new TextureStorageCubeMap(levels, d3dfmt, d3dusage, size);
-
-    if (mTexStorage->isManaged())
-    {
-        int levels = levelCount();
-
-        for (int face = 0; face < 6; face++)
-        {
-            for (int level = 0; level < levels; level++)
-            {
-                IDirect3DSurface9 *surface = mTexStorage->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level);
-                mImageArray[face][level].setManagedSurface(surface);
-            }
-        }
-    }
-
-    mDirtyImages = true;
-}
-
-void TextureCubeMap::updateTexture()
-{
-    for (int face = 0; face < 6; face++)
-    {
-        int levels = levelCount();
-        for (int level = 0; level < levels; level++)
-        {
-            Image *image = &mImageArray[face][level];
-
-            if (image->isDirty())
-            {
-                commitRect(face, level, 0, 0, image->getWidth(), image->getHeight());
-            }
-        }
-    }
-}
-
-void TextureCubeMap::convertToRenderTarget()
-{
-    TextureStorageCubeMap *newTexStorage = NULL;
-
-    if (mImageArray[0][0].getWidth() != 0)
-    {
-        GLsizei size = mImageArray[0][0].getWidth();
-        GLint levels = creationLevels(size, 0);
-        D3DFORMAT d3dfmt = mImageArray[0][0].getD3DFormat();
-        DWORD d3dusage = GetTextureUsage(d3dfmt, GL_FRAMEBUFFER_ATTACHMENT_ANGLE, true);
-
-        newTexStorage = new TextureStorageCubeMap(levels, d3dfmt, d3dusage, size);
-
-        if (mTexStorage != NULL)
-        {
-            int levels = levelCount();
-            for (int f = 0; f < 6; f++)
-            {
-                for (int i = 0; i < levels; i++)
-                {
-                    IDirect3DSurface9 *source = mTexStorage->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i);
-                    IDirect3DSurface9 *dest = newTexStorage->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i);
-
-                    if (!copyToRenderTarget(dest, source, mTexStorage->isManaged()))
-                    {
-                       delete newTexStorage;
-                       if (source) source->Release();
-                       if (dest) dest->Release();
-                       return error(GL_OUT_OF_MEMORY);
-                    }
-
-                    if (source) source->Release();
-                    if (dest) dest->Release();
-                }
-            }
-        }
-    }
-
-    delete mTexStorage;
-    mTexStorage = newTexStorage;
-
-    mDirtyImages = true;
-}
-
-void TextureCubeMap::setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
-{
-    redefineImage(faceIndex, level, format, width, height, type);
-
-    Texture::setImage(unpackAlignment, pixels, &mImageArray[faceIndex][level]);
-}
-
-unsigned int TextureCubeMap::faceIndex(GLenum face)
-{
-    META_ASSERT(GL_TEXTURE_CUBE_MAP_NEGATIVE_X - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 1);
-    META_ASSERT(GL_TEXTURE_CUBE_MAP_POSITIVE_Y - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 2);
-    META_ASSERT(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 3);
-    META_ASSERT(GL_TEXTURE_CUBE_MAP_POSITIVE_Z - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 4);
-    META_ASSERT(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 5);
-
-    return face - GL_TEXTURE_CUBE_MAP_POSITIVE_X;
-}
-
-void TextureCubeMap::redefineImage(int face, GLint level, GLenum format, GLsizei width, GLsizei height, GLenum type)
-{
-    bool redefined = mImageArray[face][level].redefine(format, width, height, type, false);
-
-    if (mTexStorage && redefined)
-    {
-        for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
-        {
-            for (int f = 0; f < 6; f++)
-            {
-                mImageArray[f][i].markDirty();
-            }
-        }
-
-        delete mTexStorage;
-        mTexStorage = NULL;
-
-        mDirtyImages = true;
-    }
-}
-
-void TextureCubeMap::copyImage(GLenum target, GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
-{
-    IDirect3DSurface9 *renderTarget = source->getRenderTarget();
-
-    if (!renderTarget)
-    {
-        ERR("Failed to retrieve the render target.");
-        return error(GL_OUT_OF_MEMORY);
-    }
-
-    unsigned int faceindex = faceIndex(target);
-    redefineImage(faceindex, level, format, width, height, GL_UNSIGNED_BYTE);
-
-    if (!mImageArray[faceindex][level].isRenderableFormat())
-    {
-        mImageArray[faceindex][level].copy(0, 0, x, y, width, height, renderTarget);
-        mDirtyImages = true;
-    }
-    else
-    {
-        if (!mTexStorage || !mTexStorage->isRenderTarget())
-        {
-            convertToRenderTarget();
-        }
-        
-        mImageArray[faceindex][level].markClean();
-
-        ASSERT(width == height);
-
-        if (width > 0 && level < levelCount())
-        {
-            RECT sourceRect;
-            sourceRect.left = x;
-            sourceRect.right = x + width;
-            sourceRect.top = y;
-            sourceRect.bottom = y + height;
-
-            IDirect3DSurface9 *dest = mTexStorage->getCubeMapSurface(target, level);
-
-            if (dest)
-            {
-                getBlitter()->copy(renderTarget, sourceRect, format, 0, 0, dest);
-                dest->Release();
-            }
-        }
-    }
-
-    renderTarget->Release();
-}
-
-void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
-{
-    GLsizei size = mImageArray[faceIndex(target)][level].getWidth();
-
-    if (xoffset + width > size || yoffset + height > size)
-    {
-        return error(GL_INVALID_VALUE);
-    }
-
-    IDirect3DSurface9 *renderTarget = source->getRenderTarget();
-
-    if (!renderTarget)
-    {
-        ERR("Failed to retrieve the render target.");
-        return error(GL_OUT_OF_MEMORY);
-    }
-
-    unsigned int faceindex = faceIndex(target);
-
-    if (!mImageArray[faceindex][level].isRenderableFormat() || (!mTexStorage && !isSamplerComplete()))
-    {
-        mImageArray[faceindex][level].copy(0, 0, x, y, width, height, renderTarget);
-        mDirtyImages = true;
-    }
-    else
-    {
-        if (!mTexStorage || !mTexStorage->isRenderTarget())
-        {
-            convertToRenderTarget();
-        }
-        
-        updateTexture();
-
-        if (level < levelCount())
-        {
-            RECT sourceRect;
-            sourceRect.left = x;
-            sourceRect.right = x + width;
-            sourceRect.top = y;
-            sourceRect.bottom = y + height;
-
-            IDirect3DSurface9 *dest = mTexStorage->getCubeMapSurface(target, level);
-
-            if (dest)
-            {
-                getBlitter()->copy(renderTarget, sourceRect, mImageArray[0][0].getFormat(), xoffset, yoffset, dest);
-                dest->Release();
-            }
-        }
-    }
-
-    renderTarget->Release();
-}
-
-void TextureCubeMap::storage(GLsizei levels, GLenum internalformat, GLsizei size)
-{
-    GLenum format = gl::ExtractFormat(internalformat);
-    GLenum type = gl::ExtractType(internalformat);
-    D3DFORMAT d3dfmt = ConvertTextureFormatType(format, type);
-    DWORD d3dusage = GetTextureUsage(d3dfmt, mUsage, false);
-
-    delete mTexStorage;
-    mTexStorage = new TextureStorageCubeMap(levels, d3dfmt, d3dusage, size);
-    mImmutable = true;
-
-    for (int level = 0; level < levels; level++)
-    {
-        for (int face = 0; face < 6; face++)
-        {
-            mImageArray[face][level].redefine(format, size, size, type, true);
-            size = std::max(1, size >> 1);
-        }
-    }
-
-    for (int level = levels; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
-    {
-        for (int face = 0; face < 6; face++)
-        {
-            mImageArray[face][level].redefine(GL_NONE, 0, 0, GL_UNSIGNED_BYTE, true);
-        }
-    }
-
-    if (mTexStorage->isManaged())
-    {
-        int levels = levelCount();
-
-        for (int face = 0; face < 6; face++)
-        {
-            for (int level = 0; level < levels; level++)
-            {
-                IDirect3DSurface9 *surface = mTexStorage->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level);
-                mImageArray[face][level].setManagedSurface(surface);
-            }
-        }
-    }
-}
-
-void TextureCubeMap::generateMipmaps()
-{
-    if (!isCubeComplete())
-    {
-        return error(GL_INVALID_OPERATION);
-    }
-
-    if (!getContext()->supportsNonPower2Texture())
-    {
-        if (!isPow2(mImageArray[0][0].getWidth()))
-        {
-            return error(GL_INVALID_OPERATION);
-        }
-    }
-
-    // Purge array levels 1 through q and reset them to represent the generated mipmap levels.
-    unsigned int q = log2(mImageArray[0][0].getWidth());
-    for (unsigned int f = 0; f < 6; f++)
-    {
-        for (unsigned int i = 1; i <= q; i++)
-        {
-            redefineImage(f, i, mImageArray[f][0].getFormat(),
-                                std::max(mImageArray[f][0].getWidth() >> i, 1),
-                                std::max(mImageArray[f][0].getWidth() >> i, 1),
-                                mImageArray[f][0].getType());
-        }
-    }
-
-    if (mTexStorage && mTexStorage->isRenderTarget())
-    {
-        for (unsigned int f = 0; f < 6; f++)
-        {
-            for (unsigned int i = 1; i <= q; i++)
-            {
-                IDirect3DSurface9 *upper = mTexStorage->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i-1);
-                IDirect3DSurface9 *lower = mTexStorage->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i);
-
-                if (upper != NULL && lower != NULL)
-                {
-                    getBlitter()->boxFilter(upper, lower);
-                }
-
-                if (upper != NULL) upper->Release();
-                if (lower != NULL) lower->Release();
-
-                mImageArray[f][i].markClean();
-            }
-        }
-    }
-    else
-    {
-        for (unsigned int f = 0; f < 6; f++)
-        {
-            for (unsigned int i = 1; i <= q; i++)
-            {
-                if (mImageArray[f][i].getSurface() == NULL)
-                {
-                    return error(GL_OUT_OF_MEMORY);
-                }
-
-                if (FAILED(D3DXLoadSurfaceFromSurface(mImageArray[f][i].getSurface(), NULL, NULL, mImageArray[f][i - 1].getSurface(), NULL, NULL, D3DX_FILTER_BOX, 0)))
-                {
-                    ERR(" failed to load filter %d to %d.", i - 1, i);
-                }
-
-                mImageArray[f][i].markDirty();
-            }
-        }
-    }
-}
-
-Renderbuffer *TextureCubeMap::getRenderbuffer(GLenum target)
-{
-    if (!IsCubemapTextureTarget(target))
-    {
-        return error(GL_INVALID_OPERATION, (Renderbuffer *)NULL);
-    }
-
-    unsigned int face = faceIndex(target);
-
-    if (mFaceProxies[face] == NULL)
-    {
-        mFaceProxies[face] = new Renderbuffer(id(), new RenderbufferTextureCubeMap(this, target));
-    }
-
-    return mFaceProxies[face];
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-IDirect3DSurface9 *TextureCubeMap::getRenderTarget(GLenum target)
-{
-    ASSERT(IsCubemapTextureTarget(target));
-
-    // ensure the underlying texture is created
-    if (getStorage(true) == NULL)
-    {
-        return NULL;
-    }
-
-    updateTexture();
-    
-    return mTexStorage->getCubeMapSurface(target, 0);
-}
-
-TextureStorage *TextureCubeMap::getStorage(bool renderTarget)
-{
-    if (!mTexStorage || (renderTarget && !mTexStorage->isRenderTarget()))
-    {
-        if (renderTarget)
-        {
-            convertToRenderTarget();
-        }
-        else
-        {
-            createTexture();
-        }
-    }
-
-    return mTexStorage;
-}
-
-}
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.h b/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.h
deleted file mode 100644
index 313a162..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.h
+++ /dev/null
@@ -1,427 +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.
-//
-
-// Texture.h: Defines the abstract gl::Texture class and its concrete derived
-// classes Texture2D and TextureCubeMap. Implements GL texture objects and
-// related functionality. [OpenGL ES 2.0.24] section 3.7 page 63.
-
-#ifndef LIBGLESV2_TEXTURE_H_
-#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/utilities.h"
-
-namespace egl
-{
-class Surface;
-}
-
-namespace gl
-{
-class Blit;
-class Framebuffer;
-
-enum
-{
-    // These are the maximums the implementation can support
-    // The actual GL caps are limited by the device caps
-    // and should be queried from the Context
-    IMPLEMENTATION_MAX_TEXTURE_SIZE = 16384,
-    IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE = 16384,
-
-    IMPLEMENTATION_MAX_TEXTURE_LEVELS = 15   // 1+log2 of MAX_TEXTURE_SIZE
-};
-
-class Image
-{
-  public:
-    Image();
-    ~Image();
-
-    bool redefine(GLenum format, GLsizei width, GLsizei height, GLenum type, bool forceRelease);
-    void markDirty() {mDirty = true;}
-    void markClean() {mDirty = false;}
-
-    bool isRenderableFormat() const;
-    D3DFORMAT getD3DFormat() const;
-
-    GLsizei getWidth() const {return mWidth;}
-    GLsizei getHeight() const {return mHeight;}
-    GLenum getFormat() const {return mFormat;}
-    GLenum getType() const {return mType;}
-    bool isDirty() const {return mSurface && mDirty;}
-    IDirect3DSurface9 *getSurface();
-
-    void setManagedSurface(IDirect3DSurface9 *surface);
-    void updateSurface(IDirect3DSurface9 *dest, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
-
-    void loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum type,
-                  GLint unpackAlignment, const void *input);
-
-    void loadAlphaData(GLsizei width, GLsizei height,
-                       int inputPitch, const void *input, size_t outputPitch, void *output) const;
-    void loadAlphaDataSSE2(GLsizei width, GLsizei height,
-                           int inputPitch, const void *input, size_t outputPitch, void *output) const;
-    void loadAlphaFloatData(GLsizei width, GLsizei height,
-                            int inputPitch, const void *input, size_t outputPitch, void *output) const;
-    void loadAlphaHalfFloatData(GLsizei width, GLsizei height,
-                                int inputPitch, const void *input, size_t outputPitch, void *output) const;
-    void loadLuminanceData(GLsizei width, GLsizei height,
-                           int inputPitch, const void *input, size_t outputPitch, void *output, bool native) const;
-    void loadLuminanceFloatData(GLsizei width, GLsizei height,
-                                int inputPitch, const void *input, size_t outputPitch, void *output) const;
-    void loadLuminanceHalfFloatData(GLsizei width, GLsizei height,
-                                    int inputPitch, const void *input, size_t outputPitch, void *output) const;
-    void loadLuminanceAlphaData(GLsizei width, GLsizei height,
-                                int inputPitch, const void *input, size_t outputPitch, void *output, bool native) const;
-    void loadLuminanceAlphaFloatData(GLsizei width, GLsizei height,
-                                     int inputPitch, const void *input, size_t outputPitch, void *output) const;
-    void loadLuminanceAlphaHalfFloatData(GLsizei width, GLsizei height,
-                                         int inputPitch, const void *input, size_t outputPitch, void *output) const;
-    void loadRGBUByteData(GLsizei width, GLsizei height,
-                          int inputPitch, const void *input, size_t outputPitch, void *output) const;
-    void loadRGB565Data(GLsizei width, GLsizei height,
-                        int inputPitch, const void *input, size_t outputPitch, void *output) const;
-    void loadRGBFloatData(GLsizei width, GLsizei height,
-                          int inputPitch, const void *input, size_t outputPitch, void *output) const;
-    void loadRGBHalfFloatData(GLsizei width, GLsizei height,
-                              int inputPitch, const void *input, size_t outputPitch, void *output) const;
-    void loadRGBAUByteDataSSE2(GLsizei width, GLsizei height,
-                               int inputPitch, const void *input, size_t outputPitch, void *output) const;
-    void loadRGBAUByteData(GLsizei width, GLsizei height,
-                           int inputPitch, const void *input, size_t outputPitch, void *output) const;
-    void loadRGBA4444Data(GLsizei width, GLsizei height,
-                          int inputPitch, const void *input, size_t outputPitch, void *output) const;
-    void loadRGBA5551Data(GLsizei width, GLsizei height,
-                          int inputPitch, const void *input, size_t outputPitch, void *output) const;
-    void loadRGBAFloatData(GLsizei width, GLsizei height,
-                           int inputPitch, const void *input, size_t outputPitch, void *output) const;
-    void loadRGBAHalfFloatData(GLsizei width, GLsizei height,
-                               int inputPitch, const void *input, size_t outputPitch, void *output) const;
-    void loadBGRAData(GLsizei width, GLsizei height,
-                      int inputPitch, const void *input, size_t outputPitch, void *output) const;
-    void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
-                            const void *input);
-
-    void copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, IDirect3DSurface9 *renderTarget);
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Image);
-
-    void createSurface();
-
-    HRESULT lock(D3DLOCKED_RECT *lockedRect, const RECT *rect);
-    void unlock();
-
-    GLsizei mWidth;
-    GLsizei mHeight;
-    GLenum mFormat;
-    GLenum mType;
-
-    bool mDirty;
-
-    D3DPOOL mD3DPool;   // can only be D3DPOOL_SYSTEMMEM or D3DPOOL_MANAGED since it needs to be lockable.
-    D3DFORMAT mD3DFormat;
-
-    IDirect3DSurface9 *mSurface;
-};
-
-class TextureStorage
-{
-  public:
-    explicit TextureStorage(DWORD usage);
-
-    virtual ~TextureStorage();
-
-    bool isRenderTarget() const;
-    bool isManaged() const;
-    D3DPOOL getPool() const;
-    DWORD getUsage() const;
-    unsigned int getTextureSerial() const;
-    virtual unsigned int getRenderTargetSerial(GLenum target) const = 0;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(TextureStorage);
-
-    const DWORD mD3DUsage;
-    const D3DPOOL mD3DPool;
-
-    const unsigned int mTextureSerial;
-    static unsigned int issueTextureSerial();
-
-    static unsigned int mCurrentTextureSerial;
-};
-
-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);
-
-    GLenum getMinFilter() const;
-    GLenum getMagFilter() const;
-    GLenum getWrapS() const;
-    GLenum getWrapT() const;
-    GLenum getUsage() const;
-
-    virtual bool isSamplerComplete() const = 0;
-
-    IDirect3DBaseTexture9 *getTexture();
-    virtual Renderbuffer *getRenderbuffer(GLenum target) = 0;
-
-    virtual void generateMipmaps() = 0;
-    virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) = 0;
-
-    bool hasDirtyParameters() const;
-    bool hasDirtyImages() const;
-    void resetDirty();
-    unsigned int getTextureSerial();
-    unsigned int getRenderTargetSerial(GLenum target);
-
-    bool isImmutable() const;
-
-    static const GLuint INCOMPLETE_TEXTURE_ID = static_cast<GLuint>(-1);   // Every texture takes an id at creation time. The value is arbitrary because it is never registered with the resource manager.
-
-  protected:
-    void setImage(GLint unpackAlignment, const void *pixels, Image *image);
-    bool subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, Image *image);
-    void setCompressedImage(GLsizei imageSize, const void *pixels, Image *image);
-    bool subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, Image *image);
-
-    GLint creationLevels(GLsizei width, GLsizei height) const;
-    GLint creationLevels(GLsizei size) const;
-
-    virtual IDirect3DBaseTexture9 *getBaseTexture() const = 0;
-    virtual void createTexture() = 0;
-    virtual void updateTexture() = 0;
-    virtual void convertToRenderTarget() = 0;
-    virtual IDirect3DSurface9 *getRenderTarget(GLenum target) = 0;
-
-    int levelCount() const;
-
-    static Blit *getBlitter();
-    static bool copyToRenderTarget(IDirect3DSurface9 *dest, IDirect3DSurface9 *source, bool fromManaged);
-
-    GLenum mMinFilter;
-    GLenum mMagFilter;
-    GLenum mWrapS;
-    GLenum mWrapT;
-    bool mDirtyParameters;
-    GLenum mUsage;
-
-    bool mDirtyImages;
-
-    bool mImmutable;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Texture);
-
-    virtual TextureStorage *getStorage(bool renderTarget) = 0;
-};
-
-class TextureStorage2D : public TextureStorage
-{
-  public:
-    explicit TextureStorage2D(IDirect3DTexture9 *surfaceTexture);
-    TextureStorage2D(int levels, D3DFORMAT format, DWORD usage, int width, int height);
-
-    virtual ~TextureStorage2D();
-
-    IDirect3DSurface9 *getSurfaceLevel(int level);
-    IDirect3DBaseTexture9 *getBaseTexture() const;
-
-    virtual unsigned int getRenderTargetSerial(GLenum target) const;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(TextureStorage2D);
-
-    IDirect3DTexture9 *mTexture;
-    const unsigned int mRenderTargetSerial;
-};
-
-class Texture2D : public Texture
-{
-  public:
-    explicit Texture2D(GLuint id);
-
-    ~Texture2D();
-
-    void addProxyRef(const Renderbuffer *proxy);
-    void releaseProxy(const Renderbuffer *proxy);
-
-    virtual GLenum getTarget() const;
-
-    GLsizei getWidth(GLint level) const;
-    GLsizei getHeight(GLint level) const;
-    GLenum getInternalFormat(GLint level) const;
-    D3DFORMAT getD3DFormat(GLint level) const;
-    bool isCompressed(GLint level) const;
-    bool isDepth(GLint level) const;
-
-    void setImage(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
-    void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
-    void subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
-    void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels);
-    void copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
-    virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
-    void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-
-    virtual bool isSamplerComplete() const;
-    virtual void bindTexImage(egl::Surface *surface);
-    virtual void releaseTexImage();
-
-    virtual void generateMipmaps();
-
-    virtual Renderbuffer *getRenderbuffer(GLenum target);
-
-  protected:
-    friend class RenderbufferTexture2D;
-    virtual IDirect3DSurface9 *getRenderTarget(GLenum target);
-    virtual IDirect3DSurface9 *getDepthStencil(GLenum target);
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Texture2D);
-
-    virtual IDirect3DBaseTexture9 *getBaseTexture() const;
-    virtual void createTexture();
-    virtual void updateTexture();
-    virtual void convertToRenderTarget();
-    virtual TextureStorage *getStorage(bool renderTarget);
-
-    bool isMipmapComplete() const;
-
-    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;
-
-    // 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, DWORD usage, int size);
-
-    virtual ~TextureStorageCubeMap();
-
-    IDirect3DSurface9 *getCubeMapSurface(GLenum faceTarget, int level);
-    IDirect3DBaseTexture9 *getBaseTexture() const;
-
-    virtual unsigned int getRenderTargetSerial(GLenum target) const;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(TextureStorageCubeMap);
-
-    IDirect3DCubeTexture9 *mTexture;
-    const unsigned int mFirstRenderTargetSerial;
-};
-
-class TextureCubeMap : public Texture
-{
-  public:
-    explicit TextureCubeMap(GLuint id);
-
-    ~TextureCubeMap();
-
-    void addProxyRef(const Renderbuffer *proxy);
-    void releaseProxy(const Renderbuffer *proxy);
-
-    virtual GLenum getTarget() const;
-    
-    GLsizei getWidth(GLenum target, GLint level) const;
-    GLsizei getHeight(GLenum target, GLint level) const;
-    GLenum getInternalFormat(GLenum target, GLint level) const;
-    D3DFORMAT getD3DFormat(GLenum target, GLint level) const;
-    bool isCompressed(GLenum target, GLint level) const;
-
-    void setImagePosX(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
-    void setImageNegX(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
-    void setImagePosY(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
-    void setImageNegY(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
-    void setImagePosZ(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
-    void setImageNegZ(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
-
-    void setCompressedImage(GLenum face, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
-
-    void subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
-    void subImageCompressed(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels);
-    void copyImage(GLenum target, GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
-    virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
-    void storage(GLsizei levels, GLenum internalformat, GLsizei size);
-
-    virtual bool isSamplerComplete() const;
-
-    virtual void generateMipmaps();
-
-    virtual Renderbuffer *getRenderbuffer(GLenum target);
-
-    static unsigned int faceIndex(GLenum face);
-
-  protected:
-    friend class RenderbufferTextureCubeMap;
-    virtual IDirect3DSurface9 *getRenderTarget(GLenum target);
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(TextureCubeMap);
-
-    virtual IDirect3DBaseTexture9 *getBaseTexture() const;
-    virtual void createTexture();
-    virtual void updateTexture();
-    virtual void convertToRenderTarget();
-    virtual TextureStorage *getStorage(bool renderTarget);
-
-    bool isCubeComplete() const;
-    bool isMipmapCubeComplete() const;
-
-    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;
-
-    // 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
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/VertexDataManager.cpp b/Source/ThirdParty/ANGLE/src/libGLESv2/VertexDataManager.cpp
deleted file mode 100644
index 70f475f..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/VertexDataManager.cpp
+++ /dev/null
@@ -1,784 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// VertexDataManager.h: Defines the VertexDataManager, a class that
-// runs the Buffer translation process.
-
-#include "libGLESv2/VertexDataManager.h"
-
-#include "common/debug.h"
-
-#include "libGLESv2/Buffer.h"
-#include "libGLESv2/Program.h"
-#include "libGLESv2/ProgramBinary.h"
-#include "libGLESv2/main.h"
-
-#include "libGLESv2/vertexconversion.h"
-#include "libGLESv2/IndexDataManager.h"
-
-namespace
-{
-    enum { INITIAL_STREAM_BUFFER_SIZE = 1024*1024 };
-    // This has to be at least 4k or else it fails on ATI cards.
-    enum { CONSTANT_VERTEX_BUFFER_SIZE = 4096 };
-}
-
-namespace gl
-{
-unsigned int VertexBuffer::mCurrentSerial = 1;
-
-int elementsInBuffer(const VertexAttribute &attribute, int size)
-{
-    int stride = attribute.stride();
-    return (size - attribute.mOffset % stride + (stride - attribute.typeSize())) / stride;
-}
-
-VertexDataManager::VertexDataManager(Context *context, IDirect3DDevice9 *device) : mContext(context), mDevice(device)
-{
-    for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
-    {
-        mDirtyCurrentValue[i] = true;
-        mCurrentValueBuffer[i] = NULL;
-        mCurrentValueOffsets[i] = 0;
-    }
-
-    const D3DCAPS9 &caps = context->getDeviceCaps();
-    checkVertexCaps(caps.DeclTypes);
-
-    mStreamingBuffer = new StreamingVertexBuffer(mDevice, INITIAL_STREAM_BUFFER_SIZE);
-
-    if (!mStreamingBuffer)
-    {
-        ERR("Failed to allocate the streaming vertex buffer.");
-    }
-}
-
-VertexDataManager::~VertexDataManager()
-{
-    delete mStreamingBuffer;
-
-    for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
-    {
-        delete mCurrentValueBuffer[i];
-    }
-}
-
-std::size_t VertexDataManager::writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute, GLsizei instances)
-{
-    Buffer *buffer = attribute.mBoundBuffer.get();
-
-    int inputStride = attribute.stride();
-    int elementSize = attribute.typeSize();
-    const FormatConverter &converter = formatConverter(attribute);
-    std::size_t streamOffset = 0;
-
-    void *output = NULL;
-    
-    if (vertexBuffer)
-    {
-        output = vertexBuffer->map(attribute, spaceRequired(attribute, count, instances), &streamOffset);
-    }
-
-    if (output == NULL)
-    {
-        ERR("Failed to map vertex buffer.");
-        return -1;
-    }
-
-    const char *input = NULL;
-
-    if (buffer)
-    {
-        int offset = attribute.mOffset;
-
-        input = static_cast<const char*>(buffer->data()) + offset;
-    }
-    else
-    {
-        input = static_cast<const char*>(attribute.mPointer);
-    }
-
-    if (instances == 0 || attribute.mDivisor == 0)
-    {
-        input += inputStride * start;
-    }
-
-    if (converter.identity && inputStride == elementSize)
-    {
-        memcpy(output, input, count * inputStride);
-    }
-    else
-    {
-        converter.convertArray(input, inputStride, count, output);
-    }
-
-    vertexBuffer->unmap();
-
-    return streamOffset;
-}
-
-GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, TranslatedAttribute *translated, GLsizei instances)
-{
-    if (!mStreamingBuffer)
-    {
-        return GL_OUT_OF_MEMORY;
-    }
-
-    const VertexAttributeArray &attribs = mContext->getVertexAttributes();
-    Program *program = mContext->getCurrentProgram();
-    ProgramBinary *programBinary = program->getProgramBinary();
-
-    for (int attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; attributeIndex++)
-    {
-        translated[attributeIndex].active = (programBinary->getSemanticIndex(attributeIndex) != -1);
-    }
-
-    // Determine the required storage size per used buffer, and invalidate static buffers that don't contain matching attributes
-    for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
-    {
-        if (translated[i].active && attribs[i].mArrayEnabled)
-        {
-            Buffer *buffer = attribs[i].mBoundBuffer.get();
-            StaticVertexBuffer *staticBuffer = buffer ? buffer->getStaticVertexBuffer() : NULL;
-
-            if (staticBuffer)
-            {
-                if (staticBuffer->size() == 0)
-                {
-                    int totalCount = elementsInBuffer(attribs[i], buffer->size());
-                    staticBuffer->addRequiredSpace(spaceRequired(attribs[i], totalCount, 0));
-                }
-                else if (staticBuffer->lookupAttribute(attribs[i]) == -1)
-                {
-                    // This static buffer doesn't have matching attributes, so fall back to using the streaming buffer
-                    // Add the space of all previous attributes belonging to the invalidated static buffer to the streaming buffer
-                    for (int previous = 0; previous < i; previous++)
-                    {
-                        if (translated[previous].active && attribs[previous].mArrayEnabled)
-                        {
-                            Buffer *previousBuffer = attribs[previous].mBoundBuffer.get();
-                            StaticVertexBuffer *previousStaticBuffer = previousBuffer ? previousBuffer->getStaticVertexBuffer() : NULL;
-
-                            if (staticBuffer == previousStaticBuffer)
-                            {
-                                mStreamingBuffer->addRequiredSpace(spaceRequired(attribs[previous], count, instances));
-                            }
-                        }
-                    }
-
-                    mStreamingBuffer->addRequiredSpace(spaceRequired(attribs[i], count, instances));
-
-                    buffer->invalidateStaticData();
-                }    
-            }
-            else
-            {
-                mStreamingBuffer->addRequiredSpace(spaceRequired(attribs[i], count, instances));
-            }
-        }
-    }
-
-    // Reserve the required space per used buffer
-    for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
-    {
-        if (translated[i].active && attribs[i].mArrayEnabled)
-        {
-            Buffer *buffer = attribs[i].mBoundBuffer.get();
-            ArrayVertexBuffer *staticBuffer = buffer ? buffer->getStaticVertexBuffer() : NULL;
-            ArrayVertexBuffer *vertexBuffer = staticBuffer ? staticBuffer : mStreamingBuffer;
-
-            if (vertexBuffer)
-            {
-                vertexBuffer->reserveRequiredSpace();
-            }
-        }
-    }
-
-    // Perform the vertex data translations
-    for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
-    {
-        if (translated[i].active)
-        {
-            if (attribs[i].mArrayEnabled)
-            {
-                Buffer *buffer = attribs[i].mBoundBuffer.get();
-
-                if (!buffer && attribs[i].mPointer == NULL)
-                {
-                    // This is an application error that would normally result in a crash, but we catch it and return an error
-                    ERR("An enabled vertex array has no buffer and no pointer.");
-                    return GL_INVALID_OPERATION;
-                }
-
-                const FormatConverter &converter = formatConverter(attribs[i]);
-
-                StaticVertexBuffer *staticBuffer = buffer ? buffer->getStaticVertexBuffer() : NULL;
-                ArrayVertexBuffer *vertexBuffer = staticBuffer ? staticBuffer : static_cast<ArrayVertexBuffer*>(mStreamingBuffer);
-
-                std::size_t streamOffset = -1;
-
-                if (staticBuffer)
-                {
-                    streamOffset = staticBuffer->lookupAttribute(attribs[i]);
-
-                    if (streamOffset == -1)
-                    {
-                        // Convert the entire buffer
-                        int totalCount = elementsInBuffer(attribs[i], buffer->size());
-                        int startIndex = attribs[i].mOffset / attribs[i].stride();
-
-                        streamOffset = writeAttributeData(staticBuffer, -startIndex, totalCount, attribs[i], 0);
-                    }
-
-                    if (streamOffset != -1)
-                    {
-                        streamOffset += (attribs[i].mOffset / attribs[i].stride()) * converter.outputElementSize;
-
-                        if (instances == 0 || attribs[i].mDivisor == 0)
-                        {
-                            streamOffset += start * converter.outputElementSize;
-                        }
-                    }
-                }
-                else
-                {
-                    streamOffset = writeAttributeData(mStreamingBuffer, start, count, attribs[i], instances);
-                }
-
-                if (streamOffset == -1)
-                {
-                    return GL_OUT_OF_MEMORY;
-                }
-
-                translated[i].vertexBuffer = vertexBuffer->getBuffer();
-                translated[i].serial = vertexBuffer->getSerial();
-                translated[i].divisor = attribs[i].mDivisor;
-
-                translated[i].type = converter.d3dDeclType;
-                translated[i].stride = converter.outputElementSize;
-                translated[i].offset = streamOffset;
-            }
-            else
-            {
-                if (!mCurrentValueBuffer[i])
-                {
-                    mCurrentValueBuffer[i] = new StreamingVertexBuffer(mDevice, CONSTANT_VERTEX_BUFFER_SIZE);
-                }
-
-                StreamingVertexBuffer *buffer = mCurrentValueBuffer[i];
-
-                if (mDirtyCurrentValue[i])
-                {
-                    const int requiredSpace = 4 * sizeof(float);
-                    buffer->addRequiredSpace(requiredSpace);
-                    buffer->reserveRequiredSpace();
-                    float *data = static_cast<float*>(buffer->map(VertexAttribute(), requiredSpace, &mCurrentValueOffsets[i]));
-                    if (data)
-                    {
-                        data[0] = attribs[i].mCurrentValue[0];
-                        data[1] = attribs[i].mCurrentValue[1];
-                        data[2] = attribs[i].mCurrentValue[2];
-                        data[3] = attribs[i].mCurrentValue[3];
-                        buffer->unmap();
-                        mDirtyCurrentValue[i] = false;
-                    }
-                }
-
-                translated[i].vertexBuffer = mCurrentValueBuffer[i]->getBuffer();
-                translated[i].serial = mCurrentValueBuffer[i]->getSerial();
-                translated[i].divisor = 0;
-
-                translated[i].type = D3DDECLTYPE_FLOAT4;
-                translated[i].stride = 0;
-                translated[i].offset = mCurrentValueOffsets[i];
-            }
-        }
-    }
-
-    for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
-    {
-        if (translated[i].active && attribs[i].mArrayEnabled)
-        {
-            Buffer *buffer = attribs[i].mBoundBuffer.get();
-
-            if (buffer)
-            {
-                buffer->promoteStaticUsage(count * attribs[i].typeSize());
-            }
-        }
-    }
-
-    return GL_NO_ERROR;
-}
-
-std::size_t VertexDataManager::spaceRequired(const VertexAttribute &attrib, std::size_t count, GLsizei instances) const
-{
-    size_t elementSize = formatConverter(attrib).outputElementSize;
-
-    if (instances == 0 || attrib.mDivisor == 0)
-    {
-        return elementSize * count;
-    }
-    else
-    {
-        return elementSize * ((instances + attrib.mDivisor - 1) / attrib.mDivisor);
-    }
-}
-
-// Mapping from OpenGL-ES vertex attrib type to D3D decl type:
-//
-// BYTE                 SHORT (Cast)
-// BYTE-norm            FLOAT (Normalize) (can't be exactly represented as SHORT-norm)
-// UNSIGNED_BYTE        UBYTE4 (Identity) or SHORT (Cast)
-// UNSIGNED_BYTE-norm   UBYTE4N (Identity) or FLOAT (Normalize)
-// SHORT                SHORT (Identity)
-// SHORT-norm           SHORT-norm (Identity) or FLOAT (Normalize)
-// UNSIGNED_SHORT       FLOAT (Cast)
-// UNSIGNED_SHORT-norm  USHORT-norm (Identity) or FLOAT (Normalize)
-// FIXED (not in WebGL) FLOAT (FixedToFloat)
-// FLOAT                FLOAT (Identity)
-
-// GLToCType maps from GL type (as GLenum) to the C typedef. 
-template <GLenum GLType> struct GLToCType { };
-
-template <> struct GLToCType<GL_BYTE> { typedef GLbyte type; };
-template <> struct GLToCType<GL_UNSIGNED_BYTE> { typedef GLubyte type; };
-template <> struct GLToCType<GL_SHORT> { typedef GLshort type; };
-template <> struct GLToCType<GL_UNSIGNED_SHORT> { typedef GLushort type; };
-template <> struct GLToCType<GL_FIXED> { typedef GLuint type; };
-template <> struct GLToCType<GL_FLOAT> { typedef GLfloat type; };
-
-// This differs from D3DDECLTYPE in that it is unsized. (Size expansion is applied last.)
-enum D3DVertexType
-{
-    D3DVT_FLOAT,
-    D3DVT_SHORT,
-    D3DVT_SHORT_NORM,
-    D3DVT_UBYTE,
-    D3DVT_UBYTE_NORM,
-    D3DVT_USHORT_NORM
-};
-
-// D3DToCType maps from D3D vertex type (as enum D3DVertexType) to the corresponding C type.
-template <unsigned int D3DType> struct D3DToCType { };
-
-template <> struct D3DToCType<D3DVT_FLOAT> { typedef float type; };
-template <> struct D3DToCType<D3DVT_SHORT> { typedef short type; };
-template <> struct D3DToCType<D3DVT_SHORT_NORM> { typedef short type; };
-template <> struct D3DToCType<D3DVT_UBYTE> { typedef unsigned char type; };
-template <> struct D3DToCType<D3DVT_UBYTE_NORM> { typedef unsigned char type; };
-template <> struct D3DToCType<D3DVT_USHORT_NORM> { typedef unsigned short type; };
-
-// Encode the type/size combinations that D3D permits. For each type/size it expands to a widener that will provide the appropriate final size.
-template <unsigned int type, int size>
-struct WidenRule
-{
-};
-
-template <int size> struct WidenRule<D3DVT_FLOAT, size>          : gl::NoWiden<size> { };
-template <int size> struct WidenRule<D3DVT_SHORT, size>          : gl::WidenToEven<size> { };
-template <int size> struct WidenRule<D3DVT_SHORT_NORM, size>     : gl::WidenToEven<size> { };
-template <int size> struct WidenRule<D3DVT_UBYTE, size>          : gl::WidenToFour<size> { };
-template <int size> struct WidenRule<D3DVT_UBYTE_NORM, size>     : gl::WidenToFour<size> { };
-template <int size> struct WidenRule<D3DVT_USHORT_NORM, size>    : gl::WidenToEven<size> { };
-
-// VertexTypeFlags encodes the D3DCAPS9::DeclType flag and vertex declaration flag for each D3D vertex type & size combination.
-template <unsigned int d3dtype, int size>
-struct VertexTypeFlags
-{
-};
-
-template <unsigned int capflag, unsigned int declflag>
-struct VertexTypeFlagsHelper
-{
-    enum { capflag = capflag };
-    enum { declflag = declflag };
-};
-
-template <> struct VertexTypeFlags<D3DVT_FLOAT, 1> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT1> { };
-template <> struct VertexTypeFlags<D3DVT_FLOAT, 2> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT2> { };
-template <> struct VertexTypeFlags<D3DVT_FLOAT, 3> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT3> { };
-template <> struct VertexTypeFlags<D3DVT_FLOAT, 4> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT4> { };
-template <> struct VertexTypeFlags<D3DVT_SHORT, 2> : VertexTypeFlagsHelper<0, D3DDECLTYPE_SHORT2> { };
-template <> struct VertexTypeFlags<D3DVT_SHORT, 4> : VertexTypeFlagsHelper<0, D3DDECLTYPE_SHORT4> { };
-template <> struct VertexTypeFlags<D3DVT_SHORT_NORM, 2> : VertexTypeFlagsHelper<D3DDTCAPS_SHORT2N, D3DDECLTYPE_SHORT2N> { };
-template <> struct VertexTypeFlags<D3DVT_SHORT_NORM, 4> : VertexTypeFlagsHelper<D3DDTCAPS_SHORT4N, D3DDECLTYPE_SHORT4N> { };
-template <> struct VertexTypeFlags<D3DVT_UBYTE, 4> : VertexTypeFlagsHelper<D3DDTCAPS_UBYTE4, D3DDECLTYPE_UBYTE4> { };
-template <> struct VertexTypeFlags<D3DVT_UBYTE_NORM, 4> : VertexTypeFlagsHelper<D3DDTCAPS_UBYTE4N, D3DDECLTYPE_UBYTE4N> { };
-template <> struct VertexTypeFlags<D3DVT_USHORT_NORM, 2> : VertexTypeFlagsHelper<D3DDTCAPS_USHORT2N, D3DDECLTYPE_USHORT2N> { };
-template <> struct VertexTypeFlags<D3DVT_USHORT_NORM, 4> : VertexTypeFlagsHelper<D3DDTCAPS_USHORT4N, D3DDECLTYPE_USHORT4N> { };
-
-
-// VertexTypeMapping maps GL type & normalized flag to preferred and fallback D3D vertex types (as D3DVertexType enums).
-template <GLenum GLtype, bool normalized>
-struct VertexTypeMapping
-{
-};
-
-template <D3DVertexType Preferred, D3DVertexType Fallback = Preferred>
-struct VertexTypeMappingBase
-{
-    enum { preferred = Preferred };
-    enum { fallback = Fallback };
-};
-
-template <> struct VertexTypeMapping<GL_BYTE, false>                        : VertexTypeMappingBase<D3DVT_SHORT> { };                       // Cast
-template <> struct VertexTypeMapping<GL_BYTE, true>                         : VertexTypeMappingBase<D3DVT_FLOAT> { };                       // Normalize
-template <> struct VertexTypeMapping<GL_UNSIGNED_BYTE, false>               : VertexTypeMappingBase<D3DVT_UBYTE, D3DVT_FLOAT> { };          // Identity, Cast
-template <> struct VertexTypeMapping<GL_UNSIGNED_BYTE, true>                : VertexTypeMappingBase<D3DVT_UBYTE_NORM, D3DVT_FLOAT> { };     // Identity, Normalize
-template <> struct VertexTypeMapping<GL_SHORT, false>                       : VertexTypeMappingBase<D3DVT_SHORT> { };                       // Identity
-template <> struct VertexTypeMapping<GL_SHORT, true>                        : VertexTypeMappingBase<D3DVT_SHORT_NORM, D3DVT_FLOAT> { };     // Cast, Normalize
-template <> struct VertexTypeMapping<GL_UNSIGNED_SHORT, false>              : VertexTypeMappingBase<D3DVT_FLOAT> { };                       // Cast
-template <> struct VertexTypeMapping<GL_UNSIGNED_SHORT, true>               : VertexTypeMappingBase<D3DVT_USHORT_NORM, D3DVT_FLOAT> { };    // Cast, Normalize
-template <bool normalized> struct VertexTypeMapping<GL_FIXED, normalized>   : VertexTypeMappingBase<D3DVT_FLOAT> { };                       // FixedToFloat
-template <bool normalized> struct VertexTypeMapping<GL_FLOAT, normalized>   : VertexTypeMappingBase<D3DVT_FLOAT> { };                       // Identity
-
-
-// Given a GL type & norm flag and a D3D type, ConversionRule provides the type conversion rule (Cast, Normalize, Identity, FixedToFloat).
-// The conversion rules themselves are defined in vertexconversion.h.
-
-// Almost all cases are covered by Cast (including those that are actually Identity since Cast<T,T> knows it's an identity mapping).
-template <GLenum fromType, bool normalized, unsigned int toType>
-struct ConversionRule : gl::Cast<typename GLToCType<fromType>::type, typename D3DToCType<toType>::type>
-{
-};
-
-// All conversions from normalized types to float use the Normalize operator.
-template <GLenum fromType> struct ConversionRule<fromType, true, D3DVT_FLOAT> : gl::Normalize<typename GLToCType<fromType>::type> { };
-
-// Use a full specialisation for this so that it preferentially matches ahead of the generic normalize-to-float rules.
-template <> struct ConversionRule<GL_FIXED, true, D3DVT_FLOAT> : gl::FixedToFloat<GLint, 16> { };
-template <> struct ConversionRule<GL_FIXED, false, D3DVT_FLOAT> : gl::FixedToFloat<GLint, 16> { };
-
-// A 2-stage construction is used for DefaultVertexValues because float must use SimpleDefaultValues (i.e. 0/1)
-// whether it is normalized or not.
-template <class T, bool normalized>
-struct DefaultVertexValuesStage2
-{
-};
-
-template <class T> struct DefaultVertexValuesStage2<T, true>  : gl::NormalizedDefaultValues<T> { };
-template <class T> struct DefaultVertexValuesStage2<T, false> : gl::SimpleDefaultValues<T> { };
-
-// Work out the default value rule for a D3D type (expressed as the C type) and 
-template <class T, bool normalized>
-struct DefaultVertexValues : DefaultVertexValuesStage2<T, normalized>
-{
-};
-
-template <bool normalized> struct DefaultVertexValues<float, normalized> : gl::SimpleDefaultValues<float> { };
-
-// Policy rules for use with Converter, to choose whether to use the preferred or fallback conversion.
-// The fallback conversion produces an output that all D3D9 devices must support.
-template <class T> struct UsePreferred { enum { type = T::preferred }; };
-template <class T> struct UseFallback { enum { type = T::fallback }; };
-
-// Converter ties it all together. Given an OpenGL type/norm/size and choice of preferred/fallback conversion,
-// it provides all the members of the appropriate VertexDataConverter, the D3DCAPS9::DeclTypes flag in cap flag
-// and the D3DDECLTYPE member needed for the vertex declaration in declflag.
-template <GLenum fromType, bool normalized, int size, template <class T> class PreferenceRule>
-struct Converter
-    : gl::VertexDataConverter<typename GLToCType<fromType>::type,
-                              WidenRule<PreferenceRule< VertexTypeMapping<fromType, normalized> >::type, size>,
-                              ConversionRule<fromType,
-                                             normalized,
-                                             PreferenceRule< VertexTypeMapping<fromType, normalized> >::type>,
-                              DefaultVertexValues<typename D3DToCType<PreferenceRule< VertexTypeMapping<fromType, normalized> >::type>::type, normalized > >
-{
-private:
-    enum { d3dtype = PreferenceRule< VertexTypeMapping<fromType, normalized> >::type };
-    enum { d3dsize = WidenRule<d3dtype, size>::finalWidth };
-
-public:
-    enum { capflag = VertexTypeFlags<d3dtype, d3dsize>::capflag };
-    enum { declflag = VertexTypeFlags<d3dtype, d3dsize>::declflag };
-};
-
-// Initialise a TranslationInfo
-#define TRANSLATION(type, norm, size, preferred)                                    \
-    {                                                                               \
-        Converter<type, norm, size, preferred>::identity,                           \
-        Converter<type, norm, size, preferred>::finalSize,                          \
-        Converter<type, norm, size, preferred>::convertArray,                       \
-        static_cast<D3DDECLTYPE>(Converter<type, norm, size, preferred>::declflag)  \
-    }
-
-#define TRANSLATION_FOR_TYPE_NORM_SIZE(type, norm, size)    \
-    {                                                       \
-        Converter<type, norm, size, UsePreferred>::capflag, \
-        TRANSLATION(type, norm, size, UsePreferred),        \
-        TRANSLATION(type, norm, size, UseFallback)          \
-    }
-
-#define TRANSLATIONS_FOR_TYPE(type)                                                                                                                                                                         \
-    {                                                                                                                                                                                                       \
-        { TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 4) }, \
-        { TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 4) },     \
-    }
-
-#define TRANSLATIONS_FOR_TYPE_NO_NORM(type)                                                                                                                                                                 \
-    {                                                                                                                                                                                                       \
-        { TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 4) }, \
-        { TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 4) }, \
-    }
-
-const VertexDataManager::TranslationDescription VertexDataManager::mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4] = // [GL types as enumerated by typeIndex()][normalized][size-1]
-{
-    TRANSLATIONS_FOR_TYPE(GL_BYTE),
-    TRANSLATIONS_FOR_TYPE(GL_UNSIGNED_BYTE),
-    TRANSLATIONS_FOR_TYPE(GL_SHORT),
-    TRANSLATIONS_FOR_TYPE(GL_UNSIGNED_SHORT),
-    TRANSLATIONS_FOR_TYPE_NO_NORM(GL_FIXED),
-    TRANSLATIONS_FOR_TYPE_NO_NORM(GL_FLOAT)
-};
-
-void VertexDataManager::checkVertexCaps(DWORD declTypes)
-{
-    for (unsigned int i = 0; i < NUM_GL_VERTEX_ATTRIB_TYPES; i++)
-    {
-        for (unsigned int j = 0; j < 2; j++)
-        {
-            for (unsigned int k = 0; k < 4; k++)
-            {
-                if (mPossibleTranslations[i][j][k].capsFlag == 0 || (declTypes & mPossibleTranslations[i][j][k].capsFlag) != 0)
-                {
-                    mAttributeTypes[i][j][k] = mPossibleTranslations[i][j][k].preferredConversion;
-                }
-                else
-                {
-                    mAttributeTypes[i][j][k] = mPossibleTranslations[i][j][k].fallbackConversion;
-                }
-            }
-        }
-    }
-}
-
-// This is used to index mAttributeTypes and mPossibleTranslations.
-unsigned int VertexDataManager::typeIndex(GLenum type) const
-{
-    switch (type)
-    {
-      case GL_BYTE: return 0;
-      case GL_UNSIGNED_BYTE: return 1;
-      case GL_SHORT: return 2;
-      case GL_UNSIGNED_SHORT: return 3;
-      case GL_FIXED: return 4;
-      case GL_FLOAT: return 5;
-
-      default: UNREACHABLE(); return 5;
-    }
-}
-
-VertexBuffer::VertexBuffer(IDirect3DDevice9 *device, std::size_t size, DWORD usageFlags) : mDevice(device), mVertexBuffer(NULL)
-{
-    if (size > 0)
-    {
-        D3DPOOL pool = getDisplay()->getBufferPool(usageFlags);
-        HRESULT result = device->CreateVertexBuffer(size, usageFlags, 0, pool, &mVertexBuffer, NULL);
-        mSerial = issueSerial();
-        
-        if (FAILED(result))
-        {
-            ERR("Out of memory allocating a vertex buffer of size %lu.", size);
-        }
-    }
-}
-
-VertexBuffer::~VertexBuffer()
-{
-    if (mVertexBuffer)
-    {
-        mVertexBuffer->Release();
-    }
-}
-
-void VertexBuffer::unmap()
-{
-    if (mVertexBuffer)
-    {
-        mVertexBuffer->Unlock();
-    }
-}
-
-IDirect3DVertexBuffer9 *VertexBuffer::getBuffer() const
-{
-    return mVertexBuffer;
-}
-
-unsigned int VertexBuffer::getSerial() const
-{
-    return mSerial;
-}
-
-unsigned int VertexBuffer::issueSerial()
-{
-    return mCurrentSerial++;
-}
-
-ArrayVertexBuffer::ArrayVertexBuffer(IDirect3DDevice9 *device, std::size_t size, DWORD usageFlags) : VertexBuffer(device, size, usageFlags)
-{
-    mBufferSize = size;
-    mWritePosition = 0;
-    mRequiredSpace = 0;
-}
-
-ArrayVertexBuffer::~ArrayVertexBuffer()
-{
-}
-
-void ArrayVertexBuffer::addRequiredSpace(UINT requiredSpace)
-{
-    mRequiredSpace += requiredSpace;
-}
-
-StreamingVertexBuffer::StreamingVertexBuffer(IDirect3DDevice9 *device, std::size_t initialSize) : ArrayVertexBuffer(device, initialSize, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY)
-{
-}
-
-StreamingVertexBuffer::~StreamingVertexBuffer()
-{
-}
-
-void *StreamingVertexBuffer::map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *offset)
-{
-    void *mapPtr = NULL;
-
-    if (mVertexBuffer)
-    {
-        HRESULT result = mVertexBuffer->Lock(mWritePosition, requiredSpace, &mapPtr, D3DLOCK_NOOVERWRITE);
-        
-        if (FAILED(result))
-        {
-            ERR("Lock failed with error 0x%08x", result);
-            return NULL;
-        }
-
-        *offset = mWritePosition;
-        mWritePosition += requiredSpace;
-    }
-
-    return mapPtr;
-}
-
-void StreamingVertexBuffer::reserveRequiredSpace()
-{
-    if (mRequiredSpace > mBufferSize)
-    {
-        if (mVertexBuffer)
-        {
-            mVertexBuffer->Release();
-            mVertexBuffer = NULL;
-        }
-
-        mBufferSize = std::max(mRequiredSpace, 3 * mBufferSize / 2);   // 1.5 x mBufferSize is arbitrary and should be checked to see we don't have too many reallocations.
-
-        D3DPOOL pool = getDisplay()->getBufferPool(D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY);
-        HRESULT result = mDevice->CreateVertexBuffer(mBufferSize, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, 0, pool, &mVertexBuffer, NULL);
-        mSerial = issueSerial();
-    
-        if (FAILED(result))
-        {
-            ERR("Out of memory allocating a vertex buffer of size %lu.", mBufferSize);
-        }
-
-        mWritePosition = 0;
-    }
-    else if (mWritePosition + mRequiredSpace > mBufferSize)   // Recycle
-    {
-        if (mVertexBuffer)
-        {
-            void *dummy;
-            mVertexBuffer->Lock(0, 1, &dummy, D3DLOCK_DISCARD);
-            mVertexBuffer->Unlock();
-        }
-
-        mWritePosition = 0;
-    }
-
-    mRequiredSpace = 0;
-}
-
-StaticVertexBuffer::StaticVertexBuffer(IDirect3DDevice9 *device) : ArrayVertexBuffer(device, 0, D3DUSAGE_WRITEONLY)
-{
-}
-
-StaticVertexBuffer::~StaticVertexBuffer()
-{
-}
-
-void *StaticVertexBuffer::map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset)
-{
-    void *mapPtr = NULL;
-
-    if (mVertexBuffer)
-    {
-        HRESULT result = mVertexBuffer->Lock(mWritePosition, requiredSpace, &mapPtr, 0);
-        
-        if (FAILED(result))
-        {
-            ERR("Lock failed with error 0x%08x", result);
-            return NULL;
-        }
-
-        int attributeOffset = attribute.mOffset % attribute.stride();
-        VertexElement element = {attribute.mType, attribute.mSize, attribute.stride(), attribute.mNormalized, attributeOffset, mWritePosition};
-        mCache.push_back(element);
-
-        *streamOffset = mWritePosition;
-        mWritePosition += requiredSpace;
-    }
-
-    return mapPtr;
-}
-
-void StaticVertexBuffer::reserveRequiredSpace()
-{
-    if (!mVertexBuffer && mBufferSize == 0)
-    {
-        D3DPOOL pool = getDisplay()->getBufferPool(D3DUSAGE_WRITEONLY);
-        HRESULT result = mDevice->CreateVertexBuffer(mRequiredSpace, D3DUSAGE_WRITEONLY, 0, pool, &mVertexBuffer, NULL);
-        mSerial = issueSerial();
-
-        if (FAILED(result))
-        {
-            ERR("Out of memory allocating a vertex buffer of size %lu.", mRequiredSpace);
-        }
-
-        mBufferSize = mRequiredSpace;
-    }
-    else if (mVertexBuffer && mBufferSize >= mRequiredSpace)
-    {
-        // Already allocated
-    }
-    else UNREACHABLE();   // Static vertex buffers can't be resized
-
-    mRequiredSpace = 0;
-}
-
-std::size_t StaticVertexBuffer::lookupAttribute(const VertexAttribute &attribute)
-{
-    for (unsigned int element = 0; element < mCache.size(); element++)
-    {
-        if (mCache[element].type == attribute.mType &&
-            mCache[element].size == attribute.mSize &&
-            mCache[element].stride == attribute.stride() &&
-            mCache[element].normalized == attribute.mNormalized)
-        {
-            if (mCache[element].attributeOffset == attribute.mOffset % attribute.stride())
-            {
-                return mCache[element].streamOffset;
-            }
-        }
-    }
-
-    return -1;
-}
-
-const VertexDataManager::FormatConverter &VertexDataManager::formatConverter(const VertexAttribute &attribute) const
-{
-    return mAttributeTypes[typeIndex(attribute.mType)][attribute.mNormalized][attribute.mSize - 1];
-}
-}
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/VertexDataManager.h b/Source/ThirdParty/ANGLE/src/libGLESv2/VertexDataManager.h
deleted file mode 100644
index 857591a..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/VertexDataManager.h
+++ /dev/null
@@ -1,169 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// VertexDataManager.h: Defines the VertexDataManager, a class that
-// runs the Buffer translation process.
-
-#ifndef LIBGLESV2_VERTEXDATAMANAGER_H_
-#define LIBGLESV2_VERTEXDATAMANAGER_H_
-
-#include <vector>
-#include <cstddef>
-
-#define GL_APICALL
-#include <GLES2/gl2.h>
-
-#include "libGLESv2/Context.h"
-
-namespace gl
-{
-
-struct TranslatedAttribute
-{
-    bool active;
-
-    D3DDECLTYPE type;
-    UINT offset;
-    UINT stride;   // 0 means not to advance the read pointer at all
-
-    IDirect3DVertexBuffer9 *vertexBuffer;
-    unsigned int serial;
-    unsigned int divisor;
-};
-
-class VertexBuffer
-{
-  public:
-    VertexBuffer(IDirect3DDevice9 *device, std::size_t size, DWORD usageFlags);
-    virtual ~VertexBuffer();
-
-    void unmap();
-
-    IDirect3DVertexBuffer9 *getBuffer() const;
-    unsigned int getSerial() const;
-
-  protected:
-    IDirect3DDevice9 *const mDevice;
-    IDirect3DVertexBuffer9 *mVertexBuffer;
-
-    unsigned int mSerial;
-    static unsigned int issueSerial();
-    static unsigned int mCurrentSerial;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(VertexBuffer);
-};
-
-class ArrayVertexBuffer : public VertexBuffer
-{
-  public:
-    ArrayVertexBuffer(IDirect3DDevice9 *device, std::size_t size, DWORD usageFlags);
-    ~ArrayVertexBuffer();
-
-    std::size_t size() const { return mBufferSize; }
-    virtual void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset) = 0;
-    virtual void reserveRequiredSpace() = 0;
-    void addRequiredSpace(UINT requiredSpace);
-
-  protected:
-    std::size_t mBufferSize;
-    std::size_t mWritePosition;
-    std::size_t mRequiredSpace;
-};
-
-class StreamingVertexBuffer : public ArrayVertexBuffer
-{
-  public:
-    StreamingVertexBuffer(IDirect3DDevice9 *device, std::size_t initialSize);
-    ~StreamingVertexBuffer();
-
-    void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset);
-    void reserveRequiredSpace();
-};
-
-class StaticVertexBuffer : public ArrayVertexBuffer
-{
-  public:
-    explicit StaticVertexBuffer(IDirect3DDevice9 *device);
-    ~StaticVertexBuffer();
-
-    void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset);
-    void reserveRequiredSpace();
-
-    std::size_t lookupAttribute(const VertexAttribute &attribute);   // Returns the offset into the vertex buffer, or -1 if not found
-
-  private:
-    struct VertexElement
-    {
-        GLenum type;
-        GLint size;
-        GLsizei stride;
-        bool normalized;
-        int attributeOffset;
-
-        std::size_t streamOffset;
-    };
-
-    std::vector<VertexElement> mCache;
-};
-
-class VertexDataManager
-{
-  public:
-    VertexDataManager(Context *context, IDirect3DDevice9 *backend);
-    virtual ~VertexDataManager();
-
-    void dirtyCurrentValue(int index) { mDirtyCurrentValue[index] = true; }
-
-    GLenum prepareVertexData(GLint start, GLsizei count, TranslatedAttribute *outAttribs, GLsizei instances);
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(VertexDataManager);
-
-    std::size_t spaceRequired(const VertexAttribute &attrib, std::size_t count, GLsizei instances) const;
-    std::size_t writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute, GLsizei instances);
-
-    Context *const mContext;
-    IDirect3DDevice9 *const mDevice;
-
-    StreamingVertexBuffer *mStreamingBuffer;
-
-    bool mDirtyCurrentValue[MAX_VERTEX_ATTRIBS];
-    StreamingVertexBuffer *mCurrentValueBuffer[MAX_VERTEX_ATTRIBS];
-    std::size_t mCurrentValueOffsets[MAX_VERTEX_ATTRIBS];
-
-    // Attribute format conversion
-    struct FormatConverter
-    {
-        bool identity;
-        std::size_t outputElementSize;
-        void (*convertArray)(const void *in, std::size_t stride, std::size_t n, void *out);
-        D3DDECLTYPE d3dDeclType;
-    };
-
-    enum { NUM_GL_VERTEX_ATTRIB_TYPES = 6 };
-
-    FormatConverter mAttributeTypes[NUM_GL_VERTEX_ATTRIB_TYPES][2][4];   // [GL types as enumerated by typeIndex()][normalized][size - 1]
-
-    struct TranslationDescription
-    {
-        DWORD capsFlag;
-        FormatConverter preferredConversion;
-        FormatConverter fallbackConversion;
-    };
-
-    // This table is used to generate mAttributeTypes.
-    static const TranslationDescription mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4]; // [GL types as enumerated by typeIndex()][normalized][size - 1]
-
-    void checkVertexCaps(DWORD declTypes);
-
-    unsigned int typeIndex(GLenum type) const;
-    const FormatConverter &formatConverter(const VertexAttribute &attribute) const;
-};
-
-}
-
-#endif   // LIBGLESV2_VERTEXDATAMANAGER_H_
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp b/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp
deleted file mode 100644
index fba253d..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp
+++ /dev/null
@@ -1,6975 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// libGLESv2.cpp: Implements the exported OpenGL ES 2.0 functions.
-
-#define GL_APICALL
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <exception>
-#include <limits>
-
-#include "common/debug.h"
-#include "common/version.h"
-
-#include "libGLESv2/main.h"
-#include "libGLESv2/mathutil.h"
-#include "libGLESv2/utilities.h"
-#include "libGLESv2/Buffer.h"
-#include "libGLESv2/Context.h"
-#include "libGLESv2/Fence.h"
-#include "libGLESv2/Framebuffer.h"
-#include "libGLESv2/Program.h"
-#include "libGLESv2/ProgramBinary.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;
-    }
-
-    if (gl::getContext() && gl::getContext()->supportsNonPower2Texture())
-    {
-        return true;
-    }
-
-    if (level == 0)
-    {
-        return true;
-    }
-
-    if (gl::isPow2(width) && gl::isPow2(height))
-    {
-        return true;
-    }
-
-    return false;
-}
-
-// Verify that format/type are one of the combinations from table 3.4.
-bool checkTextureFormatType(GLenum format, GLenum type)
-{
-    // validate <format> by itself (used as secondary key below)
-    switch (format)
-    {
-      case GL_RGBA:
-      case GL_BGRA_EXT:
-      case GL_RGB:
-      case GL_ALPHA:
-      case GL_LUMINANCE:
-      case GL_LUMINANCE_ALPHA:
-      case GL_DEPTH_COMPONENT:
-      case GL_DEPTH_STENCIL_OES:
-        break;
-      default:
-        return error(GL_INVALID_ENUM, false);
-    }
-
-    // invalid <type> -> sets INVALID_ENUM
-    // invalid <format>+<type> combination -> sets INVALID_OPERATION
-    switch (type)
-    {
-      case GL_UNSIGNED_BYTE:
-        switch (format)
-        {
-          case GL_RGBA:
-          case GL_BGRA_EXT:
-          case GL_RGB:
-          case GL_ALPHA:
-          case GL_LUMINANCE:
-          case GL_LUMINANCE_ALPHA:
-            return true;
-          default:
-            return error(GL_INVALID_OPERATION, false);
-        }
-
-      case GL_FLOAT:
-      case GL_HALF_FLOAT_OES:
-        switch (format)
-        {
-          case GL_RGBA:
-          case GL_RGB:
-          case GL_ALPHA:
-          case GL_LUMINANCE:
-          case GL_LUMINANCE_ALPHA:
-            return true;
-          default:
-            return error(GL_INVALID_OPERATION, false);
-        }
-
-      case GL_UNSIGNED_SHORT_4_4_4_4:
-      case GL_UNSIGNED_SHORT_5_5_5_1:
-        switch (format)
-        {
-          case GL_RGBA:
-            return true;
-          default:
-            return error(GL_INVALID_OPERATION, false);
-        }
-
-      case GL_UNSIGNED_SHORT_5_6_5:
-        switch (format)
-        {
-          case GL_RGB:
-            return true;
-          default:
-            return error(GL_INVALID_OPERATION, false);
-        }
-
-      case GL_UNSIGNED_SHORT:
-      case GL_UNSIGNED_INT:
-        switch (format)
-        {
-          case GL_DEPTH_COMPONENT:
-            return true;
-          default:
-            return error(GL_INVALID_OPERATION, false);
-        }
-
-      case GL_UNSIGNED_INT_24_8_OES:
-        switch (format)
-        {
-          case GL_DEPTH_STENCIL_OES:
-            return true;
-          default:
-            return error(GL_INVALID_OPERATION, false);
-        }
-
-      default:
-        return error(GL_INVALID_ENUM, false);
-    }
-}
-bool validateSubImageParams2D(bool compressed, GLsizei width, GLsizei height,
-                              GLint xoffset, GLint yoffset, GLint level, GLenum format,
-                              gl::Texture2D *texture)
-{
-    if (!texture)
-    {
-        return error(GL_INVALID_OPERATION, false);
-    }
-
-    if (compressed != texture->isCompressed(level))
-    {
-        return error(GL_INVALID_OPERATION, false);
-    }
-
-    if (format != GL_NONE && format != texture->getInternalFormat(level))
-    {
-        return error(GL_INVALID_OPERATION, false);
-    }
-
-    if (compressed)
-    {
-        if ((width % 4 != 0 && width != texture->getWidth(0)) ||
-            (height % 4 != 0 && height != texture->getHeight(0)))
-        {
-            return error(GL_INVALID_OPERATION, false);
-        }
-    }
-
-    if (xoffset + width > texture->getWidth(level) ||
-        yoffset + height > texture->getHeight(level))
-    {
-        return error(GL_INVALID_VALUE, false);
-    }
-
-    return true;
-}
-
-bool validateSubImageParamsCube(bool compressed, GLsizei width, GLsizei height,
-                                GLint xoffset, GLint yoffset, GLenum target, GLint level, GLenum format,
-                                gl::TextureCubeMap *texture)
-{
-    if (!texture)
-    {
-        return error(GL_INVALID_OPERATION, false);
-    }
-
-    if (compressed != texture->isCompressed(target, level))
-    {
-        return error(GL_INVALID_OPERATION, false);
-    }
-
-    if (format != GL_NONE && format != texture->getInternalFormat(target, level))
-    {
-        return error(GL_INVALID_OPERATION, false);
-    }
-
-    if (compressed)
-    {
-        if ((width % 4 != 0 && width != texture->getWidth(target, 0)) ||
-            (height % 4 != 0 && height != texture->getHeight(target, 0)))
-        {
-            return error(GL_INVALID_OPERATION, false);
-        }
-    }
-
-    if (xoffset + width > texture->getWidth(target, level) ||
-        yoffset + height > texture->getHeight(target, level))
-    {
-        return error(GL_INVALID_VALUE, false);
-    }
-
-    return true;
-}
-
-// check for combinations of format and type that are valid for ReadPixels
-bool validReadFormatType(GLenum format, GLenum type)
-{
-    switch (format)
-    {
-      case GL_RGBA:
-        switch (type)
-        {
-          case GL_UNSIGNED_BYTE:
-            break;
-          default:
-            return false;
-        }
-        break;
-      case GL_BGRA_EXT:
-        switch (type)
-        {
-          case GL_UNSIGNED_BYTE:
-          case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
-          case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
-            break;
-          default:
-            return false;
-        }
-        break;
-      case gl::IMPLEMENTATION_COLOR_READ_FORMAT:
-        switch (type)
-        {
-          case gl::IMPLEMENTATION_COLOR_READ_TYPE:
-            break;
-          default:
-            return false;
-        }
-        break;
-      default:
-        return false;
-    }
-    return true;
-}
-
-extern "C"
-{
-
-void __stdcall glActiveTexture(GLenum texture)
-{
-    EVENT("(GLenum texture = 0x%X)", texture);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + context->getMaximumCombinedTextureImageUnits() - 1)
-            {
-                return error(GL_INVALID_ENUM);
-            }
-
-            context->setActiveSampler(texture - GL_TEXTURE0);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glAttachShader(GLuint program, GLuint shader)
-{
-    EVENT("(GLuint program = %d, GLuint shader = %d)", program, shader);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context->getProgram(program);
-            gl::Shader *shaderObject = context->getShader(shader);
-
-            if (!programObject)
-            {
-                if (context->getShader(program))
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-            }
-
-            if (!shaderObject)
-            {
-                if (context->getProgram(shader))
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-            }
-
-            if (!programObject->attachShader(shaderObject))
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    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)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context->getProgram(program);
-
-            if (!programObject)
-            {
-                if (context->getShader(program))
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-            }
-
-            if (strncmp(name, "gl_", 3) == 0)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            programObject->bindAttributeLocation(index, name);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glBindBuffer(GLenum target, GLuint buffer)
-{
-    EVENT("(GLenum target = 0x%X, GLuint buffer = %d)", target, buffer);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            switch (target)
-            {
-              case GL_ARRAY_BUFFER:
-                context->bindArrayBuffer(buffer);
-                return;
-              case GL_ELEMENT_ARRAY_BUFFER:
-                context->bindElementArrayBuffer(buffer);
-                return;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
-    EVENT("(GLenum target = 0x%X, GLuint framebuffer = %d)", target, framebuffer);
-
-    try
-    {
-        if (target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
-        {
-            return error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (target == GL_READ_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER)
-            {
-                context->bindReadFramebuffer(framebuffer);
-            }
-            
-            if (target == GL_DRAW_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER)
-            {
-                context->bindDrawFramebuffer(framebuffer);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
-    EVENT("(GLenum target = 0x%X, GLuint renderbuffer = %d)", target, renderbuffer);
-
-    try
-    {
-        if (target != GL_RENDERBUFFER)
-        {
-            return error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->bindRenderbuffer(renderbuffer);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glBindTexture(GLenum target, GLuint texture)
-{
-    EVENT("(GLenum target = 0x%X, GLuint texture = %d)", target, texture);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Texture *textureObject = context->getTexture(texture);
-
-            if (textureObject && textureObject->getTarget() != target && texture != 0)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            switch (target)
-            {
-              case GL_TEXTURE_2D:
-                context->bindTexture2D(texture);
-                return;
-              case GL_TEXTURE_CUBE_MAP:
-                context->bindTextureCubeMap(texture);
-                return;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
-    EVENT("(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)",
-          red, green, blue, alpha);
-
-    try
-    {
-        gl::Context* context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setBlendColor(gl::clamp01(red), gl::clamp01(green), gl::clamp01(blue), gl::clamp01(alpha));
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glBlendEquation(GLenum mode)
-{
-    glBlendEquationSeparate(mode, mode);
-}
-
-void __stdcall glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
-    EVENT("(GLenum modeRGB = 0x%X, GLenum modeAlpha = 0x%X)", modeRGB, modeAlpha);
-
-    try
-    {
-        switch (modeRGB)
-        {
-          case GL_FUNC_ADD:
-          case GL_FUNC_SUBTRACT:
-          case GL_FUNC_REVERSE_SUBTRACT:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        switch (modeAlpha)
-        {
-          case GL_FUNC_ADD:
-          case GL_FUNC_SUBTRACT:
-          case GL_FUNC_REVERSE_SUBTRACT:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setBlendEquation(modeRGB, modeAlpha);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
-    glBlendFuncSeparate(sfactor, dfactor, sfactor, dfactor);
-}
-
-void __stdcall glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
-    EVENT("(GLenum srcRGB = 0x%X, GLenum dstRGB = 0x%X, GLenum srcAlpha = 0x%X, GLenum dstAlpha = 0x%X)",
-          srcRGB, dstRGB, srcAlpha, dstAlpha);
-
-    try
-    {
-        switch (srcRGB)
-        {
-          case GL_ZERO:
-          case GL_ONE:
-          case GL_SRC_COLOR:
-          case GL_ONE_MINUS_SRC_COLOR:
-          case GL_DST_COLOR:
-          case GL_ONE_MINUS_DST_COLOR:
-          case GL_SRC_ALPHA:
-          case GL_ONE_MINUS_SRC_ALPHA:
-          case GL_DST_ALPHA:
-          case GL_ONE_MINUS_DST_ALPHA:
-          case GL_CONSTANT_COLOR:
-          case GL_ONE_MINUS_CONSTANT_COLOR:
-          case GL_CONSTANT_ALPHA:
-          case GL_ONE_MINUS_CONSTANT_ALPHA:
-          case GL_SRC_ALPHA_SATURATE:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        switch (dstRGB)
-        {
-          case GL_ZERO:
-          case GL_ONE:
-          case GL_SRC_COLOR:
-          case GL_ONE_MINUS_SRC_COLOR:
-          case GL_DST_COLOR:
-          case GL_ONE_MINUS_DST_COLOR:
-          case GL_SRC_ALPHA:
-          case GL_ONE_MINUS_SRC_ALPHA:
-          case GL_DST_ALPHA:
-          case GL_ONE_MINUS_DST_ALPHA:
-          case GL_CONSTANT_COLOR:
-          case GL_ONE_MINUS_CONSTANT_COLOR:
-          case GL_CONSTANT_ALPHA:
-          case GL_ONE_MINUS_CONSTANT_ALPHA:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        switch (srcAlpha)
-        {
-          case GL_ZERO:
-          case GL_ONE:
-          case GL_SRC_COLOR:
-          case GL_ONE_MINUS_SRC_COLOR:
-          case GL_DST_COLOR:
-          case GL_ONE_MINUS_DST_COLOR:
-          case GL_SRC_ALPHA:
-          case GL_ONE_MINUS_SRC_ALPHA:
-          case GL_DST_ALPHA:
-          case GL_ONE_MINUS_DST_ALPHA:
-          case GL_CONSTANT_COLOR:
-          case GL_ONE_MINUS_CONSTANT_COLOR:
-          case GL_CONSTANT_ALPHA:
-          case GL_ONE_MINUS_CONSTANT_ALPHA:
-          case GL_SRC_ALPHA_SATURATE:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        switch (dstAlpha)
-        {
-          case GL_ZERO:
-          case GL_ONE:
-          case GL_SRC_COLOR:
-          case GL_ONE_MINUS_SRC_COLOR:
-          case GL_DST_COLOR:
-          case GL_ONE_MINUS_DST_COLOR:
-          case GL_SRC_ALPHA:
-          case GL_ONE_MINUS_SRC_ALPHA:
-          case GL_DST_ALPHA:
-          case GL_ONE_MINUS_DST_ALPHA:
-          case GL_CONSTANT_COLOR:
-          case GL_ONE_MINUS_CONSTANT_COLOR:
-          case GL_CONSTANT_ALPHA:
-          case GL_ONE_MINUS_CONSTANT_ALPHA:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        bool constantColorUsed = (srcRGB == GL_CONSTANT_COLOR || srcRGB == GL_ONE_MINUS_CONSTANT_COLOR ||
-                                  dstRGB == GL_CONSTANT_COLOR || dstRGB == GL_ONE_MINUS_CONSTANT_COLOR);
-
-        bool constantAlphaUsed = (srcRGB == GL_CONSTANT_ALPHA || srcRGB == GL_ONE_MINUS_CONSTANT_ALPHA ||
-                                  dstRGB == GL_CONSTANT_ALPHA || dstRGB == GL_ONE_MINUS_CONSTANT_ALPHA);
-
-        if (constantColorUsed && constantAlphaUsed)
-        {
-            ERR("Simultaneous use of GL_CONSTANT_ALPHA/GL_ONE_MINUS_CONSTANT_ALPHA and GL_CONSTANT_COLOR/GL_ONE_MINUS_CONSTANT_COLOR invalid under WebGL");
-            return error(GL_INVALID_OPERATION);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setBlendFactors(srcRGB, dstRGB, srcAlpha, dstAlpha);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
-{
-    EVENT("(GLenum target = 0x%X, GLsizeiptr size = %d, const GLvoid* data = 0x%0.8p, GLenum usage = %d)",
-          target, size, data, usage);
-
-    try
-    {
-        if (size < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        switch (usage)
-        {
-          case GL_STREAM_DRAW:
-          case GL_STATIC_DRAW:
-          case GL_DYNAMIC_DRAW:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Buffer *buffer;
-
-            switch (target)
-            {
-              case GL_ARRAY_BUFFER:
-                buffer = context->getArrayBuffer();
-                break;
-              case GL_ELEMENT_ARRAY_BUFFER:
-                buffer = context->getElementArrayBuffer();
-                break;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-
-            if (!buffer)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            buffer->bufferData(data, size, usage);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
-{
-    EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr size = %d, const GLvoid* data = 0x%0.8p)",
-          target, offset, size, data);
-
-    try
-    {
-        if (size < 0 || offset < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (data == NULL)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Buffer *buffer;
-
-            switch (target)
-            {
-              case GL_ARRAY_BUFFER:
-                buffer = context->getArrayBuffer();
-                break;
-              case GL_ELEMENT_ARRAY_BUFFER:
-                buffer = context->getElementArrayBuffer();
-                break;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-
-            if (!buffer)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            if ((size_t)size + offset > buffer->size())
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            buffer->bufferSubData(data, size, offset);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-GLenum __stdcall glCheckFramebufferStatus(GLenum target)
-{
-    EVENT("(GLenum target = 0x%X)", target);
-
-    try
-    {
-        if (target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
-        {
-            return error(GL_INVALID_ENUM, 0);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Framebuffer *framebuffer = NULL;
-            if (target == GL_READ_FRAMEBUFFER_ANGLE)
-            {
-                framebuffer = context->getReadFramebuffer();
-            }
-            else
-            {
-                framebuffer = context->getDrawFramebuffer();
-            }
-
-            return framebuffer->completeness();
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY, 0);
-    }
-
-    return 0;
-}
-
-void __stdcall glClear(GLbitfield mask)
-{
-    EVENT("(GLbitfield mask = %X)", mask);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->clear(mask);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
-    EVENT("(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)",
-          red, green, blue, alpha);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setClearColor(red, green, blue, alpha);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glClearDepthf(GLclampf depth)
-{
-    EVENT("(GLclampf depth = %f)", depth);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setClearDepth(depth);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glClearStencil(GLint s)
-{
-    EVENT("(GLint s = %d)", s);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setClearStencil(s);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
-    EVENT("(GLboolean red = %d, GLboolean green = %d, GLboolean blue = %d, GLboolean alpha = %d)",
-          red, green, blue, alpha);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setColorMask(red == GL_TRUE, green == GL_TRUE, blue == GL_TRUE, alpha == GL_TRUE);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glCompileShader(GLuint shader)
-{
-    EVENT("(GLuint shader = %d)", shader);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Shader *shaderObject = context->getShader(shader);
-
-            if (!shaderObject)
-            {
-                if (context->getProgram(shader))
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-            }
-
-            shaderObject->compile();
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, 
-                                      GLint border, GLsizei imageSize, const GLvoid* data)
-{
-    EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, " 
-          "GLsizei height = %d, GLint border = %d, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)",
-          target, level, internalformat, width, height, border, imageSize, data);
-
-    try
-    {
-        if (!validImageSize(level, width, height) || border != 0 || imageSize < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        switch (internalformat)
-        {
-          case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-          case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-          case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
-          case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        if (border != 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (level > context->getMaximumTextureLevel())
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            switch (target)
-            {
-              case GL_TEXTURE_2D:
-                if (width > (context->getMaximumTextureDimension() >> level) ||
-                    height > (context->getMaximumTextureDimension() >> level))
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-                break;
-              case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
-              case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
-              case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
-              case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
-              case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
-              case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
-                if (width != height)
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-
-                if (width > (context->getMaximumCubeTextureDimension() >> level) ||
-                    height > (context->getMaximumCubeTextureDimension() >> level))
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-                break;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-
-            switch (internalformat) {
-              case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-              case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-                if (!context->supportsDXT1Textures())
-                {
-                    return error(GL_INVALID_ENUM); // in this case, it's as though the internal format switch failed
-                }
-                break;
-              case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
-                if (!context->supportsDXT3Textures())
-                {
-                    return error(GL_INVALID_ENUM); // in this case, it's as though the internal format switch failed
-                }
-                break;
-              case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
-                if (!context->supportsDXT5Textures())
-                {
-                    return error(GL_INVALID_ENUM); // in this case, it's as though the internal format switch failed
-                }
-                break;
-              default: UNREACHABLE();
-            }
-
-            if (imageSize != gl::ComputeCompressedSize(width, height, internalformat))
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            if (target == GL_TEXTURE_2D)
-            {
-                gl::Texture2D *texture = context->getTexture2D();
-
-                if (!texture)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                if (texture->isImmutable())
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                texture->setCompressedImage(level, internalformat, width, height, imageSize, data);
-            }
-            else
-            {
-                gl::TextureCubeMap *texture = context->getTextureCubeMap();
-
-                if (!texture)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                if (texture->isImmutable())
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                switch (target)
-                {
-                  case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
-                  case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
-                  case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
-                  case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
-                  case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
-                  case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
-                    texture->setCompressedImage(target, level, internalformat, width, height, imageSize, data);
-                    break;
-                  default: UNREACHABLE();
-                }
-            }
-        }
-
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
-                                         GLenum format, GLsizei imageSize, const GLvoid* data)
-{
-    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::IsInternalTextureTarget(target))
-        {
-            return error(GL_INVALID_ENUM);
-        }
-
-        if (xoffset < 0 || yoffset < 0 || !validImageSize(level, width, height) || imageSize < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        switch (format)
-        {
-          case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-          case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-          case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
-          case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        if (width == 0 || height == 0 || data == NULL)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (level > context->getMaximumTextureLevel())
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            switch (format) {
-              case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-              case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-                if (!context->supportsDXT1Textures())
-                {
-                    return error(GL_INVALID_ENUM); // in this case, it's as though the internal format switch failed
-                }
-                break;
-              case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
-                if (!context->supportsDXT3Textures())
-                {
-                    return error(GL_INVALID_ENUM); // in this case, it's as though the internal format switch failed
-                }
-                break;
-              case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
-                if (!context->supportsDXT5Textures())
-                {
-                    return error(GL_INVALID_ENUM); // in this case, it's as though the internal format switch failed
-                }
-                break;
-              default: UNREACHABLE();
-            }
-
-            if (imageSize != gl::ComputeCompressedSize(width, height, format))
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            if (xoffset % 4 != 0 || yoffset % 4 != 0)
-            {
-                return error(GL_INVALID_OPERATION); // we wait to check the offsets until this point, because the multiple-of-four restriction
-                                                    // does not exist unless DXT textures are supported.
-            }
-
-            if (target == GL_TEXTURE_2D)
-            {
-                gl::Texture2D *texture = context->getTexture2D();
-                if (validateSubImageParams2D(true, width, height, xoffset, yoffset, level, format, texture))
-                {
-                    texture->subImageCompressed(level, xoffset, yoffset, width, height, format, imageSize, data);
-                }
-            }
-            else if (gl::IsCubemapTextureTarget(target))
-            {
-                gl::TextureCubeMap *texture = context->getTextureCubeMap();
-                if (validateSubImageParamsCube(true, width, height, xoffset, yoffset, target, level, format, texture))
-                {
-                    texture->subImageCompressed(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-                }
-            }
-            else
-            {
-                UNREACHABLE();
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
-    EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, "
-          "GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLint border = %d)",
-          target, level, internalformat, x, y, width, height, border);
-
-    try
-    {
-        if (!validImageSize(level, width, height))
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (border != 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (level > context->getMaximumTextureLevel())
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            switch (target)
-            {
-              case GL_TEXTURE_2D:
-                if (width > (context->getMaximumTextureDimension() >> level) ||
-                    height > (context->getMaximumTextureDimension() >> level))
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-                break;
-              case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
-              case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
-              case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
-              case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
-              case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
-              case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
-                if (width != height)
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-
-                if (width > (context->getMaximumCubeTextureDimension() >> level) ||
-                    height > (context->getMaximumCubeTextureDimension() >> level))
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-                break;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-
-            gl::Framebuffer *framebuffer = context->getReadFramebuffer();
-
-            if (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
-            {
-                return error(GL_INVALID_FRAMEBUFFER_OPERATION);
-            }
-
-            if (context->getReadFramebufferHandle() != 0 && framebuffer->getColorbuffer()->getSamples() != 0)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            gl::Renderbuffer *source = framebuffer->getColorbuffer();
-            GLenum colorbufferFormat = source->getInternalFormat();
-
-            // [OpenGL ES 2.0.24] table 3.9
-            switch (internalformat)
-            {
-              case GL_ALPHA:
-                if (colorbufferFormat != GL_ALPHA &&
-                    colorbufferFormat != GL_RGBA &&
-                    colorbufferFormat != GL_RGBA4 &&
-                    colorbufferFormat != GL_RGB5_A1 &&
-                    colorbufferFormat != GL_RGBA8_OES)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                break;
-              case GL_LUMINANCE:
-              case GL_RGB:
-                if (colorbufferFormat != GL_RGB &&
-                    colorbufferFormat != GL_RGB565 &&
-                    colorbufferFormat != GL_RGB8_OES &&
-                    colorbufferFormat != GL_RGBA &&
-                    colorbufferFormat != GL_RGBA4 &&
-                    colorbufferFormat != GL_RGB5_A1 &&
-                    colorbufferFormat != GL_RGBA8_OES)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                break;
-              case GL_LUMINANCE_ALPHA:
-              case GL_RGBA:
-                if (colorbufferFormat != GL_RGBA &&
-                    colorbufferFormat != GL_RGBA4 &&
-                    colorbufferFormat != GL_RGB5_A1 &&
-                    colorbufferFormat != GL_RGBA8_OES)
-                 {
-                     return error(GL_INVALID_OPERATION);
-                 }
-                 break;
-              case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-              case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-                if (context->supportsDXT1Textures())
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
-                if (context->supportsDXT3Textures())
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
-                if (context->supportsDXT5Textures())
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              case GL_DEPTH_COMPONENT:
-              case GL_DEPTH_COMPONENT16:
-              case GL_DEPTH_COMPONENT32_OES:
-              case GL_DEPTH_STENCIL_OES:
-              case GL_DEPTH24_STENCIL8_OES:
-                  if (context->supportsDepthTextures())
-                  {
-                      return error(GL_INVALID_OPERATION);
-                  }
-                  else
-                  {
-                      return error(GL_INVALID_ENUM);
-                  }
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-
-            if (target == GL_TEXTURE_2D)
-            {
-                gl::Texture2D *texture = context->getTexture2D();
-
-                if (!texture)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                if (texture->isImmutable())
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                texture->copyImage(level, internalformat, x, y, width, height, framebuffer);
-            }
-            else if (gl::IsCubemapTextureTarget(target))
-            {
-                gl::TextureCubeMap *texture = context->getTextureCubeMap();
-
-                if (!texture)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                if (texture->isImmutable())
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                texture->copyImage(target, level, internalformat, x, y, width, height, framebuffer);
-            }
-            else UNREACHABLE();
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-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::IsInternalTextureTarget(target))
-        {
-            return error(GL_INVALID_ENUM);
-        }
-
-        if (level < 0 || xoffset < 0 || yoffset < 0 || width < 0 || height < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (std::numeric_limits<GLsizei>::max() - xoffset < width || std::numeric_limits<GLsizei>::max() - yoffset < height)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (width == 0 || height == 0)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (level > context->getMaximumTextureLevel())
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            gl::Framebuffer *framebuffer = context->getReadFramebuffer();
-
-            if (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
-            {
-                return error(GL_INVALID_FRAMEBUFFER_OPERATION);
-            }
-
-            if (context->getReadFramebufferHandle() != 0 && framebuffer->getColorbuffer()->getSamples() != 0)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            gl::Renderbuffer *source = framebuffer->getColorbuffer();
-            GLenum colorbufferFormat = source->getInternalFormat();
-            gl::Texture *texture = NULL;
-            GLenum textureFormat = GL_RGBA;
-
-            if (target == GL_TEXTURE_2D)
-            {
-                gl::Texture2D *tex2d = context->getTexture2D();
-
-                if (!validateSubImageParams2D(false, width, height, xoffset, yoffset, level, GL_NONE, tex2d))
-                {
-                    return; // error already registered by validateSubImageParams
-                }
-                textureFormat = tex2d->getInternalFormat(level);
-                texture = tex2d;
-            }
-            else if (gl::IsCubemapTextureTarget(target))
-            {
-                gl::TextureCubeMap *texcube = context->getTextureCubeMap();
-
-                if (!validateSubImageParamsCube(false, width, height, xoffset, yoffset, target, level, GL_NONE, texcube))
-                {
-                    return; // error already registered by validateSubImageParams
-                }
-                textureFormat = texcube->getInternalFormat(target, level);
-                texture = texcube;
-            }
-            else UNREACHABLE();
-
-            // [OpenGL ES 2.0.24] table 3.9
-            switch (textureFormat)
-            {
-              case GL_ALPHA:
-                if (colorbufferFormat != GL_ALPHA &&
-                    colorbufferFormat != GL_RGBA &&
-                    colorbufferFormat != GL_RGBA4 &&
-                    colorbufferFormat != GL_RGB5_A1 &&
-                    colorbufferFormat != GL_RGBA8_OES)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                break;
-              case GL_LUMINANCE:
-              case GL_RGB:
-                if (colorbufferFormat != GL_RGB &&
-                    colorbufferFormat != GL_RGB565 &&
-                    colorbufferFormat != GL_RGB8_OES &&
-                    colorbufferFormat != GL_RGBA &&
-                    colorbufferFormat != GL_RGBA4 &&
-                    colorbufferFormat != GL_RGB5_A1 &&
-                    colorbufferFormat != GL_RGBA8_OES)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                break;
-              case GL_LUMINANCE_ALPHA:
-              case GL_RGBA:
-                if (colorbufferFormat != GL_RGBA &&
-                    colorbufferFormat != GL_RGBA4 &&
-                    colorbufferFormat != GL_RGB5_A1 &&
-                    colorbufferFormat != GL_RGBA8_OES)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                break;
-              case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-              case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-              case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
-              case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
-                return error(GL_INVALID_OPERATION);
-              case GL_DEPTH_COMPONENT:
-              case GL_DEPTH_STENCIL_OES:
-                return error(GL_INVALID_OPERATION);
-              default:
-                return error(GL_INVALID_OPERATION);
-            }
-
-            texture->copySubImage(target, level, xoffset, yoffset, x, y, width, height, framebuffer);
-        }
-    }
-
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-GLuint __stdcall glCreateProgram(void)
-{
-    EVENT("()");
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            return context->createProgram();
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY, 0);
-    }
-
-    return 0;
-}
-
-GLuint __stdcall glCreateShader(GLenum type)
-{
-    EVENT("(GLenum type = 0x%X)", type);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            switch (type)
-            {
-              case GL_FRAGMENT_SHADER:
-              case GL_VERTEX_SHADER:
-                return context->createShader(type);
-              default:
-                return error(GL_INVALID_ENUM, 0);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY, 0);
-    }
-
-    return 0;
-}
-
-void __stdcall glCullFace(GLenum mode)
-{
-    EVENT("(GLenum mode = 0x%X)", mode);
-
-    try
-    {
-        switch (mode)
-        {
-          case GL_FRONT:
-          case GL_BACK:
-          case GL_FRONT_AND_BACK:
-            {
-                gl::Context *context = gl::getNonLostContext();
-
-                if (context)
-                {
-                    context->setCullMode(mode);
-                }
-            }
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glDeleteBuffers(GLsizei n, const GLuint* buffers)
-{
-    EVENT("(GLsizei n = %d, const GLuint* buffers = 0x%0.8p)", n, buffers);
-
-    try
-    {
-        if (n < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i < n; i++)
-            {
-                context->deleteBuffer(buffers[i]);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glDeleteFencesNV(GLsizei n, const GLuint* fences)
-{
-    EVENT("(GLsizei n = %d, const GLuint* fences = 0x%0.8p)", n, fences);
-
-    try
-    {
-        if (n < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i < n; i++)
-            {
-                context->deleteFence(fences[i]);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
-{
-    EVENT("(GLsizei n = %d, const GLuint* framebuffers = 0x%0.8p)", n, framebuffers);
-
-    try
-    {
-        if (n < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i < n; i++)
-            {
-                if (framebuffers[i] != 0)
-                {
-                    context->deleteFramebuffer(framebuffers[i]);
-                }
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glDeleteProgram(GLuint program)
-{
-    EVENT("(GLuint program = %d)", program);
-
-    try
-    {
-        if (program == 0)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!context->getProgram(program))
-            {
-                if(context->getShader(program))
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-            }
-
-            context->deleteProgram(program);
-        }
-    }
-    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)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i < n; i++)
-            {
-                context->deleteRenderbuffer(renderbuffers[i]);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glDeleteShader(GLuint shader)
-{
-    EVENT("(GLuint shader = %d)", shader);
-
-    try
-    {
-        if (shader == 0)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!context->getShader(shader))
-            {
-                if(context->getProgram(shader))
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-            }
-
-            context->deleteShader(shader);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glDeleteTextures(GLsizei n, const GLuint* textures)
-{
-    EVENT("(GLsizei n = %d, const GLuint* textures = 0x%0.8p)", n, textures);
-
-    try
-    {
-        if (n < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i < n; i++)
-            {
-                if (textures[i] != 0)
-                {
-                    context->deleteTexture(textures[i]);
-                }
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glDepthFunc(GLenum func)
-{
-    EVENT("(GLenum func = 0x%X)", func);
-
-    try
-    {
-        switch (func)
-        {
-          case GL_NEVER:
-          case GL_ALWAYS:
-          case GL_LESS:
-          case GL_LEQUAL:
-          case GL_EQUAL:
-          case GL_GREATER:
-          case GL_GEQUAL:
-          case GL_NOTEQUAL:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setDepthFunc(func);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glDepthMask(GLboolean flag)
-{
-    EVENT("(GLboolean flag = %d)", flag);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setDepthMask(flag != GL_FALSE);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glDepthRangef(GLclampf zNear, GLclampf zFar)
-{
-    EVENT("(GLclampf zNear = %f, GLclampf zFar = %f)", zNear, zFar);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setDepthRange(zNear, zFar);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glDetachShader(GLuint program, GLuint shader)
-{
-    EVENT("(GLuint program = %d, GLuint shader = %d)", program, shader);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-
-            gl::Program *programObject = context->getProgram(program);
-            gl::Shader *shaderObject = context->getShader(shader);
-            
-            if (!programObject)
-            {
-                gl::Shader *shaderByProgramHandle;
-                shaderByProgramHandle = context->getShader(program);
-                if (!shaderByProgramHandle)
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-                else
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-            }
-
-            if (!shaderObject)
-            {
-                gl::Program *programByShaderHandle = context->getProgram(shader);
-                if (!programByShaderHandle)
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-                else
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-            }
-
-            if (!programObject->detachShader(shaderObject))
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glDisable(GLenum cap)
-{
-    EVENT("(GLenum cap = 0x%X)", cap);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            switch (cap)
-            {
-              case GL_CULL_FACE:                context->setCullFace(false);              break;
-              case GL_POLYGON_OFFSET_FILL:      context->setPolygonOffsetFill(false);     break;
-              case GL_SAMPLE_ALPHA_TO_COVERAGE: context->setSampleAlphaToCoverage(false); break;
-              case GL_SAMPLE_COVERAGE:          context->setSampleCoverage(false);        break;
-              case GL_SCISSOR_TEST:             context->setScissorTest(false);           break;
-              case GL_STENCIL_TEST:             context->setStencilTest(false);           break;
-              case GL_DEPTH_TEST:               context->setDepthTest(false);             break;
-              case GL_BLEND:                    context->setBlend(false);                 break;
-              case GL_DITHER:                   context->setDither(false);                break;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glDisableVertexAttribArray(GLuint index)
-{
-    EVENT("(GLuint index = %d)", index);
-
-    try
-    {
-        if (index >= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setEnableVertexAttribArray(index, false);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
-    EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d)", mode, first, count);
-
-    try
-    {
-        if (count < 0 || first < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->drawArrays(mode, first, count, 0);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount)
-{
-    EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei primcount = %d)", mode, first, count, primcount);
-
-    try
-    {
-        if (count < 0 || first < 0 || primcount < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (primcount > 0)
-        {
-            gl::Context *context = gl::getNonLostContext();
-
-            if (context)
-            {
-                context->drawArrays(mode, first, count, primcount);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
-{
-    EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p)",
-          mode, count, type, indices);
-
-    try
-    {
-        if (count < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            switch (type)
-            {
-              case GL_UNSIGNED_BYTE:
-              case GL_UNSIGNED_SHORT:
-                break;
-              case GL_UNSIGNED_INT:
-                if (!context->supports32bitIndices())
-                {
-                    return error(GL_INVALID_ENUM);    
-                }
-                break;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-        
-            context->drawElements(mode, count, type, indices, 0);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount)
-{
-    EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei primcount = %d)",
-          mode, count, type, indices, primcount);
-
-    try
-    {
-        if (count < 0 || primcount < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (primcount > 0)
-        {
-            gl::Context *context = gl::getNonLostContext();
-
-            if (context)
-            {
-                switch (type)
-                {
-                  case GL_UNSIGNED_BYTE:
-                  case GL_UNSIGNED_SHORT:
-                    break;
-                  case GL_UNSIGNED_INT:
-                    if (!context->supports32bitIndices())
-                    {
-                        return error(GL_INVALID_ENUM);    
-                    }
-                    break;
-                  default:
-                    return error(GL_INVALID_ENUM);
-                }
-            
-                context->drawElements(mode, count, type, indices, primcount);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glEnable(GLenum cap)
-{
-    EVENT("(GLenum cap = 0x%X)", cap);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            switch (cap)
-            {
-              case GL_CULL_FACE:                context->setCullFace(true);              break;
-              case GL_POLYGON_OFFSET_FILL:      context->setPolygonOffsetFill(true);     break;
-              case GL_SAMPLE_ALPHA_TO_COVERAGE: context->setSampleAlphaToCoverage(true); break;
-              case GL_SAMPLE_COVERAGE:          context->setSampleCoverage(true);        break;
-              case GL_SCISSOR_TEST:             context->setScissorTest(true);           break;
-              case GL_STENCIL_TEST:             context->setStencilTest(true);           break;
-              case GL_DEPTH_TEST:               context->setDepthTest(true);             break;
-              case GL_BLEND:                    context->setBlend(true);                 break;
-              case GL_DITHER:                   context->setDither(true);                break;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glEnableVertexAttribArray(GLuint index)
-{
-    EVENT("(GLuint index = %d)", index);
-
-    try
-    {
-        if (index >= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setEnableVertexAttribArray(index, true);
-        }
-    }
-    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();
-
-        if (context)
-        {
-            gl::Fence* fenceObject = context->getFence(fence);
-
-            if (fenceObject == NULL)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            fenceObject->finishFence();
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glFinish(void)
-{
-    EVENT("()");
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->sync(true);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glFlush(void)
-{
-    EVENT("()");
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->sync(false);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
-    EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum renderbuffertarget = 0x%X, "
-          "GLuint renderbuffer = %d)", target, attachment, renderbuffertarget, renderbuffer);
-
-    try
-    {
-        if ((target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
-            || (renderbuffertarget != GL_RENDERBUFFER && renderbuffer != 0))
-        {
-            return error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Framebuffer *framebuffer = NULL;
-            GLuint framebufferHandle = 0;
-            if (target == GL_READ_FRAMEBUFFER_ANGLE)
-            {
-                framebuffer = context->getReadFramebuffer();
-                framebufferHandle = context->getReadFramebufferHandle();
-            }
-            else
-            {
-                framebuffer = context->getDrawFramebuffer();
-                framebufferHandle = context->getDrawFramebufferHandle();
-            }
-
-            if (!framebuffer || (framebufferHandle == 0 && renderbuffer != 0))
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            switch (attachment)
-            {
-              case GL_COLOR_ATTACHMENT0:
-                framebuffer->setColorbuffer(GL_RENDERBUFFER, renderbuffer);
-                break;
-              case GL_DEPTH_ATTACHMENT:
-                framebuffer->setDepthbuffer(GL_RENDERBUFFER, renderbuffer);
-                break;
-              case GL_STENCIL_ATTACHMENT:
-                framebuffer->setStencilbuffer(GL_RENDERBUFFER, renderbuffer);
-                break;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
-    EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum textarget = 0x%X, "
-          "GLuint texture = %d, GLint level = %d)", target, attachment, textarget, texture, level);
-
-    try
-    {
-        if (target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
-        {
-            return error(GL_INVALID_ENUM);
-        }
-
-        switch (attachment)
-        {
-          case GL_COLOR_ATTACHMENT0:
-          case GL_DEPTH_ATTACHMENT:
-          case GL_STENCIL_ATTACHMENT:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (texture == 0)
-            {
-                textarget = GL_NONE;
-            }
-            else
-            {
-                gl::Texture *tex = context->getTexture(texture);
-
-                if (tex == NULL)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                switch (textarget)
-                {
-                  case GL_TEXTURE_2D:
-                    {
-                        if (tex->getTarget() != GL_TEXTURE_2D)
-                        {
-                            return error(GL_INVALID_OPERATION);
-                        }
-                        gl::Texture2D *tex2d = static_cast<gl::Texture2D *>(tex);
-                        if (tex2d->isCompressed(0))
-                        {
-                            return error(GL_INVALID_OPERATION);
-                        }
-                        break;
-                    }
-
-                  case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
-                  case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
-                  case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
-                  case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
-                  case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
-                  case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
-                    {
-                        if (tex->getTarget() != GL_TEXTURE_CUBE_MAP)
-                        {
-                            return error(GL_INVALID_OPERATION);
-                        }
-                        gl::TextureCubeMap *texcube = static_cast<gl::TextureCubeMap *>(tex);
-                        if (texcube->isCompressed(textarget, level))
-                        {
-                            return error(GL_INVALID_OPERATION);
-                        }
-                        break;
-                    }
-
-                  default:
-                    return error(GL_INVALID_ENUM);
-                }
-
-                if (level != 0)
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-            }
-
-            gl::Framebuffer *framebuffer = NULL;
-            GLuint framebufferHandle = 0;
-            if (target == GL_READ_FRAMEBUFFER_ANGLE)
-            {
-                framebuffer = context->getReadFramebuffer();
-                framebufferHandle = context->getReadFramebufferHandle();
-            }
-            else
-            {
-                framebuffer = context->getDrawFramebuffer();
-                framebufferHandle = context->getDrawFramebufferHandle();
-            }
-
-            if (framebufferHandle == 0 || !framebuffer)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            switch (attachment)
-            {
-              case GL_COLOR_ATTACHMENT0:  framebuffer->setColorbuffer(textarget, texture);   break;
-              case GL_DEPTH_ATTACHMENT:   framebuffer->setDepthbuffer(textarget, texture);   break;
-              case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture); break;
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glFrontFace(GLenum mode)
-{
-    EVENT("(GLenum mode = 0x%X)", mode);
-
-    try
-    {
-        switch (mode)
-        {
-          case GL_CW:
-          case GL_CCW:
-            {
-                gl::Context *context = gl::getNonLostContext();
-
-                if (context)
-                {
-                    context->setFrontFace(mode);
-                }
-            }
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGenBuffers(GLsizei n, GLuint* buffers)
-{
-    EVENT("(GLsizei n = %d, GLuint* buffers = 0x%0.8p)", n, buffers);
-
-    try
-    {
-        if (n < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i < n; i++)
-            {
-                buffers[i] = context->createBuffer();
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGenerateMipmap(GLenum target)
-{
-    EVENT("(GLenum target = 0x%X)", target);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            switch (target)
-            {
-              case GL_TEXTURE_2D:
-                {
-                    gl::Texture2D *tex2d = context->getTexture2D();
-
-                    if (tex2d->isCompressed(0))
-                    {
-                        return error(GL_INVALID_OPERATION);
-                    }
-                    if (tex2d->isDepth(0))
-                    {
-                        return error(GL_INVALID_OPERATION);
-                    }
-
-                    tex2d->generateMipmaps();
-                    break;
-                }
-
-              case GL_TEXTURE_CUBE_MAP:
-                {
-                    gl::TextureCubeMap *texcube = context->getTextureCubeMap();
-
-                    if (texcube->isCompressed(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0))
-                    {
-                        return error(GL_INVALID_OPERATION);
-                    }
-
-                    texcube->generateMipmaps();
-                    break;
-                }
-
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGenFencesNV(GLsizei n, GLuint* fences)
-{
-    EVENT("(GLsizei n = %d, GLuint* fences = 0x%0.8p)", n, fences);
-
-    try
-    {
-        if (n < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i < n; i++)
-            {
-                fences[i] = context->createFence();
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGenFramebuffers(GLsizei n, GLuint* framebuffers)
-{
-    EVENT("(GLsizei n = %d, GLuint* framebuffers = 0x%0.8p)", n, framebuffers);
-
-    try
-    {
-        if (n < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i < n; i++)
-            {
-                framebuffers[i] = context->createFramebuffer();
-            }
-        }
-    }
-    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)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i < n; i++)
-            {
-                renderbuffers[i] = context->createRenderbuffer();
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGenTextures(GLsizei n, GLuint* textures)
-{
-    EVENT("(GLsizei n = %d, GLuint* textures =  0x%0.8p)", n, textures);
-
-    try
-    {
-        if (n < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i < n; i++)
-            {
-                textures[i] = context->createTexture();
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
-    EVENT("(GLuint program = %d, GLuint index = %d, GLsizei bufsize = %d, GLsizei *length = 0x%0.8p, "
-          "GLint *size = 0x%0.8p, GLenum *type = %0.8p, GLchar *name = %0.8p)",
-          program, index, bufsize, length, size, type, name);
-
-    try
-    {
-        if (bufsize < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context->getProgram(program);
-
-            if (!programObject)
-            {
-                if (context->getShader(program))
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-            }
-
-            if (index >= (GLuint)programObject->getActiveAttributeCount())
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            programObject->getActiveAttribute(index, bufsize, length, size, type, name);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
-{
-    EVENT("(GLuint program = %d, GLuint index = %d, GLsizei bufsize = %d, "
-          "GLsizei* length = 0x%0.8p, GLint* size = 0x%0.8p, GLenum* type = 0x%0.8p, GLchar* name = 0x%0.8p)",
-          program, index, bufsize, length, size, type, name);
-
-    try
-    {
-        if (bufsize < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context->getProgram(program);
-
-            if (!programObject)
-            {
-                if (context->getShader(program))
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-            }
-
-            if (index >= (GLuint)programObject->getActiveUniformCount())
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            programObject->getActiveUniform(index, bufsize, length, size, type, name);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
-{
-    EVENT("(GLuint program = %d, GLsizei maxcount = %d, GLsizei* count = 0x%0.8p, GLuint* shaders = 0x%0.8p)",
-          program, maxcount, count, shaders);
-
-    try
-    {
-        if (maxcount < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context->getProgram(program);
-
-            if (!programObject)
-            {
-                if (context->getShader(program))
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-            }
-
-            return programObject->getAttachedShaders(maxcount, count, shaders);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-int __stdcall glGetAttribLocation(GLuint program, const GLchar* name)
-{
-    EVENT("(GLuint program = %d, const GLchar* name = %s)", program, name);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-
-            gl::Program *programObject = context->getProgram(program);
-
-            if (!programObject)
-            {
-                if (context->getShader(program))
-                {
-                    return error(GL_INVALID_OPERATION, -1);
-                }
-                else
-                {
-                    return error(GL_INVALID_VALUE, -1);
-                }
-            }
-
-            gl::ProgramBinary *programBinary = programObject->getProgramBinary();
-            if (!programBinary)
-            {
-                return error(GL_INVALID_OPERATION, -1);
-            }
-
-            return programBinary->getAttributeLocation(name);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY, -1);
-    }
-
-    return -1;
-}
-
-void __stdcall glGetBooleanv(GLenum pname, GLboolean* params)
-{
-    EVENT("(GLenum pname = 0x%X, GLboolean* params = 0x%0.8p)",  pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!(context->getBooleanv(pname, params)))
-            {
-                GLenum nativeType;
-                unsigned int numParams = 0;
-                if (!context->getQueryParameterInfo(pname, &nativeType, &numParams))
-                    return error(GL_INVALID_ENUM);
-
-                if (numParams == 0)
-                    return; // it is known that the pname is valid, but there are no parameters to return
-
-                if (nativeType == GL_FLOAT)
-                {
-                    GLfloat *floatParams = NULL;
-                    floatParams = new GLfloat[numParams];
-
-                    context->getFloatv(pname, floatParams);
-
-                    for (unsigned int i = 0; i < numParams; ++i)
-                    {
-                        if (floatParams[i] == 0.0f)
-                            params[i] = GL_FALSE;
-                        else
-                            params[i] = GL_TRUE;
-                    }
-
-                    delete [] floatParams;
-                }
-                else if (nativeType == GL_INT)
-                {
-                    GLint *intParams = NULL;
-                    intParams = new GLint[numParams];
-
-                    context->getIntegerv(pname, intParams);
-
-                    for (unsigned int i = 0; i < numParams; ++i)
-                    {
-                        if (intParams[i] == 0)
-                            params[i] = GL_FALSE;
-                        else
-                            params[i] = GL_TRUE;
-                    }
-
-                    delete [] intParams;
-                }
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetBufferParameteriv(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();
-
-        if (context)
-        {
-            gl::Buffer *buffer;
-
-            switch (target)
-            {
-              case GL_ARRAY_BUFFER:
-                buffer = context->getArrayBuffer();
-                break;
-              case GL_ELEMENT_ARRAY_BUFFER:
-                buffer = context->getElementArrayBuffer();
-                break;
-              default: return error(GL_INVALID_ENUM);
-            }
-
-            if (!buffer)
-            {
-                // A null buffer means that "0" is bound to the requested buffer target
-                return error(GL_INVALID_OPERATION);
-            }
-
-            switch (pname)
-            {
-              case GL_BUFFER_USAGE:
-                *params = buffer->usage();
-                break;
-              case GL_BUFFER_SIZE:
-                *params = buffer->size();
-                break;
-              default: return error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-GLenum __stdcall glGetError(void)
-{
-    EVENT("()");
-
-    gl::Context *context = gl::getContext();
-
-    if (context)
-    {
-        return context->getError();
-    }
-
-    return GL_NO_ERROR;
-}
-
-void __stdcall glGetFenceivNV(GLuint fence, GLenum pname, GLint *params)
-{
-    EVENT("(GLuint fence = %d, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", fence, pname, params);
-
-    try
-    {
-    
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Fence *fenceObject = context->getFence(fence);
-
-            if (fenceObject == NULL)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            fenceObject->getFenceiv(pname, params);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetFloatv(GLenum pname, GLfloat* params)
-{
-    EVENT("(GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!(context->getFloatv(pname, params)))
-            {
-                GLenum nativeType;
-                unsigned int numParams = 0;
-                if (!context->getQueryParameterInfo(pname, &nativeType, &numParams))
-                    return error(GL_INVALID_ENUM);
-
-                if (numParams == 0)
-                    return; // it is known that the pname is valid, but that there are no parameters to return.
-
-                if (nativeType == GL_BOOL)
-                {
-                    GLboolean *boolParams = NULL;
-                    boolParams = new GLboolean[numParams];
-
-                    context->getBooleanv(pname, boolParams);
-
-                    for (unsigned int i = 0; i < numParams; ++i)
-                    {
-                        if (boolParams[i] == GL_FALSE)
-                            params[i] = 0.0f;
-                        else
-                            params[i] = 1.0f;
-                    }
-
-                    delete [] boolParams;
-                }
-                else if (nativeType == GL_INT)
-                {
-                    GLint *intParams = NULL;
-                    intParams = new GLint[numParams];
-
-                    context->getIntegerv(pname, intParams);
-
-                    for (unsigned int i = 0; i < numParams; ++i)
-                    {
-                        params[i] = (GLfloat)intParams[i];
-                    }
-
-                    delete [] intParams;
-                }
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
-{
-    EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)",
-          target, attachment, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
-            {
-                return error(GL_INVALID_ENUM);
-            }
-
-            gl::Framebuffer *framebuffer = NULL;
-            if (target == GL_READ_FRAMEBUFFER_ANGLE)
-            {
-                if(context->getReadFramebufferHandle() == 0)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                framebuffer = context->getReadFramebuffer();
-            }
-            else 
-            {
-                if (context->getDrawFramebufferHandle() == 0)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                framebuffer = context->getDrawFramebuffer();
-            }
-
-            GLenum attachmentType;
-            GLuint attachmentHandle;
-            switch (attachment)
-            {
-              case GL_COLOR_ATTACHMENT0:    
-                attachmentType = framebuffer->getColorbufferType();
-                attachmentHandle = framebuffer->getColorbufferHandle(); 
-                break;
-              case GL_DEPTH_ATTACHMENT:     
-                attachmentType = framebuffer->getDepthbufferType();
-                attachmentHandle = framebuffer->getDepthbufferHandle();
-                break;
-              case GL_STENCIL_ATTACHMENT:   
-                attachmentType = framebuffer->getStencilbufferType();
-                attachmentHandle = framebuffer->getStencilbufferHandle();
-                break;
-              default: return error(GL_INVALID_ENUM);
-            }
-
-            GLenum attachmentObjectType;   // Type category
-            if (attachmentType == GL_NONE || attachmentType == GL_RENDERBUFFER)
-            {
-                attachmentObjectType = attachmentType;
-            }
-            else if (gl::IsInternalTextureTarget(attachmentType))
-            {
-                attachmentObjectType = GL_TEXTURE;
-            }
-            else
-            {
-                UNREACHABLE();
-                return;
-            }
-
-            switch (pname)
-            {
-              case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
-                *params = attachmentObjectType;
-                break;
-              case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
-                if (attachmentObjectType == GL_RENDERBUFFER || attachmentObjectType == GL_TEXTURE)
-                {
-                    *params = attachmentHandle;
-                }
-                else
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
-                if (attachmentObjectType == GL_TEXTURE)
-                {
-                    *params = 0; // FramebufferTexture2D will not allow level to be set to anything else in GL ES 2.0
-                }
-                else
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
-                if (attachmentObjectType == GL_TEXTURE)
-                {
-                    if (gl::IsCubemapTextureTarget(attachmentType))
-                    {
-                        *params = attachmentType;
-                    }
-                    else
-                    {
-                        *params = 0;
-                    }
-                }
-                else
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-GLenum __stdcall glGetGraphicsResetStatusEXT(void)
-{
-    EVENT("()");
-
-    try
-    {
-        gl::Context *context = gl::getContext();
-
-        if (context)
-        {
-            return context->getResetStatus();
-        }
-
-        return GL_NO_ERROR;
-    }
-    catch(std::bad_alloc&)
-    {
-        return GL_OUT_OF_MEMORY;
-    }
-}
-
-void __stdcall glGetIntegerv(GLenum pname, GLint* params)
-{
-    EVENT("(GLenum pname = 0x%X, GLint* params = 0x%0.8p)", pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!(context->getIntegerv(pname, params)))
-            {
-                GLenum nativeType;
-                unsigned int numParams = 0;
-                if (!context->getQueryParameterInfo(pname, &nativeType, &numParams))
-                    return error(GL_INVALID_ENUM);
-
-                if (numParams == 0)
-                    return; // it is known that pname is valid, but there are no parameters to return
-
-                if (nativeType == GL_BOOL)
-                {
-                    GLboolean *boolParams = NULL;
-                    boolParams = new GLboolean[numParams];
-
-                    context->getBooleanv(pname, boolParams);
-
-                    for (unsigned int i = 0; i < numParams; ++i)
-                    {
-                        if (boolParams[i] == GL_FALSE)
-                            params[i] = 0;
-                        else
-                            params[i] = 1;
-                    }
-
-                    delete [] boolParams;
-                }
-                else if (nativeType == GL_FLOAT)
-                {
-                    GLfloat *floatParams = NULL;
-                    floatParams = new GLfloat[numParams];
-
-                    context->getFloatv(pname, floatParams);
-
-                    for (unsigned int i = 0; i < numParams; ++i)
-                    {
-                        if (pname == GL_DEPTH_RANGE || pname == GL_COLOR_CLEAR_VALUE || pname == GL_DEPTH_CLEAR_VALUE || pname == GL_BLEND_COLOR)
-                        {
-                            params[i] = (GLint)(((GLfloat)(0xFFFFFFFF) * floatParams[i] - 1.0f) / 2.0f);
-                        }
-                        else
-                            params[i] = (GLint)(floatParams[i] > 0.0f ? floor(floatParams[i] + 0.5) : ceil(floatParams[i] - 0.5));
-                    }
-
-                    delete [] floatParams;
-                }
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetProgramiv(GLuint program, GLenum pname, GLint* params)
-{
-    EVENT("(GLuint program = %d, GLenum pname = %d, GLint* params = 0x%0.8p)", program, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context->getProgram(program);
-
-            if (!programObject)
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            switch (pname)
-            {
-              case GL_DELETE_STATUS:
-                *params = programObject->isFlaggedForDeletion();
-                return;
-              case GL_LINK_STATUS:
-                *params = programObject->getProgramBinary() != NULL;
-                return;
-              case GL_VALIDATE_STATUS:
-                *params = programObject->isValidated();
-                return;
-              case GL_INFO_LOG_LENGTH:
-                *params = programObject->getInfoLogLength();
-                return;
-              case GL_ATTACHED_SHADERS:
-                *params = programObject->getAttachedShadersCount();
-                return;
-              case GL_ACTIVE_ATTRIBUTES:
-                *params = programObject->getActiveAttributeCount();
-                return;
-              case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
-                *params = programObject->getActiveAttributeMaxLength();
-                return;
-              case GL_ACTIVE_UNIFORMS:
-                *params = programObject->getActiveUniformCount();
-                return;
-              case GL_ACTIVE_UNIFORM_MAX_LENGTH:
-                *params = programObject->getActiveUniformMaxLength();
-                return;
-              case GL_PROGRAM_BINARY_LENGTH_OES:
-                *params = 0;
-                return;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
-{
-    EVENT("(GLuint program = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* infolog = 0x%0.8p)",
-          program, bufsize, length, infolog);
-
-    try
-    {
-        if (bufsize < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context->getProgram(program);
-
-            if (!programObject)
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            programObject->getInfoLog(bufsize, length, infolog);
-        }
-    }
-    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();
-
-        if (context)
-        {
-            if (target != GL_RENDERBUFFER)
-            {
-                return error(GL_INVALID_ENUM);
-            }
-
-            if (context->getRenderbufferHandle() == 0)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            gl::Renderbuffer *renderbuffer = context->getRenderbuffer(context->getRenderbufferHandle());
-
-            switch (pname)
-            {
-              case GL_RENDERBUFFER_WIDTH:           *params = renderbuffer->getWidth();          break;
-              case GL_RENDERBUFFER_HEIGHT:          *params = renderbuffer->getHeight();         break;
-              case GL_RENDERBUFFER_INTERNAL_FORMAT: *params = renderbuffer->getInternalFormat(); break;
-              case GL_RENDERBUFFER_RED_SIZE:        *params = renderbuffer->getRedSize();        break;
-              case GL_RENDERBUFFER_GREEN_SIZE:      *params = renderbuffer->getGreenSize();      break;
-              case GL_RENDERBUFFER_BLUE_SIZE:       *params = renderbuffer->getBlueSize();       break;
-              case GL_RENDERBUFFER_ALPHA_SIZE:      *params = renderbuffer->getAlphaSize();      break;
-              case GL_RENDERBUFFER_DEPTH_SIZE:      *params = renderbuffer->getDepthSize();      break;
-              case GL_RENDERBUFFER_STENCIL_SIZE:    *params = renderbuffer->getStencilSize();    break;
-              case GL_RENDERBUFFER_SAMPLES_ANGLE:
-                if (context->getMaxSupportedSamples() != 0)
-                {
-                    *params = renderbuffer->getSamples();
-                }
-                else
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
-{
-    EVENT("(GLuint shader = %d, GLenum pname = %d, GLint* params = 0x%0.8p)", shader, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Shader *shaderObject = context->getShader(shader);
-
-            if (!shaderObject)
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            switch (pname)
-            {
-              case GL_SHADER_TYPE:
-                *params = shaderObject->getType();
-                return;
-              case GL_DELETE_STATUS:
-                *params = shaderObject->isFlaggedForDeletion();
-                return;
-              case GL_COMPILE_STATUS:
-                *params = shaderObject->isCompiled() ? GL_TRUE : GL_FALSE;
-                return;
-              case GL_INFO_LOG_LENGTH:
-                *params = shaderObject->getInfoLogLength();
-                return;
-              case GL_SHADER_SOURCE_LENGTH:
-                *params = shaderObject->getSourceLength();
-                return;
-              case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE:
-                *params = shaderObject->getTranslatedSourceLength();
-                return;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
-{
-    EVENT("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* infolog = 0x%0.8p)",
-          shader, bufsize, length, infolog);
-
-    try
-    {
-        if (bufsize < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Shader *shaderObject = context->getShader(shader);
-
-            if (!shaderObject)
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            shaderObject->getInfoLog(bufsize, length, infolog);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
-{
-    EVENT("(GLenum shadertype = 0x%X, GLenum precisiontype = 0x%X, GLint* range = 0x%0.8p, GLint* precision = 0x%0.8p)",
-          shadertype, precisiontype, range, precision);
-
-    try
-    {
-        switch (shadertype)
-        {
-          case GL_VERTEX_SHADER:
-          case GL_FRAGMENT_SHADER:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        switch (precisiontype)
-        {
-          case GL_LOW_FLOAT:
-          case GL_MEDIUM_FLOAT:
-          case GL_HIGH_FLOAT:
-            // Assume IEEE 754 precision
-            range[0] = 127;
-            range[1] = 127;
-            *precision = 23;
-            break;
-          case GL_LOW_INT:
-          case GL_MEDIUM_INT:
-          case GL_HIGH_INT:
-            // Some (most) hardware only supports single-precision floating-point numbers,
-            // which can accurately represent integers up to +/-16777216
-            range[0] = 24;
-            range[1] = 24;
-            *precision = 0;
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
-{
-    EVENT("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* source = 0x%0.8p)",
-          shader, bufsize, length, source);
-
-    try
-    {
-        if (bufsize < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Shader *shaderObject = context->getShader(shader);
-
-            if (!shaderObject)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            shaderObject->getSource(bufsize, length, source);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
-{
-    EVENT("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* source = 0x%0.8p)",
-          shader, bufsize, length, source);
-
-    try
-    {
-        if (bufsize < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Shader *shaderObject = context->getShader(shader);
-
-            if (!shaderObject)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            shaderObject->getTranslatedSource(bufsize, length, source);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-const GLubyte* __stdcall glGetString(GLenum name)
-{
-    EVENT("(GLenum name = 0x%X)", name);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        switch (name)
-        {
-          case GL_VENDOR:
-            return (GLubyte*)"Google Inc.";
-          case GL_RENDERER:
-            return (GLubyte*)((context != NULL) ? context->getRendererString() : "ANGLE");
-          case GL_VERSION:
-            return (GLubyte*)"OpenGL ES 2.0 (ANGLE "VERSION_STRING")";
-          case GL_SHADING_LANGUAGE_VERSION:
-            return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE "VERSION_STRING")";
-          case GL_EXTENSIONS:
-            return (GLubyte*)((context != NULL) ? context->getExtensionString() : "");
-          default:
-            return error(GL_INVALID_ENUM, (GLubyte*)NULL);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY, (GLubyte*)NULL);
-    }
-}
-
-void __stdcall glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
-{
-    EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", target, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Texture *texture;
-
-            switch (target)
-            {
-              case GL_TEXTURE_2D:
-                texture = context->getTexture2D();
-                break;
-              case GL_TEXTURE_CUBE_MAP:
-                texture = context->getTextureCubeMap();
-                break;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-
-            switch (pname)
-            {
-              case GL_TEXTURE_MAG_FILTER:
-                *params = (GLfloat)texture->getMagFilter();
-                break;
-              case GL_TEXTURE_MIN_FILTER:
-                *params = (GLfloat)texture->getMinFilter();
-                break;
-              case GL_TEXTURE_WRAP_S:
-                *params = (GLfloat)texture->getWrapS();
-                break;
-              case GL_TEXTURE_WRAP_T:
-                *params = (GLfloat)texture->getWrapT();
-                break;
-              case GL_TEXTURE_IMMUTABLE_FORMAT_EXT:
-                *params = (GLfloat)(texture->isImmutable() ? GL_TRUE : GL_FALSE);
-                break;
-              case GL_TEXTURE_USAGE_ANGLE:
-                *params = (GLfloat)texture->getUsage();
-                break;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetTexParameteriv(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();
-
-        if (context)
-        {
-            gl::Texture *texture;
-
-            switch (target)
-            {
-              case GL_TEXTURE_2D:
-                texture = context->getTexture2D();
-                break;
-              case GL_TEXTURE_CUBE_MAP:
-                texture = context->getTextureCubeMap();
-                break;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-
-            switch (pname)
-            {
-              case GL_TEXTURE_MAG_FILTER:
-                *params = texture->getMagFilter();
-                break;
-              case GL_TEXTURE_MIN_FILTER:
-                *params = texture->getMinFilter();
-                break;
-              case GL_TEXTURE_WRAP_S:
-                *params = texture->getWrapS();
-                break;
-              case GL_TEXTURE_WRAP_T:
-                *params = texture->getWrapT();
-                break;
-              case GL_TEXTURE_IMMUTABLE_FORMAT_EXT:
-                *params = texture->isImmutable() ? GL_TRUE : GL_FALSE;
-                break;
-              case GL_TEXTURE_USAGE_ANGLE:
-                *params = texture->getUsage();
-                break;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, GLfloat* params)
-{
-    EVENT("(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLfloat* params = 0x%0.8p)",
-          program, location, bufSize, params);
-
-    try
-    {
-        if (bufSize < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (program == 0)
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            gl::Program *programObject = context->getProgram(program);
-
-            if (!programObject)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = programObject->getProgramBinary();
-            if (!programBinary)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary->getUniformfv(location, &bufSize, params))
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetUniformfv(GLuint program, GLint location, GLfloat* params)
-{
-    EVENT("(GLuint program = %d, GLint location = %d, GLfloat* params = 0x%0.8p)", program, location, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (program == 0)
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            gl::Program *programObject = context->getProgram(program);
-
-            if (!programObject)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = programObject->getProgramBinary();
-            if (!programBinary)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary->getUniformfv(location, NULL, params))
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint* params)
-{
-    EVENT("(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLint* params = 0x%0.8p)", 
-          program, location, bufSize, params);
-
-    try
-    {
-        if (bufSize < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (program == 0)
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            gl::Program *programObject = context->getProgram(program);
-
-            if (!programObject)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = programObject->getProgramBinary();
-            if (!programBinary)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary->getUniformiv(location, &bufSize, params))
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetUniformiv(GLuint program, GLint location, GLint* params)
-{
-    EVENT("(GLuint program = %d, GLint location = %d, GLint* params = 0x%0.8p)", program, location, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (program == 0)
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            gl::Program *programObject = context->getProgram(program);
-
-            if (!programObject)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = programObject->getProgramBinary();
-            if (!programBinary)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary->getUniformiv(location, NULL, params))
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-int __stdcall glGetUniformLocation(GLuint program, const GLchar* name)
-{
-    EVENT("(GLuint program = %d, const GLchar* name = 0x%0.8p)", program, name);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (strstr(name, "gl_") == name)
-        {
-            return -1;
-        }
-
-        if (context)
-        {
-            gl::Program *programObject = context->getProgram(program);
-
-            if (!programObject)
-            {
-                if (context->getShader(program))
-                {
-                    return error(GL_INVALID_OPERATION, -1);
-                }
-                else
-                {
-                    return error(GL_INVALID_VALUE, -1);
-                }
-            }
-
-            gl::ProgramBinary *programBinary = programObject->getProgramBinary();
-            if (!programBinary)
-            {
-                return error(GL_INVALID_OPERATION, -1);
-            }
-
-            return programBinary->getUniformLocation(name);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY, -1);
-    }
-
-    return -1;
-}
-
-void __stdcall glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
-{
-    EVENT("(GLuint index = %d, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", index, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (index >= gl::MAX_VERTEX_ATTRIBS)
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            const gl::VertexAttribute &attribState = context->getVertexAttribState(index);
-
-            switch (pname)
-            {
-              case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
-                *params = (GLfloat)(attribState.mArrayEnabled ? GL_TRUE : GL_FALSE);
-                break;
-              case GL_VERTEX_ATTRIB_ARRAY_SIZE:
-                *params = (GLfloat)attribState.mSize;
-                break;
-              case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
-                *params = (GLfloat)attribState.mStride;
-                break;
-              case GL_VERTEX_ATTRIB_ARRAY_TYPE:
-                *params = (GLfloat)attribState.mType;
-                break;
-              case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
-                *params = (GLfloat)(attribState.mNormalized ? GL_TRUE : GL_FALSE);
-                break;
-              case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
-                *params = (GLfloat)attribState.mBoundBuffer.id();
-                break;
-              case GL_CURRENT_VERTEX_ATTRIB:
-                for (int i = 0; i < 4; ++i)
-                {
-                    params[i] = attribState.mCurrentValue[i];
-                }
-                break;
-              case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:
-                *params = (GLfloat)attribState.mDivisor;
-                break;
-              default: return error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
-{
-    EVENT("(GLuint index = %d, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", index, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (index >= gl::MAX_VERTEX_ATTRIBS)
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            const gl::VertexAttribute &attribState = context->getVertexAttribState(index);
-
-            switch (pname)
-            {
-              case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
-                *params = (attribState.mArrayEnabled ? GL_TRUE : GL_FALSE);
-                break;
-              case GL_VERTEX_ATTRIB_ARRAY_SIZE:
-                *params = attribState.mSize;
-                break;
-              case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
-                *params = attribState.mStride;
-                break;
-              case GL_VERTEX_ATTRIB_ARRAY_TYPE:
-                *params = attribState.mType;
-                break;
-              case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
-                *params = (attribState.mNormalized ? GL_TRUE : GL_FALSE);
-                break;
-              case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
-                *params = attribState.mBoundBuffer.id();
-                break;
-              case GL_CURRENT_VERTEX_ATTRIB:
-                for (int i = 0; i < 4; ++i)
-                {
-                    float currentValue = attribState.mCurrentValue[i];
-                    params[i] = (GLint)(currentValue > 0.0f ? floor(currentValue + 0.5f) : ceil(currentValue - 0.5f));
-                }
-                break;
-              case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:
-                *params = (GLint)attribState.mDivisor;
-                break;
-              default: return error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer)
-{
-    EVENT("(GLuint index = %d, GLenum pname = 0x%X, GLvoid** pointer = 0x%0.8p)", index, pname, pointer);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (index >= gl::MAX_VERTEX_ATTRIBS)
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER)
-            {
-                return error(GL_INVALID_ENUM);
-            }
-
-            *pointer = const_cast<GLvoid*>(context->getVertexAttribPointer(index));
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glHint(GLenum target, GLenum mode)
-{
-    EVENT("(GLenum target = 0x%X, GLenum mode = 0x%X)", target, mode);
-
-    try
-    {
-        switch (mode)
-        {
-          case GL_FASTEST:
-          case GL_NICEST:
-          case GL_DONT_CARE:
-            break;
-          default:
-            return error(GL_INVALID_ENUM); 
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-        switch (target)
-        {
-          case GL_GENERATE_MIPMAP_HINT:
-            if (context) context->setGenerateMipmapHint(mode);
-            break;
-          case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
-            if (context) context->setFragmentShaderDerivativeHint(mode);
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-GLboolean __stdcall glIsBuffer(GLuint buffer)
-{
-    EVENT("(GLuint buffer = %d)", buffer);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context && buffer)
-        {
-            gl::Buffer *bufferObject = context->getBuffer(buffer);
-
-            if (bufferObject)
-            {
-                return GL_TRUE;
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
-}
-
-GLboolean __stdcall glIsEnabled(GLenum cap)
-{
-    EVENT("(GLenum cap = 0x%X)", cap);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            switch (cap)
-            {
-              case GL_CULL_FACE:                return context->isCullFaceEnabled();
-              case GL_POLYGON_OFFSET_FILL:      return context->isPolygonOffsetFillEnabled();
-              case GL_SAMPLE_ALPHA_TO_COVERAGE: return context->isSampleAlphaToCoverageEnabled();
-              case GL_SAMPLE_COVERAGE:          return context->isSampleCoverageEnabled();
-              case GL_SCISSOR_TEST:             return context->isScissorTestEnabled();
-              case GL_STENCIL_TEST:             return context->isStencilTestEnabled();
-              case GL_DEPTH_TEST:               return context->isDepthTestEnabled();
-              case GL_BLEND:                    return context->isBlendEnabled();
-              case GL_DITHER:                   return context->isDitherEnabled();
-              default:
-                return error(GL_INVALID_ENUM, false);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY, false);
-    }
-
-    return false;
-}
-
-GLboolean __stdcall glIsFenceNV(GLuint fence)
-{
-    EVENT("(GLuint fence = %d)", fence);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Fence *fenceObject = context->getFence(fence);
-
-            if (fenceObject == NULL)
-            {
-                return GL_FALSE;
-            }
-
-            return fenceObject->isFence();
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
-}
-
-GLboolean __stdcall glIsFramebuffer(GLuint framebuffer)
-{
-    EVENT("(GLuint framebuffer = %d)", framebuffer);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context && framebuffer)
-        {
-            gl::Framebuffer *framebufferObject = context->getFramebuffer(framebuffer);
-
-            if (framebufferObject)
-            {
-                return GL_TRUE;
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
-}
-
-GLboolean __stdcall glIsProgram(GLuint program)
-{
-    EVENT("(GLuint program = %d)", program);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context && program)
-        {
-            gl::Program *programObject = context->getProgram(program);
-
-            if (programObject)
-            {
-                return GL_TRUE;
-            }
-        }
-    }
-    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();
-
-        if (context && renderbuffer)
-        {
-            gl::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer);
-
-            if (renderbufferObject)
-            {
-                return GL_TRUE;
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
-}
-
-GLboolean __stdcall glIsShader(GLuint shader)
-{
-    EVENT("(GLuint shader = %d)", shader);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context && shader)
-        {
-            gl::Shader *shaderObject = context->getShader(shader);
-
-            if (shaderObject)
-            {
-                return GL_TRUE;
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
-}
-
-GLboolean __stdcall glIsTexture(GLuint texture)
-{
-    EVENT("(GLuint texture = %d)", texture);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context && texture)
-        {
-            gl::Texture *textureObject = context->getTexture(texture);
-
-            if (textureObject)
-            {
-                return GL_TRUE;
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
-}
-
-void __stdcall glLineWidth(GLfloat width)
-{
-    EVENT("(GLfloat width = %f)", width);
-
-    try
-    {
-        if (width <= 0.0f)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setLineWidth(width);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glLinkProgram(GLuint program)
-{
-    EVENT("(GLuint program = %d)", program);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context->getProgram(program);
-
-            if (!programObject)
-            {
-                if (context->getShader(program))
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-            }
-
-            programObject->link();
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glPixelStorei(GLenum pname, GLint param)
-{
-    EVENT("(GLenum pname = 0x%X, GLint param = %d)", pname, param);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            switch (pname)
-            {
-              case GL_UNPACK_ALIGNMENT:
-                if (param != 1 && param != 2 && param != 4 && param != 8)
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-
-                context->setUnpackAlignment(param);
-                break;
-
-              case GL_PACK_ALIGNMENT:
-                if (param != 1 && param != 2 && param != 4 && param != 8)
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-
-                context->setPackAlignment(param);
-                break;
-
-              case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
-                context->setPackReverseRowOrder(param != 0);
-                break;
-
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glPolygonOffset(GLfloat factor, GLfloat units)
-{
-    EVENT("(GLfloat factor = %f, GLfloat units = %f)", factor, units);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setPolygonOffsetParams(factor, units);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height,
-                                GLenum format, GLenum type, GLsizei bufSize,
-                                GLvoid *data)
-{
-    EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, "
-          "GLenum format = 0x%X, GLenum type = 0x%X, GLsizei bufSize = 0x%d, GLvoid *data = 0x%0.8p)",
-          x, y, width, height, format, type, bufSize, data);
-
-    try
-    {
-        if (width < 0 || height < 0 || bufSize < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (!validReadFormatType(format, type))
-        {
-            return error(GL_INVALID_OPERATION);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->readPixels(x, y, width, height, format, type, &bufSize, data);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
-                            GLenum format, GLenum type, GLvoid* pixels)
-{
-    EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, "
-          "GLenum format = 0x%X, GLenum type = 0x%X, GLvoid* pixels = 0x%0.8p)",
-          x, y, width, height, format, type,  pixels);
-
-    try
-    {
-        if (width < 0 || height < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (!validReadFormatType(format, type))
-        {
-            return error(GL_INVALID_OPERATION);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->readPixels(x, y, width, height, format, type, NULL, pixels);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glReleaseShaderCompiler(void)
-{
-    EVENT("()");
-
-    try
-    {
-        gl::Shader::releaseCompiler();
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
-    EVENT("(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)",
-          target, samples, internalformat, width, height);
-
-    try
-    {
-        switch (target)
-        {
-          case GL_RENDERBUFFER:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        if (!gl::IsColorRenderable(internalformat) && !gl::IsDepthRenderable(internalformat) && !gl::IsStencilRenderable(internalformat))
-        {
-            return error(GL_INVALID_ENUM);
-        }
-
-        if (width < 0 || height < 0 || samples < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (width > context->getMaximumRenderbufferDimension() || 
-                height > context->getMaximumRenderbufferDimension() ||
-                samples > context->getMaxSupportedSamples())
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            GLuint handle = context->getRenderbufferHandle();
-            if (handle == 0)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            switch (internalformat)
-            {
-              case GL_DEPTH_COMPONENT16:
-                context->setRenderbufferStorage(new gl::Depthbuffer(width, height, samples));
-                break;
-              case GL_RGBA4:
-              case GL_RGB5_A1:
-              case GL_RGB565:
-              case GL_RGB8_OES:
-              case GL_RGBA8_OES:
-                context->setRenderbufferStorage(new gl::Colorbuffer(width, height, internalformat, samples));
-                break;
-              case GL_STENCIL_INDEX8:
-                context->setRenderbufferStorage(new gl::Stencilbuffer(width, height, samples));
-                break;
-              case GL_DEPTH24_STENCIL8_OES:
-                context->setRenderbufferStorage(new gl::DepthStencilbuffer(width, height, samples));
-                break;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
-    glRenderbufferStorageMultisampleANGLE(target, 0, internalformat, width, height);
-}
-
-void __stdcall glSampleCoverage(GLclampf value, GLboolean invert)
-{
-    EVENT("(GLclampf value = %f, GLboolean invert = %d)", value, invert);
-
-    try
-    {
-        gl::Context* context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setSampleCoverageParams(gl::clamp01(value), invert == GL_TRUE);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glSetFenceNV(GLuint fence, GLenum condition)
-{
-    EVENT("(GLuint fence = %d, GLenum condition = 0x%X)", fence, condition);
-
-    try
-    {
-        if (condition != GL_ALL_COMPLETED_NV)
-        {
-            return error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Fence *fenceObject = context->getFence(fence);
-
-            if (fenceObject == NULL)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            fenceObject->setFence(condition);    
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
-    EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width, height);
-
-    try
-    {
-        if (width < 0 || height < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context* context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setScissorParams(x, y, width, height);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length)
-{
-    EVENT("(GLsizei n = %d, const GLuint* shaders = 0x%0.8p, GLenum binaryformat = 0x%X, "
-          "const GLvoid* binary = 0x%0.8p, GLsizei length = %d)",
-          n, shaders, binaryformat, binary, length);
-
-    try
-    {
-        // No binary shader formats are supported.
-        return error(GL_INVALID_ENUM);
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glShaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length)
-{
-    EVENT("(GLuint shader = %d, GLsizei count = %d, const GLchar** string = 0x%0.8p, const GLint* length = 0x%0.8p)",
-          shader, count, string, length);
-
-    try
-    {
-        if (count < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Shader *shaderObject = context->getShader(shader);
-
-            if (!shaderObject)
-            {
-                if (context->getProgram(shader))
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-            }
-
-            shaderObject->setSource(count, string, length);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
-    glStencilFuncSeparate(GL_FRONT_AND_BACK, func, ref, mask);
-}
-
-void __stdcall glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
-    EVENT("(GLenum face = 0x%X, GLenum func = 0x%X, GLint ref = %d, GLuint mask = %d)", face, func, ref, mask);
-
-    try
-    {
-        switch (face)
-        {
-          case GL_FRONT:
-          case GL_BACK:
-          case GL_FRONT_AND_BACK:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        switch (func)
-        {
-          case GL_NEVER:
-          case GL_ALWAYS:
-          case GL_LESS:
-          case GL_LEQUAL:
-          case GL_EQUAL:
-          case GL_GEQUAL:
-          case GL_GREATER:
-          case GL_NOTEQUAL:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
-            {
-                context->setStencilParams(func, ref, mask);
-            }
-
-            if (face == GL_BACK || face == GL_FRONT_AND_BACK)
-            {
-                context->setStencilBackParams(func, ref, mask);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glStencilMask(GLuint mask)
-{
-    glStencilMaskSeparate(GL_FRONT_AND_BACK, mask);
-}
-
-void __stdcall glStencilMaskSeparate(GLenum face, GLuint mask)
-{
-    EVENT("(GLenum face = 0x%X, GLuint mask = %d)", face, mask);
-
-    try
-    {
-        switch (face)
-        {
-          case GL_FRONT:
-          case GL_BACK:
-          case GL_FRONT_AND_BACK:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
-            {
-                context->setStencilWritemask(mask);
-            }
-
-            if (face == GL_BACK || face == GL_FRONT_AND_BACK)
-            {
-                context->setStencilBackWritemask(mask);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
-    glStencilOpSeparate(GL_FRONT_AND_BACK, fail, zfail, zpass);
-}
-
-void __stdcall glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
-{
-    EVENT("(GLenum face = 0x%X, GLenum fail = 0x%X, GLenum zfail = 0x%X, GLenum zpas = 0x%Xs)",
-          face, fail, zfail, zpass);
-
-    try
-    {
-        switch (face)
-        {
-          case GL_FRONT:
-          case GL_BACK:
-          case GL_FRONT_AND_BACK:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        switch (fail)
-        {
-          case GL_ZERO:
-          case GL_KEEP:
-          case GL_REPLACE:
-          case GL_INCR:
-          case GL_DECR:
-          case GL_INVERT:
-          case GL_INCR_WRAP:
-          case GL_DECR_WRAP:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        switch (zfail)
-        {
-          case GL_ZERO:
-          case GL_KEEP:
-          case GL_REPLACE:
-          case GL_INCR:
-          case GL_DECR:
-          case GL_INVERT:
-          case GL_INCR_WRAP:
-          case GL_DECR_WRAP:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        switch (zpass)
-        {
-          case GL_ZERO:
-          case GL_KEEP:
-          case GL_REPLACE:
-          case GL_INCR:
-          case GL_DECR:
-          case GL_INVERT:
-          case GL_INCR_WRAP:
-          case GL_DECR_WRAP:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
-            {
-                context->setStencilOperations(fail, zfail, zpass);
-            }
-
-            if (face == GL_BACK || face == GL_FRONT_AND_BACK)
-            {
-                context->setStencilBackOperations(fail, zfail, zpass);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-GLboolean __stdcall glTestFenceNV(GLuint fence)
-{
-    EVENT("(GLuint fence = %d)", fence);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Fence *fenceObject = context->getFence(fence);
-
-            if (fenceObject == NULL)
-            {
-                return error(GL_INVALID_OPERATION, GL_TRUE);
-            }
-
-            return fenceObject->testFence();
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        error(GL_OUT_OF_MEMORY);
-    }
-    
-    return GL_TRUE;
-}
-
-void __stdcall glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
-                            GLint border, GLenum format, GLenum type, const GLvoid* pixels)
-{
-    EVENT("(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, GLsizei height = %d, "
-          "GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels =  0x%0.8p)",
-          target, level, internalformat, width, height, border, format, type, pixels);
-
-    try
-    {
-        if (!validImageSize(level, width, height))
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (internalformat != GLint(format))
-        {
-            return error(GL_INVALID_OPERATION);
-        }
-
-        // validate <type> by itself (used as secondary key below)
-        switch (type)
-        {
-          case GL_UNSIGNED_BYTE:
-          case GL_UNSIGNED_SHORT_5_6_5:
-          case GL_UNSIGNED_SHORT_4_4_4_4:
-          case GL_UNSIGNED_SHORT_5_5_5_1:
-          case GL_UNSIGNED_SHORT:
-          case GL_UNSIGNED_INT:
-          case GL_UNSIGNED_INT_24_8_OES:
-          case GL_HALF_FLOAT_OES:
-          case GL_FLOAT:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        // validate <format> + <type> combinations
-        // - invalid <format> -> sets INVALID_ENUM
-        // - invalid <format>+<type> combination -> sets INVALID_OPERATION
-        switch (format)
-        {
-          case GL_ALPHA:
-          case GL_LUMINANCE:
-          case GL_LUMINANCE_ALPHA:
-            switch (type)
-            {
-              case GL_UNSIGNED_BYTE:
-              case GL_FLOAT:
-              case GL_HALF_FLOAT_OES:
-                break;
-              default:
-                return error(GL_INVALID_OPERATION);
-            }
-            break;
-          case GL_RGB:
-            switch (type)
-            {
-              case GL_UNSIGNED_BYTE:
-              case GL_UNSIGNED_SHORT_5_6_5:
-              case GL_FLOAT:
-              case GL_HALF_FLOAT_OES:
-                break;
-              default:
-                return error(GL_INVALID_OPERATION);
-            }
-            break;
-          case GL_RGBA:
-            switch (type)
-            {
-              case GL_UNSIGNED_BYTE:
-              case GL_UNSIGNED_SHORT_4_4_4_4:
-              case GL_UNSIGNED_SHORT_5_5_5_1:
-              case GL_FLOAT:
-              case GL_HALF_FLOAT_OES:
-                break;
-              default:
-                return error(GL_INVALID_OPERATION);
-            }
-            break;
-          case GL_BGRA_EXT:
-            switch (type)
-            {
-              case GL_UNSIGNED_BYTE:
-                break;
-              default:
-                return error(GL_INVALID_OPERATION);
-            }
-            break;
-          case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:  // error cases for compressed textures are handled below
-          case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-          case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
-          case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
-            break; 
-          case GL_DEPTH_COMPONENT:
-            switch (type)
-            {
-              case GL_UNSIGNED_SHORT:
-              case GL_UNSIGNED_INT:
-                break;
-              default:
-                return error(GL_INVALID_OPERATION);
-            }
-            break;
-          case GL_DEPTH_STENCIL_OES:
-            switch (type)
-            {
-              case GL_UNSIGNED_INT_24_8_OES:
-                break;
-              default:
-                return error(GL_INVALID_OPERATION);
-            }
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        if (border != 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (level > context->getMaximumTextureLevel())
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            switch (target)
-            {
-              case GL_TEXTURE_2D:
-                if (width > (context->getMaximumTextureDimension() >> level) ||
-                    height > (context->getMaximumTextureDimension() >> level))
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-                break;
-              case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
-              case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
-              case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
-              case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
-              case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
-              case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
-                if (width != height)
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-
-                if (width > (context->getMaximumCubeTextureDimension() >> level) ||
-                    height > (context->getMaximumCubeTextureDimension() >> level))
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-                break;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-
-            switch (format) {
-              case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-              case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-                if (context->supportsDXT1Textures())
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
-                if (context->supportsDXT3Textures())
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
-                if (context->supportsDXT5Textures())
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              case GL_DEPTH_COMPONENT:
-              case GL_DEPTH_STENCIL_OES:
-                if (!context->supportsDepthTextures())
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-                if (target != GL_TEXTURE_2D)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                // OES_depth_texture supports loading depth data and multiple levels,
-                // but ANGLE_depth_texture does not
-                if (pixels != NULL || level != 0)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                break;
-              default:
-                break;
-            }
-
-            if (type == GL_FLOAT)
-            {
-                if (!context->supportsFloat32Textures())
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-            }
-            else if (type == GL_HALF_FLOAT_OES)
-            {
-                if (!context->supportsFloat16Textures())
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-            }
-
-            if (target == GL_TEXTURE_2D)
-            {
-                gl::Texture2D *texture = context->getTexture2D();
-
-                if (!texture)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                if (texture->isImmutable())
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                texture->setImage(level, width, height, format, type, context->getUnpackAlignment(), pixels);
-            }
-            else
-            {
-                gl::TextureCubeMap *texture = context->getTextureCubeMap();
-
-                if (!texture)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                if (texture->isImmutable())
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                switch (target)
-                {
-                  case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
-                    texture->setImagePosX(level, width, height, format, type, context->getUnpackAlignment(), pixels);
-                    break;
-                  case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
-                    texture->setImageNegX(level, width, height, format, type, context->getUnpackAlignment(), pixels);
-                    break;
-                  case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
-                    texture->setImagePosY(level, width, height, format, type, context->getUnpackAlignment(), pixels);
-                    break;
-                  case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
-                    texture->setImageNegY(level, width, height, format, type, context->getUnpackAlignment(), pixels);
-                    break;
-                  case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
-                    texture->setImagePosZ(level, width, height, format, type, context->getUnpackAlignment(), pixels);
-                    break;
-                  case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
-                    texture->setImageNegZ(level, width, height, format, type, context->getUnpackAlignment(), pixels);
-                    break;
-                  default: UNREACHABLE();
-                }
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
-    glTexParameteri(target, pname, (GLint)param);
-}
-
-void __stdcall glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
-{
-    glTexParameteri(target, pname, (GLint)*params);
-}
-
-void __stdcall glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
-    EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)", target, pname, param);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Texture *texture;
-
-            switch (target)
-            {
-              case GL_TEXTURE_2D:
-                texture = context->getTexture2D();
-                break;
-              case GL_TEXTURE_CUBE_MAP:
-                texture = context->getTextureCubeMap();
-                break;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-
-            switch (pname)
-            {
-              case GL_TEXTURE_WRAP_S:
-                if (!texture->setWrapS((GLenum)param))
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              case GL_TEXTURE_WRAP_T:
-                if (!texture->setWrapT((GLenum)param))
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              case GL_TEXTURE_MIN_FILTER:
-                if (!texture->setMinFilter((GLenum)param))
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              case GL_TEXTURE_MAG_FILTER:
-                if (!texture->setMagFilter((GLenum)param))
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              case GL_TEXTURE_USAGE_ANGLE:
-                if (!texture->setUsage((GLenum)param))
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
-{
-    glTexParameteri(target, pname, *params);
-}
-
-void __stdcall glTexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
-{
-    EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)",
-           target, levels, internalformat, width, height);
-
-    try
-    {
-        if (target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP)
-        {
-            return error(GL_INVALID_ENUM);
-        }
-
-        if (width < 1 || height < 1 || levels < 1)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (target == GL_TEXTURE_CUBE_MAP && width != height)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (levels != 1 && levels != gl::log2(std::max(width, height)) + 1)
-        {
-            return error(GL_INVALID_OPERATION);
-        }
-
-        GLenum format = gl::ExtractFormat(internalformat);
-        GLenum type = gl::ExtractType(internalformat);
-
-        if (format == GL_NONE || type == GL_NONE)
-        {
-            return error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            switch (target)
-            {
-              case GL_TEXTURE_2D:
-                if (width > context->getMaximumTextureDimension() ||
-                    height > context->getMaximumTextureDimension())
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-                break;
-              case GL_TEXTURE_CUBE_MAP:
-                if (width > context->getMaximumCubeTextureDimension() ||
-                    height > context->getMaximumCubeTextureDimension())
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-                break;
-              default:
-                return error(GL_INVALID_ENUM);
-            }
-
-            if (levels != 1 && !context->supportsNonPower2Texture())
-            {
-                if (!gl::isPow2(width) || !gl::isPow2(height))
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-            }
-
-            switch (internalformat)
-            {
-              case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-              case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-                if (!context->supportsDXT1Textures())
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
-                if (!context->supportsDXT3Textures())
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
-                if (!context->supportsDXT5Textures())
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              case GL_RGBA32F_EXT:
-              case GL_RGB32F_EXT:
-              case GL_ALPHA32F_EXT:
-              case GL_LUMINANCE32F_EXT:
-              case GL_LUMINANCE_ALPHA32F_EXT:
-                if (!context->supportsFloat32Textures())
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              case GL_RGBA16F_EXT:
-              case GL_RGB16F_EXT:
-              case GL_ALPHA16F_EXT:
-              case GL_LUMINANCE16F_EXT:
-              case GL_LUMINANCE_ALPHA16F_EXT:
-                if (!context->supportsFloat16Textures())
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                break;
-              case GL_DEPTH_COMPONENT16:
-              case GL_DEPTH_COMPONENT32_OES:
-              case GL_DEPTH24_STENCIL8_OES:
-                if (!context->supportsDepthTextures())
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                if (target != GL_TEXTURE_2D)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                // ANGLE_depth_texture only supports 1-level textures
-                if (levels != 1)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                break;
-              default:
-                break;
-            }
-
-            if (target == GL_TEXTURE_2D)
-            {
-                gl::Texture2D *texture = context->getTexture2D();
-
-                if (!texture || texture->id() == 0)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                if (texture->isImmutable())
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                texture->storage(levels, internalformat, width, height);
-            }
-            else if (target == GL_TEXTURE_CUBE_MAP)
-            {
-                gl::TextureCubeMap *texture = context->getTextureCubeMap();
-
-                if (!texture || texture->id() == 0)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                if (texture->isImmutable())
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-
-                texture->storage(levels, internalformat, width);
-            }
-            else UNREACHABLE();
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
-                               GLenum format, GLenum type, const GLvoid* pixels)
-{
-    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::IsInternalTextureTarget(target))
-        {
-            return error(GL_INVALID_ENUM);
-        }
-
-        if (level < 0 || xoffset < 0 || yoffset < 0 || width < 0 || height < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (std::numeric_limits<GLsizei>::max() - xoffset < width || std::numeric_limits<GLsizei>::max() - yoffset < height)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (!checkTextureFormatType(format, type))
-        {
-            return; // error is set by helper function
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (level > context->getMaximumTextureLevel())
-            {
-                return error(GL_INVALID_VALUE);
-            }
-
-            if (format == GL_FLOAT)
-            {
-                if (!context->supportsFloat32Textures())
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-            }
-            else if (format == GL_HALF_FLOAT_OES)
-            {
-                if (!context->supportsFloat16Textures())
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-            }
-            else if (gl::IsDepthTexture(format))
-            {
-                if (!context->supportsDepthTextures())
-                {
-                    return error(GL_INVALID_ENUM);
-                }
-                if (target != GL_TEXTURE_2D)
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                // OES_depth_texture supports loading depth data, but ANGLE_depth_texture does not
-                return error(GL_INVALID_OPERATION);
-            }
-
-            if (width == 0 || height == 0 || pixels == NULL)
-            {
-                return;
-            }
-
-            if (target == GL_TEXTURE_2D)
-            {
-                gl::Texture2D *texture = context->getTexture2D();
-                if (validateSubImageParams2D(false, width, height, xoffset, yoffset, level, format, texture))
-                {
-                    texture->subImage(level, xoffset, yoffset, width, height, format, type, context->getUnpackAlignment(), pixels);
-                }
-            }
-            else if (gl::IsCubemapTextureTarget(target))
-            {
-                gl::TextureCubeMap *texture = context->getTextureCubeMap();
-                if (validateSubImageParamsCube(false, width, height, xoffset, yoffset, target, level, format, texture))
-                {
-                    texture->subImage(target, level, xoffset, yoffset, width, height, format, type, context->getUnpackAlignment(), pixels);
-                }
-            }
-            else
-            {
-                UNREACHABLE();
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glUniform1f(GLint location, GLfloat x)
-{
-    glUniform1fv(location, 1, &x);
-}
-
-void __stdcall glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
-{
-    EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
-
-    try
-    {
-        if (count < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *program = context->getCurrentProgram();
-
-            if (!program)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = program->getProgramBinary();
-            if (!programBinary)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary->setUniform1fv(location, count, v))
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glUniform1i(GLint location, GLint x)
-{
-    glUniform1iv(location, 1, &x);
-}
-
-void __stdcall glUniform1iv(GLint location, GLsizei count, const GLint* v)
-{
-    EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
-
-    try
-    {
-        if (count < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *program = context->getCurrentProgram();
-
-            if (!program)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = program->getProgramBinary();
-            if (!programBinary)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary->setUniform1iv(location, count, v))
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glUniform2f(GLint location, GLfloat x, GLfloat y)
-{
-    GLfloat xy[2] = {x, y};
-
-    glUniform2fv(location, 1, (GLfloat*)&xy);
-}
-
-void __stdcall glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
-{
-    EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
-
-    try
-    {
-        if (count < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-        
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *program = context->getCurrentProgram();
-
-            if (!program)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = program->getProgramBinary();
-            if (!programBinary)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary->setUniform2fv(location, count, v))
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glUniform2i(GLint location, GLint x, GLint y)
-{
-    GLint xy[4] = {x, y};
-
-    glUniform2iv(location, 1, (GLint*)&xy);
-}
-
-void __stdcall glUniform2iv(GLint location, GLsizei count, const GLint* v)
-{
-    EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
-
-    try
-    {
-        if (count < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *program = context->getCurrentProgram();
-
-            if (!program)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = program->getProgramBinary();
-            if (!programBinary)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary->setUniform2iv(location, count, v))
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
-{
-    GLfloat xyz[3] = {x, y, z};
-
-    glUniform3fv(location, 1, (GLfloat*)&xyz);
-}
-
-void __stdcall glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
-{
-    EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
-
-    try
-    {
-        if (count < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *program = context->getCurrentProgram();
-
-            if (!program)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = program->getProgramBinary();
-            if (!programBinary)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary->setUniform3fv(location, count, v))
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glUniform3i(GLint location, GLint x, GLint y, GLint z)
-{
-    GLint xyz[3] = {x, y, z};
-
-    glUniform3iv(location, 1, (GLint*)&xyz);
-}
-
-void __stdcall glUniform3iv(GLint location, GLsizei count, const GLint* v)
-{
-    EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
-
-    try
-    {
-        if (count < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *program = context->getCurrentProgram();
-
-            if (!program)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = program->getProgramBinary();
-            if (!programBinary)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary->setUniform3iv(location, count, v))
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
-    GLfloat xyzw[4] = {x, y, z, w};
-
-    glUniform4fv(location, 1, (GLfloat*)&xyzw);
-}
-
-void __stdcall glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
-{
-    EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
-
-    try
-    {
-        if (count < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *program = context->getCurrentProgram();
-
-            if (!program)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = program->getProgramBinary();
-            if (!programBinary)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary->setUniform4fv(location, count, v))
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
-{
-    GLint xyzw[4] = {x, y, z, w};
-
-    glUniform4iv(location, 1, (GLint*)&xyzw);
-}
-
-void __stdcall glUniform4iv(GLint location, GLsizei count, const GLint* v)
-{
-    EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
-
-    try
-    {
-        if (count < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *program = context->getCurrentProgram();
-
-            if (!program)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = program->getProgramBinary();
-            if (!programBinary)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary->setUniform4iv(location, count, v))
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
-    EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat* value = 0x%0.8p)",
-          location, count, transpose, value);
-
-    try
-    {
-        if (count < 0 || transpose != GL_FALSE)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *program = context->getCurrentProgram();
-
-            if (!program)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = program->getProgramBinary();
-            if (!programBinary)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary->setUniformMatrix2fv(location, count, value))
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
-    EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat* value = 0x%0.8p)",
-          location, count, transpose, value);
-
-    try
-    {
-        if (count < 0 || transpose != GL_FALSE)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *program = context->getCurrentProgram();
-
-            if (!program)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = program->getProgramBinary();
-            if (!programBinary)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary->setUniformMatrix3fv(location, count, value))
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
-    EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat* value = 0x%0.8p)",
-          location, count, transpose, value);
-
-    try
-    {
-        if (count < 0 || transpose != GL_FALSE)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *program = context->getCurrentProgram();
-
-            if (!program)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = program->getProgramBinary();
-            if (!programBinary)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary->setUniformMatrix4fv(location, count, value))
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glUseProgram(GLuint program)
-{
-    EVENT("(GLuint program = %d)", program);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context->getProgram(program);
-
-            if (!programObject && program != 0)
-            {
-                if (context->getShader(program))
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-            }
-
-            if (program != 0 && !programObject->getProgramBinary())
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            context->useProgram(program);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glValidateProgram(GLuint program)
-{
-    EVENT("(GLuint program = %d)", program);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context->getProgram(program);
-
-            if (!programObject)
-            {
-                if (context->getShader(program))
-                {
-                    return error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return error(GL_INVALID_VALUE);
-                }
-            }
-
-            programObject->validate();
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glVertexAttrib1f(GLuint index, GLfloat x)
-{
-    EVENT("(GLuint index = %d, GLfloat x = %f)", index, x);
-
-    try
-    {
-        if (index >= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            GLfloat vals[4] = { x, 0, 0, 1 };
-            context->setVertexAttrib(index, vals);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glVertexAttrib1fv(GLuint index, const GLfloat* values)
-{
-    EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
-
-    try
-    {
-        if (index >= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            GLfloat vals[4] = { values[0], 0, 0, 1 };
-            context->setVertexAttrib(index, vals);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
-{
-    EVENT("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f)", index, x, y);
-
-    try
-    {
-        if (index >= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            GLfloat vals[4] = { x, y, 0, 1 };
-            context->setVertexAttrib(index, vals);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glVertexAttrib2fv(GLuint index, const GLfloat* values)
-{
-    EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
-
-    try
-    {
-        if (index >= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            GLfloat vals[4] = { values[0], values[1], 0, 1 };
-            context->setVertexAttrib(index, vals);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
-    EVENT("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", index, x, y, z);
-
-    try
-    {
-        if (index >= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            GLfloat vals[4] = { x, y, z, 1 };
-            context->setVertexAttrib(index, vals);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glVertexAttrib3fv(GLuint index, const GLfloat* values)
-{
-    EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
-
-    try
-    {
-        if (index >= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            GLfloat vals[4] = { values[0], values[1], values[2], 1 };
-            context->setVertexAttrib(index, vals);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
-    EVENT("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f, GLfloat w = %f)", index, x, y, z, w);
-
-    try
-    {
-        if (index >= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            GLfloat vals[4] = { x, y, z, w };
-            context->setVertexAttrib(index, vals);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glVertexAttrib4fv(GLuint index, const GLfloat* values)
-{
-    EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
-
-    try
-    {
-        if (index >= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setVertexAttrib(index, values);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glVertexAttribDivisorANGLE(GLuint index, GLuint divisor)
-{
-    EVENT("(GLuint index = %d, GLuint divisor = %d)", index, divisor);
-
-    try
-    {
-        if (index >= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setVertexAttribDivisor(index, divisor);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr)
-{
-    EVENT("(GLuint index = %d, GLint size = %d, GLenum type = 0x%X, "
-          "GLboolean normalized = %d, GLsizei stride = %d, const GLvoid* ptr = 0x%0.8p)",
-          index, size, type, normalized, stride, ptr);
-
-    try
-    {
-        if (index >= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (size < 1 || size > 4)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        switch (type)
-        {
-          case GL_BYTE:
-          case GL_UNSIGNED_BYTE:
-          case GL_SHORT:
-          case GL_UNSIGNED_SHORT:
-          case GL_FIXED:
-          case GL_FLOAT:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        if (stride < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setVertexAttribState(index, context->getArrayBuffer(), size, type, (normalized == GL_TRUE), stride, ptr);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
-    EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width, height);
-
-    try
-    {
-        if (width < 0 || height < 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context->setViewportParams(x, y, width, height);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
-                                      GLbitfield mask, GLenum filter)
-{
-    EVENT("(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, "
-          "GLint dstX0 = %d, GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, "
-          "GLbitfield mask = 0x%X, GLenum filter = 0x%X)",
-          srcX0, srcY0, srcX1, srcX1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-
-    try
-    {
-        switch (filter)
-        {
-          case GL_NEAREST:
-            break;
-          default:
-            return error(GL_INVALID_ENUM);
-        }
-
-        if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)) != 0)
-        {
-            return error(GL_INVALID_VALUE);
-        }
-
-        if (srcX1 - srcX0 != dstX1 - dstX0 || srcY1 - srcY0 != dstY1 - dstY0)
-        {
-            ERR("Scaling and flipping in BlitFramebufferANGLE not supported by this implementation");
-            return error(GL_INVALID_OPERATION);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context->getReadFramebufferHandle() == context->getDrawFramebufferHandle())
-            {
-                ERR("Blits with the same source and destination framebuffer are not supported by this implementation.");
-                return error(GL_INVALID_OPERATION);
-            }
-
-            context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth,
-                               GLint border, GLenum format, GLenum type, const GLvoid* pixels)
-{
-    EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, "
-          "GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, GLint border = %d, "
-          "GLenum format = 0x%X, GLenum type = 0x%x, const GLvoid* pixels = 0x%0.8p)",
-          target, level, internalformat, width, height, depth, border, format, type, pixels);
-
-    try
-    {
-        UNIMPLEMENTED();   // FIXME
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, 
-                                     GLenum *binaryFormat, void *binary)
-{
-    EVENT("(GLenum program = 0x%X, bufSize = %s, length = 0x%0.8p, binaryFormat = 0x%0.8p, binary = 0x%0.8p)",
-          program, bufSize, length, binaryFormat, binary);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context->getProgram(program);
-
-            if (!programObject)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = programObject->getProgramBinary();
-
-            if (!programBinary)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            *binaryFormat = GL_PROGRAM_BINARY_ANGLE;
-
-            if (length)
-            {
-                *length = 0;
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-void __stdcall glProgramBinaryOES(GLuint program, GLenum binaryFormat,
-                                  const void *binary, GLint length)
-{
-    EVENT("(GLenum program = 0x%X, binaryFormat = 0x%x, binary = 0x%0.8p, length = %d)",
-          program, binaryFormat, binary, length);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (binaryFormat != GL_PROGRAM_BINARY_ANGLE)
-            {
-                return error(GL_INVALID_ENUM);
-            }
-
-            gl::Program *programObject = context->getProgram(program);
-
-            if (!programObject)
-            {
-                return error(GL_INVALID_OPERATION);
-            }
-
-            programObject->setProgramBinary(NULL);
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY);
-    }
-}
-
-__eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char *procname)
-{
-    struct Extension
-    {
-        const char *name;
-        __eglMustCastToProperFunctionPointerType address;
-    };
-
-    static const Extension glExtensions[] =
-    {
-        {"glTexImage3DOES", (__eglMustCastToProperFunctionPointerType)glTexImage3DOES},
-        {"glBlitFramebufferANGLE", (__eglMustCastToProperFunctionPointerType)glBlitFramebufferANGLE},
-        {"glRenderbufferStorageMultisampleANGLE", (__eglMustCastToProperFunctionPointerType)glRenderbufferStorageMultisampleANGLE},
-        {"glDeleteFencesNV", (__eglMustCastToProperFunctionPointerType)glDeleteFencesNV},
-        {"glGenFencesNV", (__eglMustCastToProperFunctionPointerType)glGenFencesNV},
-        {"glIsFenceNV", (__eglMustCastToProperFunctionPointerType)glIsFenceNV},
-        {"glTestFenceNV", (__eglMustCastToProperFunctionPointerType)glTestFenceNV},
-        {"glGetFenceivNV", (__eglMustCastToProperFunctionPointerType)glGetFenceivNV},
-        {"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},
-        {"glVertexAttribDivisorANGLE", (__eglMustCastToProperFunctionPointerType)glVertexAttribDivisorANGLE},
-        {"glDrawArraysInstancedANGLE", (__eglMustCastToProperFunctionPointerType)glDrawArraysInstancedANGLE},
-        {"glDrawElementsInstancedANGLE", (__eglMustCastToProperFunctionPointerType)glDrawElementsInstancedANGLE},
-        {"glGetProgramBinaryOES", (__eglMustCastToProperFunctionPointerType)glGetProgramBinaryOES},
-        {"glProgramBinaryOES", (__eglMustCastToProperFunctionPointerType)glProgramBinaryOES},    };
-
-    for (int ext = 0; ext < sizeof(glExtensions) / sizeof(Extension); ext++)
-    {
-        if (strcmp(procname, glExtensions[ext].name) == 0)
-        {
-            return (__eglMustCastToProperFunctionPointerType)glExtensions[ext].address;
-        }
-    }
-
-    return NULL;
-}
-
-// Non-public functions used by EGL
-
-bool __stdcall glBindTexImage(egl::Surface *surface)
-{
-    EVENT("(egl::Surface* surface = 0x%0.8p)",
-          surface);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Texture2D *textureObject = context->getTexture2D();
-
-            if (textureObject->isImmutable())
-            {
-                return false;
-            }
-
-            if (textureObject)
-            {
-                textureObject->bindTexImage(surface);
-            }
-        }
-    }
-    catch(std::bad_alloc&)
-    {
-        return error(GL_OUT_OF_MEMORY, false);
-    }
-
-    return true;
-}
-
-}
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.def b/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.def
deleted file mode 100644
index ea7769b..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.def
+++ /dev/null
@@ -1,180 +0,0 @@
-LIBRARY libGLESv2
-EXPORTS
-    glActiveTexture                 @1
-    glAttachShader                  @2
-    glBindAttribLocation            @3
-    glBindBuffer                    @4
-    glBindFramebuffer               @5
-    glBindRenderbuffer              @6
-    glBindTexture                   @7
-    glBlendColor                    @8
-    glBlendEquation                 @9
-    glBlendEquationSeparate         @10
-    glBlendFunc                     @11
-    glBlendFuncSeparate             @12
-    glBufferData                    @13
-    glBufferSubData                 @14
-    glCheckFramebufferStatus        @15
-    glClear                         @16
-    glClearColor                    @17
-    glClearDepthf                   @18
-    glClearStencil                  @19
-    glColorMask                     @20
-    glCompileShader                 @21
-    glCompressedTexImage2D          @22
-    glCompressedTexSubImage2D       @23
-    glCopyTexImage2D                @24
-    glCopyTexSubImage2D             @25
-    glCreateProgram                 @26
-    glCreateShader                  @27
-    glCullFace                      @28
-    glDeleteBuffers                 @29
-    glDeleteFramebuffers            @30
-    glDeleteProgram                 @32
-    glDeleteRenderbuffers           @33
-    glDeleteShader                  @34
-    glDeleteTextures                @31
-    glDepthFunc                     @36
-    glDepthMask                     @37
-    glDepthRangef                   @38
-    glDetachShader                  @35
-    glDisable                       @39
-    glDisableVertexAttribArray      @40
-    glDrawArrays                    @41
-    glDrawElements                  @42
-    glEnable                        @43
-    glEnableVertexAttribArray       @44
-    glFinish                        @45
-    glFlush                         @46
-    glFramebufferRenderbuffer       @47
-    glFramebufferTexture2D          @48
-    glFrontFace                     @49
-    glGenBuffers                    @50
-    glGenFramebuffers               @52
-    glGenRenderbuffers              @53
-    glGenTextures                   @54
-    glGenerateMipmap                @51
-    glGetActiveAttrib               @55
-    glGetActiveUniform              @56
-    glGetAttachedShaders            @57
-    glGetAttribLocation             @58
-    glGetBooleanv                   @59
-    glGetBufferParameteriv          @60
-    glGetError                      @61
-    glGetFloatv                     @62
-    glGetFramebufferAttachmentParameteriv   @63
-    glGetIntegerv                   @64
-    glGetProgramInfoLog             @66
-    glGetProgramiv                  @65
-    glGetRenderbufferParameteriv    @67
-    glGetShaderInfoLog              @69
-    glGetShaderPrecisionFormat      @70
-    glGetShaderSource               @71
-    glGetShaderiv                   @68
-    glGetString                     @72
-    glGetTexParameterfv             @73
-    glGetTexParameteriv             @74
-    glGetUniformLocation            @77
-    glGetUniformfv                  @75
-    glGetUniformiv                  @76
-    glGetVertexAttribPointerv       @80
-    glGetVertexAttribfv             @78
-    glGetVertexAttribiv             @79
-    glHint                          @81
-    glIsBuffer                      @82
-    glIsEnabled                     @83
-    glIsFramebuffer                 @84
-    glIsProgram                     @85
-    glIsRenderbuffer                @86
-    glIsShader                      @87
-    glIsTexture                     @88
-    glLineWidth                     @89
-    glLinkProgram                   @90
-    glPixelStorei                   @91
-    glPolygonOffset                 @92
-    glReadPixels                    @93
-    glReleaseShaderCompiler         @94
-    glRenderbufferStorage           @95
-    glSampleCoverage                @96
-    glScissor                       @97
-    glShaderBinary                  @98
-    glShaderSource                  @99
-    glStencilFunc                   @100
-    glStencilFuncSeparate           @101
-    glStencilMask                   @102
-    glStencilMaskSeparate           @103
-    glStencilOp                     @104
-    glStencilOpSeparate             @105
-    glTexImage2D                    @106
-    glTexParameterf                 @107
-    glTexParameterfv                @108
-    glTexParameteri                 @109
-    glTexParameteriv                @110
-    glTexSubImage2D                 @111
-    glUniform1f                     @112
-    glUniform1fv                    @113
-    glUniform1i                     @114
-    glUniform1iv                    @115
-    glUniform2f                     @116
-    glUniform2fv                    @117
-    glUniform2i                     @118
-    glUniform2iv                    @119
-    glUniform3f                     @120
-    glUniform3fv                    @121
-    glUniform3i                     @122
-    glUniform3iv                    @123
-    glUniform4f                     @124
-    glUniform4fv                    @125
-    glUniform4i                     @126
-    glUniform4iv                    @127
-    glUniformMatrix2fv              @128
-    glUniformMatrix3fv              @129
-    glUniformMatrix4fv              @130
-    glUseProgram                    @131
-    glValidateProgram               @132
-    glVertexAttrib1f                @133
-    glVertexAttrib1fv               @134
-    glVertexAttrib2f                @135
-    glVertexAttrib2fv               @136
-    glVertexAttrib3f                @137
-    glVertexAttrib3fv               @138
-    glVertexAttrib4f                @139
-    glVertexAttrib4fv               @140
-    glVertexAttribPointer           @141
-    glViewport                      @142
-
-    ; Extensions
-    glTexImage3DOES                 @143
-    glBlitFramebufferANGLE          @149
-    glRenderbufferStorageMultisampleANGLE @150
-    glDeleteFencesNV                @151
-    glFinishFenceNV                 @152
-    glGenFencesNV                   @153
-    glGetFenceivNV                  @154
-    glIsFenceNV                     @155
-    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
-    glVertexAttribDivisorANGLE      @172
-    glDrawArraysInstancedANGLE      @173
-    glDrawElementsInstancedANGLE    @174
-
-    ; EGL dependencies
-    glCreateContext                 @144 NONAME
-    glDestroyContext                @145 NONAME
-    glMakeCurrent                   @146 NONAME
-    glGetCurrentContext             @147 NONAME
-    glGetProcAddress                @148 NONAME
-    glBindTexImage                  @158 NONAME
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.rc b/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.rc
deleted file mode 100644
index 0ad21e4..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.rc
+++ /dev/null
@@ -1,102 +0,0 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include <windows.h>
-#include "../common/version.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE 
-BEGIN
-    "resource.h\0"
-END
-
-2 TEXTINCLUDE 
-BEGIN
-    "#include ""afxres.h""\r\n"
-    "#include ""../common/version.h""\0"
-END
-
-3 TEXTINCLUDE 
-BEGIN
-    "\r\n"
-    "\0"
-END
-
-#endif    // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
- PRODUCTVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040904b0"
-        BEGIN
-            VALUE "FileDescription", "ANGLE libGLESv2 Dynamic Link Library"
-            VALUE "FileVersion", VERSION_STRING
-            VALUE "InternalName", "libGLESv2"
-            VALUE "LegalCopyright", "Copyright (C) 2011 Google Inc."
-            VALUE "OriginalFilename", "libGLESv2.dll"
-            VALUE "PrivateBuild", VERSION_STRING
-            VALUE "ProductName", "ANGLE libGLESv2 Dynamic Link Library"
-            VALUE "ProductVersion", VERSION_STRING
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x409, 1200
-    END
-END
-
-#endif    // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif    // not APSTUDIO_INVOKED
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.vcproj b/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.vcproj
deleted file mode 100644
index d97d4e9..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.vcproj
+++ /dev/null
@@ -1,561 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="9.00"
-	Name="libGLESv2"
-	ProjectGUID="{B5871A7A-968C-42E3-A33B-981E6F448E78}"
-	RootNamespace="libGLESv2"
-	Keyword="Win32Proj"
-	TargetFrameworkVersion="131072"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-		<Platform
-			Name="x64"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			CharacterSet="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="$(ProjectDir)/..; $(ProjectDir)/../../include"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGLESV2_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="0"
-				WarningLevel="4"
-				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702"
-				Detect64BitPortabilityProblems="false"
-				DebugInformationFormat="4"
-				WarnAsError="true"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/SAFESEH"
-				AdditionalDependencies="d3d9.lib D3dx9.lib d3dcompiler.lib"
-				LinkIncremental="2"
-				ModuleDefinitionFile="libGLESv2.def"
-				GenerateDebugInformation="true"
-				SubSystem="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="@echo on&#x0D;&#x0A;mkdir &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libGLESv2.dll&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libGLESv2.lib&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;@echo off&#x0D;&#x0A;"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			CharacterSet="1"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="2"
-				AdditionalIncludeDirectories="$(ProjectDir)/..; $(ProjectDir)/../../include"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGLESV2_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0"
-				RuntimeLibrary="0"
-				UsePrecompiledHeader="0"
-				WarningLevel="4"
-				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702;4718"
-				Detect64BitPortabilityProblems="false"
-				DebugInformationFormat="3"
-				WarnAsError="true"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/SAFESEH"
-				AdditionalDependencies="d3d9.lib D3dx9.lib d3dcompiler.lib"
-				LinkIncremental="1"
-				IgnoreAllDefaultLibraries="false"
-				ModuleDefinitionFile="libGLESv2.def"
-				GenerateDebugInformation="true"
-				SubSystem="2"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="@echo on&#x0D;&#x0A;mkdir &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libGLESv2.dll&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libGLESv2.lib&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;@echo off&#x0D;&#x0A;"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug|x64"
-			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="2"
-			CharacterSet="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				TargetEnvironment="3"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="$(ProjectDir)/..; $(ProjectDir)/../../include"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGLESV2_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="0"
-				WarningLevel="4"
-				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702;4718"
-				Detect64BitPortabilityProblems="false"
-				DebugInformationFormat="3"
-				WarnAsError="true"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/SAFESEH"
-				AdditionalDependencies="d3d9.lib D3dx9.lib d3dcompiler.lib"
-				LinkIncremental="2"
-				ModuleDefinitionFile="libGLESv2.def"
-				GenerateDebugInformation="true"
-				SubSystem="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="17"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="@echo on&#x0D;&#x0A;mkdir &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libGLESv2.dll&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libGLESv2.lib&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;@echo off&#x0D;&#x0A;"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|x64"
-			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="2"
-			CharacterSet="1"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				TargetEnvironment="3"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="2"
-				AdditionalIncludeDirectories="$(ProjectDir)/..; $(ProjectDir)/../../include"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGLESV2_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0"
-				RuntimeLibrary="0"
-				UsePrecompiledHeader="0"
-				WarningLevel="4"
-				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702;4718"
-				Detect64BitPortabilityProblems="false"
-				DebugInformationFormat="3"
-				WarnAsError="true"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/SAFESEH"
-				AdditionalDependencies="d3d9.lib D3dx9.lib d3dcompiler.lib"
-				LinkIncremental="1"
-				IgnoreAllDefaultLibraries="false"
-				ModuleDefinitionFile="libGLESv2.def"
-				GenerateDebugInformation="true"
-				SubSystem="2"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="17"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="@echo on&#x0D;&#x0A;mkdir &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libGLESv2.dll&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;copy &quot;$(OutDir)\libGLESv2.lib&quot; &quot;$(ProjectDir)..\..\lib\$(ConfigurationName)\&quot;&#x0D;&#x0A;@echo off&#x0D;&#x0A;"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<File
-				RelativePath=".\Blit.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Buffer.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Context.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\common\debug.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Fence.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Framebuffer.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\HandleAllocator.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\IndexDataManager.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\libGLESv2.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\main.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Program.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\ProgramBinary.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Query.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\common\RefCountObject.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Renderbuffer.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\ResourceManager.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Shader.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Texture.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\utilities.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\VertexDataManager.cpp"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<File
-				RelativePath=".\Blit.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Buffer.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Context.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Fence.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Framebuffer.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\GLES2\gl2.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\GLES2\gl2ext.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\GLES2\gl2platform.h"
-				>
-			</File>
-			<File
-				RelativePath=".\HandleAllocator.h"
-				>
-			</File>
-			<File
-				RelativePath=".\IndexDataManager.h"
-				>
-			</File>
-			<File
-				RelativePath=".\main.h"
-				>
-			</File>
-			<File
-				RelativePath=".\mathutil.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Program.h"
-				>
-			</File>
-			<File
-				RelativePath=".\ProgramBinary.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Query.h"
-				>
-			</File>
-			<File
-				RelativePath="..\common\RefCountObject.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Renderbuffer.h"
-				>
-			</File>
-			<File
-				RelativePath=".\resource.h"
-				>
-			</File>
-			<File
-				RelativePath=".\ResourceManager.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Shader.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Texture.h"
-				>
-			</File>
-			<File
-				RelativePath=".\utilities.h"
-				>
-			</File>
-			<File
-				RelativePath="..\common\version.h"
-				>
-			</File>
-			<File
-				RelativePath=".\vertexconversion.h"
-				>
-			</File>
-			<File
-				RelativePath=".\VertexDataManager.h"
-				>
-			</File>
-		</Filter>
-		<File
-			RelativePath=".\libGLESv2.def"
-			>
-		</File>
-		<File
-			RelativePath=".\libGLESv2.rc"
-			>
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/main.cpp b/Source/ThirdParty/ANGLE/src/libGLESv2/main.cpp
deleted file mode 100644
index 154d277..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/main.cpp
+++ /dev/null
@@ -1,176 +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.
-//
-
-// main.cpp: DLL entry point and management of thread-local data.
-
-#include "libGLESv2/main.h"
-#include "libGLESv2/utilities.h"
-
-#include "common/debug.h"
-#include "libEGL/Surface.h"
-
-#include "libGLESv2/Framebuffer.h"
-
-static DWORD currentTLS = TLS_OUT_OF_INDEXES;
-
-BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
-{
-    switch (reason)
-    {
-      case DLL_PROCESS_ATTACH:
-        {
-            currentTLS = TlsAlloc();
-
-            if (currentTLS == TLS_OUT_OF_INDEXES)
-            {
-                return FALSE;
-            }
-        }
-        // Fall throught to initialize index
-      case DLL_THREAD_ATTACH:
-        {
-            gl::Current *current = (gl::Current*)LocalAlloc(LPTR, sizeof(gl::Current));
-
-            if (current)
-            {
-                TlsSetValue(currentTLS, current);
-
-                current->context = NULL;
-                current->display = NULL;
-            }
-        }
-        break;
-      case DLL_THREAD_DETACH:
-        {
-            void *current = TlsGetValue(currentTLS);
-
-            if (current)
-            {
-                LocalFree((HLOCAL)current);
-            }
-        }
-        break;
-      case DLL_PROCESS_DETACH:
-        {
-            void *current = TlsGetValue(currentTLS);
-
-            if (current)
-            {
-                LocalFree((HLOCAL)current);
-            }
-
-            TlsFree(currentTLS);
-        }
-        break;
-      default:
-        break;
-    }
-
-    return TRUE;
-}
-
-namespace gl
-{
-void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface)
-{
-    Current *current = (Current*)TlsGetValue(currentTLS);
-
-    current->context = context;
-    current->display = display;
-
-    if (context && display && surface)
-    {
-        context->makeCurrent(display, surface);
-    }
-}
-
-Context *getContext()
-{
-    Current *current = (Current*)TlsGetValue(currentTLS);
-
-    return current->context;
-}
-
-Context *getNonLostContext()
-{
-    Context *context = getContext();
-    
-    if (context)
-    {
-        if (context->isContextLost())
-        {
-            error(GL_OUT_OF_MEMORY);
-            return NULL;
-        }
-        else
-        {
-            return context;
-        }
-    }
-    return NULL;
-}
-
-egl::Display *getDisplay()
-{
-    Current *current = (Current*)TlsGetValue(currentTLS);
-
-    return current->display;
-}
-
-IDirect3DDevice9 *getDevice()
-{
-    egl::Display *display = getDisplay();
-
-    return display->getDevice();
-}
-
-bool checkDeviceLost(HRESULT errorCode)
-{
-    egl::Display *display = NULL;
-
-    if (isDeviceLostError(errorCode))
-    {
-        display = gl::getDisplay();
-        display->notifyDeviceLost();
-        return true;
-    }
-    return false;
-}
-}
-
-// Records an error code
-void error(GLenum errorCode)
-{
-    gl::Context *context = glGetCurrentContext();
-
-    if (context)
-    {
-        switch (errorCode)
-        {
-          case GL_INVALID_ENUM:
-            context->recordInvalidEnum();
-            TRACE("\t! Error generated: invalid enum\n");
-            break;
-          case GL_INVALID_VALUE:
-            context->recordInvalidValue();
-            TRACE("\t! Error generated: invalid value\n");
-            break;
-          case GL_INVALID_OPERATION:
-            context->recordInvalidOperation();
-            TRACE("\t! Error generated: invalid operation\n");
-            break;
-          case GL_OUT_OF_MEMORY:
-            context->recordOutOfMemory();
-            TRACE("\t! Error generated: out of memory\n");
-            break;
-          case GL_INVALID_FRAMEBUFFER_OPERATION:
-            context->recordInvalidFramebufferOperation();
-            TRACE("\t! Error generated: invalid framebuffer operation\n");
-            break;
-          default: UNREACHABLE();
-        }
-    }
-}
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/main.h b/Source/ThirdParty/ANGLE/src/libGLESv2/main.h
deleted file mode 100644
index 504848a..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/main.h
+++ /dev/null
@@ -1,50 +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.
-//
-
-// main.h: Management of thread-local data.
-
-#ifndef LIBGLESV2_MAIN_H_
-#define LIBGLESV2_MAIN_H_
-
-#define GL_APICALL
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include "common/debug.h"
-#include "libEGL/Display.h"
-
-#include "libGLESv2/Context.h"
-
-namespace gl
-{
-struct Current
-{
-    Context *context;
-    egl::Display *display;
-};
-
-void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface);
-
-Context *getContext();
-Context *getNonLostContext();
-egl::Display *getDisplay();
-
-IDirect3DDevice9 *getDevice();
-
-bool checkDeviceLost(HRESULT errorCode);
-}
-
-void error(GLenum errorCode);
-
-template<class T>
-const T &error(GLenum errorCode, const T &returnValue)
-{
-    error(errorCode);
-
-    return returnValue;
-}
-
-#endif   // LIBGLESV2_MAIN_H_
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/mathutil.h b/Source/ThirdParty/ANGLE/src/libGLESv2/mathutil.h
deleted file mode 100644
index 7bb2250..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/mathutil.h
+++ /dev/null
@@ -1,99 +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.
-//
-
-// mathutil.h: Math and bit manipulation functions.
-
-#ifndef LIBGLESV2_MATHUTIL_H_
-#define LIBGLESV2_MATHUTIL_H_
-
-#include <intrin.h>
-#include <math.h>
-#include <windows.h>
-
-namespace gl
-{
-inline bool isPow2(int x)
-{
-    return (x & (x - 1)) == 0 && (x != 0);
-}
-
-inline int log2(int x)
-{
-    int r = 0;
-    while ((x >> r) > 1) r++;
-    return r;
-}
-
-inline unsigned int ceilPow2(unsigned int x)
-{
-    if (x != 0) x--;
-    x |= x >> 1;
-    x |= x >> 2;
-    x |= x >> 4;
-    x |= x >> 8;
-    x |= x >> 16;
-    x++;
-
-    return x;
-}
-
-template<typename T, typename MIN, typename MAX>
-inline T clamp(T x, MIN min, MAX max)
-{
-    return x < min ? min : (x > max ? max : x);
-}
-
-inline float clamp01(float x)
-{
-    return clamp(x, 0.0f, 1.0f);
-}
-
-template<const int n>
-inline unsigned int unorm(float x)
-{
-    const unsigned int max = 0xFFFFFFFF >> (32 - n);
-
-    if (x > 1)
-    {
-        return max;
-    }
-    else if (x < 0)
-    {
-        return 0;
-    }
-    else
-    {
-        return (unsigned int)(max * x + 0.5f);
-    }
-}
-
-inline bool supportsSSE2()
-{
-    static bool checked = false;
-    static bool supports = false;
-
-    if (checked)
-    {
-        return supports;
-    }
-
-    int info[4];
-    __cpuid(info, 0);
-    
-    if (info[0] >= 1)
-    {
-        __cpuid(info, 1);
-
-        supports = (info[3] >> 26) & 1;
-    }
-
-    checked = true;
-
-    return supports;
-}
-}
-
-#endif   // LIBGLESV2_MATHUTIL_H_
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/resource.h b/Source/ThirdParty/ANGLE/src/libGLESv2/resource.h
deleted file mode 100644
index 39adaad..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/resource.h
+++ /dev/null
@@ -1,14 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by libGLESv2.rc
-
-// Next default values for new objects
-// 
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        101
-#define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1001
-#define _APS_NEXT_SYMED_VALUE           101
-#endif
-#endif
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/utilities.cpp b/Source/ThirdParty/ANGLE/src/libGLESv2/utilities.cpp
deleted file mode 100644
index a7c62d9..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/utilities.cpp
+++ /dev/null
@@ -1,1035 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// utilities.cpp: Conversion functions and other utility routines.
-
-#include "libGLESv2/utilities.h"
-
-#include <limits>
-#include <stdio.h>
-#include <windows.h>
-
-#include "common/debug.h"
-
-#include "libGLESv2/mathutil.h"
-#include "libGLESv2/Context.h"
-
-namespace gl
-{
-
-// This is how much data the application expects for a uniform
-int UniformExternalComponentCount(GLenum type)
-{
-    switch (type)
-    {
-      case GL_BOOL:
-      case GL_FLOAT:
-      case GL_INT:
-      case GL_SAMPLER_2D:
-      case GL_SAMPLER_CUBE:
-          return 1;
-      case GL_BOOL_VEC2:
-      case GL_FLOAT_VEC2:
-      case GL_INT_VEC2:
-          return 2;
-      case GL_INT_VEC3:
-      case GL_FLOAT_VEC3:
-      case GL_BOOL_VEC3:
-          return 3;
-      case GL_BOOL_VEC4:
-      case GL_FLOAT_VEC4:
-      case GL_INT_VEC4:
-      case GL_FLOAT_MAT2:
-          return 4;
-      case GL_FLOAT_MAT3:
-          return 9;
-      case GL_FLOAT_MAT4:
-          return 16;
-      default:
-          UNREACHABLE();
-    }
-
-    return 0;
-}
-
-// This is how much data we actually store for a uniform
-int UniformInternalComponentCount(GLenum type)
-{
-    switch (type)
-    {
-      case GL_BOOL:
-      case GL_INT:
-      case GL_SAMPLER_2D:
-      case GL_SAMPLER_CUBE:
-          return 1;
-      case GL_BOOL_VEC2:
-      case GL_INT_VEC2:
-          return 2;
-      case GL_INT_VEC3:
-      case GL_BOOL_VEC3:
-          return 3;
-      case GL_FLOAT:
-      case GL_FLOAT_VEC2:
-      case GL_FLOAT_VEC3:
-      case GL_BOOL_VEC4:
-      case GL_FLOAT_VEC4:
-      case GL_INT_VEC4:
-          return 4;
-      case GL_FLOAT_MAT2:
-          return 8;
-      case GL_FLOAT_MAT3:
-          return 12;
-      case GL_FLOAT_MAT4:
-          return 16;
-      default:
-          UNREACHABLE();
-    }
-
-    return 0;
-}
-
-GLenum UniformComponentType(GLenum type)
-{
-    switch(type)
-    {
-      case GL_BOOL:
-      case GL_BOOL_VEC2:
-      case GL_BOOL_VEC3:
-      case GL_BOOL_VEC4:
-          return GL_BOOL;
-      case GL_FLOAT:
-      case GL_FLOAT_VEC2:
-      case GL_FLOAT_VEC3:
-      case GL_FLOAT_VEC4:
-      case GL_FLOAT_MAT2:
-      case GL_FLOAT_MAT3:
-      case GL_FLOAT_MAT4:
-          return GL_FLOAT;
-      case GL_INT:
-      case GL_SAMPLER_2D:
-      case GL_SAMPLER_CUBE:
-      case GL_INT_VEC2:
-      case GL_INT_VEC3:
-      case GL_INT_VEC4:
-          return GL_INT;
-      default:
-          UNREACHABLE();
-    }
-
-    return GL_NONE;
-}
-
-size_t UniformComponentSize(GLenum type)
-{
-    switch(type)
-    {
-      case GL_BOOL:  return sizeof(GLint);
-      case GL_FLOAT: return sizeof(GLfloat);
-      case GL_INT:   return sizeof(GLint);
-      default:       UNREACHABLE();
-    }
-
-    return 0;
-}
-
-size_t UniformInternalSize(GLenum type)
-{
-    return UniformComponentSize(UniformComponentType(type)) * UniformInternalComponentCount(type);
-}
-
-size_t UniformExternalSize(GLenum type)
-{
-    return UniformComponentSize(UniformComponentType(type)) * UniformExternalComponentCount(type);
-}
-
-int VariableRowCount(GLenum type)
-{
-    switch (type)
-    {
-      case GL_NONE:
-        return 0;
-      case GL_BOOL:
-      case GL_FLOAT:
-      case GL_INT:
-      case GL_BOOL_VEC2:
-      case GL_FLOAT_VEC2:
-      case GL_INT_VEC2:
-      case GL_INT_VEC3:
-      case GL_FLOAT_VEC3:
-      case GL_BOOL_VEC3:
-      case GL_BOOL_VEC4:
-      case GL_FLOAT_VEC4:
-      case GL_INT_VEC4:
-        return 1;
-      case GL_FLOAT_MAT2:
-        return 2;
-      case GL_FLOAT_MAT3:
-        return 3;
-      case GL_FLOAT_MAT4:
-        return 4;
-      default:
-        UNREACHABLE();
-    }
-
-    return 0;
-}
-
-int VariableColumnCount(GLenum type)
-{
-    switch (type)
-    {
-      case GL_NONE:
-        return 0;
-      case GL_BOOL:
-      case GL_FLOAT:
-      case GL_INT:
-        return 1;
-      case GL_BOOL_VEC2:
-      case GL_FLOAT_VEC2:
-      case GL_INT_VEC2:
-      case GL_FLOAT_MAT2:
-        return 2;
-      case GL_INT_VEC3:
-      case GL_FLOAT_VEC3:
-      case GL_BOOL_VEC3:
-      case GL_FLOAT_MAT3:
-        return 3;
-      case GL_BOOL_VEC4:
-      case GL_FLOAT_VEC4:
-      case GL_INT_VEC4:
-      case GL_FLOAT_MAT4:
-        return 4;
-      default:
-        UNREACHABLE();
-    }
-
-    return 0;
-}
-
-int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize)
-{
-    ASSERT(allocationSize <= bitsSize);
-
-    unsigned int mask = std::numeric_limits<unsigned int>::max() >> (std::numeric_limits<unsigned int>::digits - allocationSize);
-
-    for (unsigned int i = 0; i < bitsSize - allocationSize + 1; i++)
-    {
-        if ((*bits & mask) == 0)
-        {
-            *bits |= mask;
-            return i;
-        }
-
-        mask <<= 1;
-    }
-
-    return -1;
-}
-
-GLsizei ComputePitch(GLsizei width, GLenum format, GLenum type, GLint alignment)
-{
-    ASSERT(alignment > 0 && isPow2(alignment));
-
-    GLsizei rawPitch = ComputePixelSize(format, type) * width;
-    return (rawPitch + alignment - 1) & ~(alignment - 1);
-}
-
-GLsizei ComputeCompressedPitch(GLsizei width, GLenum format)
-{
-    return ComputeCompressedSize(width, 1, format);
-}
-
-GLsizei ComputeCompressedSize(GLsizei width, GLsizei height, GLenum format)
-{
-    switch (format)
-    {
-      case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-      case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-        return 8 * (GLsizei)ceil((float)width / 4.0f) * (GLsizei)ceil((float)height / 4.0f);
-        break;
-      case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
-      case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
-        return 16 * (GLsizei)ceil((float)width / 4.0f) * (GLsizei)ceil((float)height / 4.0f);
-      default:
-        return 0;
-    }
-
-}
-
-bool IsCompressed(GLenum format)
-{
-    if(format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT ||
-       format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT ||
-       format == GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE ||
-       format == GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE)
-    {
-        return true;
-    }
-    else
-    {
-        return false;
-    }
-}
-
-bool IsDepthTexture(GLenum format)
-{
-    if (format == GL_DEPTH_COMPONENT ||
-        format == GL_DEPTH_STENCIL_OES)
-    {
-        return true;
-    }
-
-    return false;
-}
-
-// Returns the size, in bytes, of a single texel in an Image
-int ComputePixelSize(GLenum format, GLenum type)
-{
-    switch (type)
-    {
-      case GL_UNSIGNED_BYTE:
-        switch (format)
-        {
-          case GL_ALPHA:           return sizeof(unsigned char);
-          case GL_LUMINANCE:       return sizeof(unsigned char);
-          case GL_LUMINANCE_ALPHA: return sizeof(unsigned char) * 2;
-          case GL_RGB:             return sizeof(unsigned char) * 3;
-          case GL_RGBA:            return sizeof(unsigned char) * 4;
-          case GL_BGRA_EXT:        return sizeof(unsigned char) * 4;
-          default: UNREACHABLE();
-        }
-        break;
-      case GL_UNSIGNED_SHORT_4_4_4_4:
-      case GL_UNSIGNED_SHORT_5_5_5_1:
-      case GL_UNSIGNED_SHORT_5_6_5:
-      case GL_UNSIGNED_SHORT:
-        return sizeof(unsigned short);
-      case GL_UNSIGNED_INT:
-      case GL_UNSIGNED_INT_24_8_OES:
-        return sizeof(unsigned int);
-      case GL_FLOAT:
-        switch (format)
-        {
-          case GL_ALPHA:           return sizeof(float);
-          case GL_LUMINANCE:       return sizeof(float);
-          case GL_LUMINANCE_ALPHA: return sizeof(float) * 2;
-          case GL_RGB:             return sizeof(float) * 3;
-          case GL_RGBA:            return sizeof(float) * 4;
-          default: UNREACHABLE();
-        }
-        break;
-      case GL_HALF_FLOAT_OES:
-        switch (format)
-        {
-          case GL_ALPHA:           return sizeof(unsigned short);
-          case GL_LUMINANCE:       return sizeof(unsigned short);
-          case GL_LUMINANCE_ALPHA: return sizeof(unsigned short) * 2;
-          case GL_RGB:             return sizeof(unsigned short) * 3;
-          case GL_RGBA:            return sizeof(unsigned short) * 4;
-          default: UNREACHABLE();
-        }
-        break;
-      default: UNREACHABLE();
-    }
-
-    return 0;
-}
-
-bool IsCubemapTextureTarget(GLenum target)
-{
-    return (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z);
-}
-
-bool IsInternalTextureTarget(GLenum target)
-{
-    return target == GL_TEXTURE_2D || IsCubemapTextureTarget(target);
-}
-
-GLenum ExtractFormat(GLenum internalformat)
-{
-    switch (internalformat)
-    {
-      case GL_RGB565:                          return GL_RGB;
-      case GL_RGBA4:                           return GL_RGBA;
-      case GL_RGB5_A1:                         return GL_RGBA;
-      case GL_RGB8_OES:                        return GL_RGB;
-      case GL_RGBA8_OES:                       return GL_RGBA;
-      case GL_LUMINANCE8_ALPHA8_EXT:           return GL_LUMINANCE_ALPHA;
-      case GL_LUMINANCE8_EXT:                  return GL_LUMINANCE;
-      case GL_ALPHA8_EXT:                      return GL_ALPHA;
-      case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:    return GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
-      case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:   return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
-      case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE: return GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE;
-      case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE: return GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE;
-      case GL_RGBA32F_EXT:                     return GL_RGBA;
-      case GL_RGB32F_EXT:                      return GL_RGB;
-      case GL_ALPHA32F_EXT:                    return GL_ALPHA;
-      case GL_LUMINANCE32F_EXT:                return GL_LUMINANCE;
-      case GL_LUMINANCE_ALPHA32F_EXT:          return GL_LUMINANCE_ALPHA;
-      case GL_RGBA16F_EXT:                     return GL_RGBA;
-      case GL_RGB16F_EXT:                      return GL_RGB;
-      case GL_ALPHA16F_EXT:                    return GL_ALPHA;
-      case GL_LUMINANCE16F_EXT:                return GL_LUMINANCE;
-      case GL_LUMINANCE_ALPHA16F_EXT:          return GL_LUMINANCE_ALPHA;
-      case GL_BGRA8_EXT:                       return GL_BGRA_EXT;
-      case GL_DEPTH_COMPONENT16:               return GL_DEPTH_COMPONENT;
-      case GL_DEPTH_COMPONENT32_OES:           return GL_DEPTH_COMPONENT;
-      case GL_DEPTH24_STENCIL8_OES:            return GL_DEPTH_STENCIL_OES;
-      default:                                 return GL_NONE;   // Unsupported
-    }
-}
-
-GLenum ExtractType(GLenum internalformat)
-{
-    switch (internalformat)
-    {
-      case GL_RGB565:                          return GL_UNSIGNED_SHORT_5_6_5;
-      case GL_RGBA4:                           return GL_UNSIGNED_SHORT_4_4_4_4;
-      case GL_RGB5_A1:                         return GL_UNSIGNED_SHORT_5_5_5_1;
-      case GL_RGB8_OES:                        return GL_UNSIGNED_BYTE;
-      case GL_RGBA8_OES:                       return GL_UNSIGNED_BYTE;
-      case GL_LUMINANCE8_ALPHA8_EXT:           return GL_UNSIGNED_BYTE;
-      case GL_LUMINANCE8_EXT:                  return GL_UNSIGNED_BYTE;
-      case GL_ALPHA8_EXT:                      return GL_UNSIGNED_BYTE;
-      case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:    return GL_UNSIGNED_BYTE;
-      case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:   return GL_UNSIGNED_BYTE;
-      case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE: return GL_UNSIGNED_BYTE;
-      case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE: return GL_UNSIGNED_BYTE;
-      case GL_RGBA32F_EXT:                     return GL_FLOAT;
-      case GL_RGB32F_EXT:                      return GL_FLOAT;
-      case GL_ALPHA32F_EXT:                    return GL_FLOAT;
-      case GL_LUMINANCE32F_EXT:                return GL_FLOAT;
-      case GL_LUMINANCE_ALPHA32F_EXT:          return GL_FLOAT;
-      case GL_RGBA16F_EXT:                     return GL_HALF_FLOAT_OES;
-      case GL_RGB16F_EXT:                      return GL_HALF_FLOAT_OES;
-      case GL_ALPHA16F_EXT:                    return GL_HALF_FLOAT_OES;
-      case GL_LUMINANCE16F_EXT:                return GL_HALF_FLOAT_OES;
-      case GL_LUMINANCE_ALPHA16F_EXT:          return GL_HALF_FLOAT_OES;
-      case GL_BGRA8_EXT:                       return GL_UNSIGNED_BYTE;
-      case GL_DEPTH_COMPONENT16:               return GL_UNSIGNED_SHORT;
-      case GL_DEPTH_COMPONENT32_OES:           return GL_UNSIGNED_INT;
-      case GL_DEPTH24_STENCIL8_OES:            return GL_UNSIGNED_INT_24_8_OES;
-      default:                                 return GL_NONE;   // Unsupported
-    }
-}
-
-bool IsColorRenderable(GLenum internalformat)
-{
-    switch (internalformat)
-    {
-      case GL_RGBA4:
-      case GL_RGB5_A1:
-      case GL_RGB565:
-      case GL_RGB8_OES:
-      case GL_RGBA8_OES:
-        return true;
-      case GL_DEPTH_COMPONENT16:
-      case GL_STENCIL_INDEX8:
-      case GL_DEPTH24_STENCIL8_OES:
-        return false;
-      default:
-        UNIMPLEMENTED();
-    }
-
-    return false;
-}
-
-bool IsDepthRenderable(GLenum internalformat)
-{
-    switch (internalformat)
-    {
-      case GL_DEPTH_COMPONENT16:
-      case GL_DEPTH24_STENCIL8_OES:
-        return true;
-      case GL_STENCIL_INDEX8:
-      case GL_RGBA4:
-      case GL_RGB5_A1:
-      case GL_RGB565:
-      case GL_RGB8_OES:
-      case GL_RGBA8_OES:
-        return false;
-      default:
-        UNIMPLEMENTED();
-    }
-
-    return false;
-}
-
-bool IsStencilRenderable(GLenum internalformat)
-{
-    switch (internalformat)
-    {
-      case GL_STENCIL_INDEX8:
-      case GL_DEPTH24_STENCIL8_OES:
-        return true;
-      case GL_RGBA4:
-      case GL_RGB5_A1:
-      case GL_RGB565:
-      case GL_RGB8_OES:
-      case GL_RGBA8_OES:
-      case GL_DEPTH_COMPONENT16:
-        return false;
-      default:
-        UNIMPLEMENTED();
-    }
-
-    return false;
-}
-
-}
-
-namespace es2dx
-{
-
-D3DCMPFUNC ConvertComparison(GLenum comparison)
-{
-    D3DCMPFUNC d3dComp = D3DCMP_ALWAYS;
-    switch (comparison)
-    {
-      case GL_NEVER:    d3dComp = D3DCMP_NEVER;        break;
-      case GL_ALWAYS:   d3dComp = D3DCMP_ALWAYS;       break;
-      case GL_LESS:     d3dComp = D3DCMP_LESS;         break;
-      case GL_LEQUAL:   d3dComp = D3DCMP_LESSEQUAL;    break;
-      case GL_EQUAL:    d3dComp = D3DCMP_EQUAL;        break;
-      case GL_GREATER:  d3dComp = D3DCMP_GREATER;      break;
-      case GL_GEQUAL:   d3dComp = D3DCMP_GREATEREQUAL; break;
-      case GL_NOTEQUAL: d3dComp = D3DCMP_NOTEQUAL;     break;
-      default: UNREACHABLE();
-    }
-
-    return d3dComp;
-}
-
-D3DCOLOR ConvertColor(gl::Color color)
-{
-    return D3DCOLOR_RGBA(gl::unorm<8>(color.red),
-                         gl::unorm<8>(color.green),
-                         gl::unorm<8>(color.blue),
-                         gl::unorm<8>(color.alpha));
-}
-
-D3DBLEND ConvertBlendFunc(GLenum blend)
-{
-    D3DBLEND d3dBlend = D3DBLEND_ZERO;
-
-    switch (blend)
-    {
-      case GL_ZERO:                     d3dBlend = D3DBLEND_ZERO;           break;
-      case GL_ONE:                      d3dBlend = D3DBLEND_ONE;            break;
-      case GL_SRC_COLOR:                d3dBlend = D3DBLEND_SRCCOLOR;       break;
-      case GL_ONE_MINUS_SRC_COLOR:      d3dBlend = D3DBLEND_INVSRCCOLOR;    break;
-      case GL_DST_COLOR:                d3dBlend = D3DBLEND_DESTCOLOR;      break;
-      case GL_ONE_MINUS_DST_COLOR:      d3dBlend = D3DBLEND_INVDESTCOLOR;   break;
-      case GL_SRC_ALPHA:                d3dBlend = D3DBLEND_SRCALPHA;       break;
-      case GL_ONE_MINUS_SRC_ALPHA:      d3dBlend = D3DBLEND_INVSRCALPHA;    break;
-      case GL_DST_ALPHA:                d3dBlend = D3DBLEND_DESTALPHA;      break;
-      case GL_ONE_MINUS_DST_ALPHA:      d3dBlend = D3DBLEND_INVDESTALPHA;   break;
-      case GL_CONSTANT_COLOR:           d3dBlend = D3DBLEND_BLENDFACTOR;    break;
-      case GL_ONE_MINUS_CONSTANT_COLOR: d3dBlend = D3DBLEND_INVBLENDFACTOR; break;
-      case GL_CONSTANT_ALPHA:           d3dBlend = D3DBLEND_BLENDFACTOR;    break;
-      case GL_ONE_MINUS_CONSTANT_ALPHA: d3dBlend = D3DBLEND_INVBLENDFACTOR; break;
-      case GL_SRC_ALPHA_SATURATE:       d3dBlend = D3DBLEND_SRCALPHASAT;    break;
-      default: UNREACHABLE();
-    }
-
-    return d3dBlend;
-}
-
-D3DBLENDOP ConvertBlendOp(GLenum blendOp)
-{
-    D3DBLENDOP d3dBlendOp = D3DBLENDOP_ADD;
-
-    switch (blendOp)
-    {
-      case GL_FUNC_ADD:              d3dBlendOp = D3DBLENDOP_ADD;         break;
-      case GL_FUNC_SUBTRACT:         d3dBlendOp = D3DBLENDOP_SUBTRACT;    break;
-      case GL_FUNC_REVERSE_SUBTRACT: d3dBlendOp = D3DBLENDOP_REVSUBTRACT; break;
-      default: UNREACHABLE();
-    }
-
-    return d3dBlendOp;
-}
-
-D3DSTENCILOP ConvertStencilOp(GLenum stencilOp)
-{
-    D3DSTENCILOP d3dStencilOp = D3DSTENCILOP_KEEP;
-
-    switch (stencilOp)
-    {
-      case GL_ZERO:      d3dStencilOp = D3DSTENCILOP_ZERO;    break;
-      case GL_KEEP:      d3dStencilOp = D3DSTENCILOP_KEEP;    break;
-      case GL_REPLACE:   d3dStencilOp = D3DSTENCILOP_REPLACE; break;
-      case GL_INCR:      d3dStencilOp = D3DSTENCILOP_INCRSAT; break;
-      case GL_DECR:      d3dStencilOp = D3DSTENCILOP_DECRSAT; break;
-      case GL_INVERT:    d3dStencilOp = D3DSTENCILOP_INVERT;  break;
-      case GL_INCR_WRAP: d3dStencilOp = D3DSTENCILOP_INCR;    break;
-      case GL_DECR_WRAP: d3dStencilOp = D3DSTENCILOP_DECR;    break;
-      default: UNREACHABLE();
-    }
-
-    return d3dStencilOp;
-}
-
-D3DTEXTUREADDRESS ConvertTextureWrap(GLenum wrap)
-{
-    D3DTEXTUREADDRESS d3dWrap = D3DTADDRESS_WRAP;
-
-    switch (wrap)
-    {
-      case GL_REPEAT:            d3dWrap = D3DTADDRESS_WRAP;   break;
-      case GL_CLAMP_TO_EDGE:     d3dWrap = D3DTADDRESS_CLAMP;  break;
-      case GL_MIRRORED_REPEAT:   d3dWrap = D3DTADDRESS_MIRROR; break;
-      default: UNREACHABLE();
-    }
-
-    return d3dWrap;
-}
-
-D3DCULL ConvertCullMode(GLenum cullFace, GLenum frontFace)
-{
-    D3DCULL cull = D3DCULL_CCW;
-    switch (cullFace)
-    {
-      case GL_FRONT:
-        cull = (frontFace == GL_CCW ? D3DCULL_CW : D3DCULL_CCW);
-        break;
-      case GL_BACK:
-        cull = (frontFace == GL_CCW ? D3DCULL_CCW : D3DCULL_CW);
-        break;
-      case GL_FRONT_AND_BACK:
-        cull = D3DCULL_NONE; // culling will be handled during draw
-        break;
-      default: UNREACHABLE();
-    }
-
-    return cull;
-}
-
-D3DCUBEMAP_FACES ConvertCubeFace(GLenum cubeFace)
-{
-    D3DCUBEMAP_FACES face = D3DCUBEMAP_FACE_POSITIVE_X;
-
-    switch (cubeFace)
-    {
-      case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
-        face = D3DCUBEMAP_FACE_POSITIVE_X;
-        break;
-      case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
-        face = D3DCUBEMAP_FACE_NEGATIVE_X;
-        break;
-      case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
-        face = D3DCUBEMAP_FACE_POSITIVE_Y;
-        break;
-      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
-        face = D3DCUBEMAP_FACE_NEGATIVE_Y;
-        break;
-      case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
-        face = D3DCUBEMAP_FACE_POSITIVE_Z;
-        break;
-      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
-        face = D3DCUBEMAP_FACE_NEGATIVE_Z;
-        break;
-      default: UNREACHABLE();
-    }
-
-    return face;
-}
-
-DWORD ConvertColorMask(bool red, bool green, bool blue, bool alpha)
-{
-    return (red   ? D3DCOLORWRITEENABLE_RED   : 0) |
-           (green ? D3DCOLORWRITEENABLE_GREEN : 0) |
-           (blue  ? D3DCOLORWRITEENABLE_BLUE  : 0) |
-           (alpha ? D3DCOLORWRITEENABLE_ALPHA : 0);
-}
-
-D3DTEXTUREFILTERTYPE ConvertMagFilter(GLenum magFilter)
-{
-    D3DTEXTUREFILTERTYPE d3dMagFilter = D3DTEXF_POINT;
-    switch (magFilter)
-    {
-      case GL_NEAREST: d3dMagFilter = D3DTEXF_POINT;  break;
-      case GL_LINEAR:  d3dMagFilter = D3DTEXF_LINEAR; break;
-      default: UNREACHABLE();
-    }
-
-    return d3dMagFilter;
-}
-
-void ConvertMinFilter(GLenum minFilter, D3DTEXTUREFILTERTYPE *d3dMinFilter, D3DTEXTUREFILTERTYPE *d3dMipFilter)
-{
-    switch (minFilter)
-    {
-      case GL_NEAREST:
-        *d3dMinFilter = D3DTEXF_POINT;
-        *d3dMipFilter = D3DTEXF_NONE;
-        break;
-      case GL_LINEAR:
-        *d3dMinFilter = D3DTEXF_LINEAR;
-        *d3dMipFilter = D3DTEXF_NONE;
-        break;
-      case GL_NEAREST_MIPMAP_NEAREST:
-        *d3dMinFilter = D3DTEXF_POINT;
-        *d3dMipFilter = D3DTEXF_POINT;
-        break;
-      case GL_LINEAR_MIPMAP_NEAREST:
-        *d3dMinFilter = D3DTEXF_LINEAR;
-        *d3dMipFilter = D3DTEXF_POINT;
-        break;
-      case GL_NEAREST_MIPMAP_LINEAR:
-        *d3dMinFilter = D3DTEXF_POINT;
-        *d3dMipFilter = D3DTEXF_LINEAR;
-        break;
-      case GL_LINEAR_MIPMAP_LINEAR:
-        *d3dMinFilter = D3DTEXF_LINEAR;
-        *d3dMipFilter = D3DTEXF_LINEAR;
-        break;
-      default:
-        *d3dMinFilter = D3DTEXF_POINT;
-        *d3dMipFilter = D3DTEXF_NONE;
-        UNREACHABLE();
-    }
-}
-
-bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount,
-                          D3DPRIMITIVETYPE *d3dPrimitiveType, int *d3dPrimitiveCount)
-{
-    switch (primitiveType)
-    {
-      case GL_POINTS:
-        *d3dPrimitiveType = D3DPT_POINTLIST;
-        *d3dPrimitiveCount = elementCount;
-        break;
-      case GL_LINES:
-        *d3dPrimitiveType = D3DPT_LINELIST;
-        *d3dPrimitiveCount = elementCount / 2;
-        break;
-      case GL_LINE_LOOP:
-        *d3dPrimitiveType = D3DPT_LINESTRIP;
-        *d3dPrimitiveCount = elementCount - 1;   // D3D doesn't support line loops, so we draw the last line separately
-        break;
-      case GL_LINE_STRIP:
-        *d3dPrimitiveType = D3DPT_LINESTRIP;
-        *d3dPrimitiveCount = elementCount - 1;
-        break;
-      case GL_TRIANGLES:
-        *d3dPrimitiveType = D3DPT_TRIANGLELIST;
-        *d3dPrimitiveCount = elementCount / 3;
-        break;
-      case GL_TRIANGLE_STRIP:
-        *d3dPrimitiveType = D3DPT_TRIANGLESTRIP;
-        *d3dPrimitiveCount = elementCount - 2;
-        break;
-      case GL_TRIANGLE_FAN:
-        *d3dPrimitiveType = D3DPT_TRIANGLEFAN;
-        *d3dPrimitiveCount = elementCount - 2;
-        break;
-      default:
-        return false;
-    }
-
-    return true;
-}
-
-D3DFORMAT ConvertRenderbufferFormat(GLenum format)
-{
-    switch (format)
-    {
-      case GL_NONE:                 return D3DFMT_NULL;
-      case GL_RGBA4:
-      case GL_RGB5_A1:
-      case GL_RGBA8_OES:            return D3DFMT_A8R8G8B8;
-      case GL_RGB565:               return D3DFMT_R5G6B5;
-      case GL_RGB8_OES:             return D3DFMT_X8R8G8B8;
-      case GL_DEPTH_COMPONENT16:
-      case GL_STENCIL_INDEX8:       
-      case GL_DEPTH24_STENCIL8_OES: return D3DFMT_D24S8;
-      default: UNREACHABLE();       return D3DFMT_A8R8G8B8;
-    }
-}
-
-D3DMULTISAMPLE_TYPE GetMultisampleTypeFromSamples(GLsizei samples)
-{
-    if (samples <= 1)
-        return D3DMULTISAMPLE_NONE;
-    else
-        return (D3DMULTISAMPLE_TYPE)samples;
-}
-
-}
-
-namespace dx2es
-{
-
-unsigned int GetStencilSize(D3DFORMAT stencilFormat)
-{
-    if (stencilFormat == D3DFMT_INTZ)
-    {
-        return 8;
-    }
-    switch(stencilFormat)
-    {
-      case D3DFMT_D24FS8:
-      case D3DFMT_D24S8:
-        return 8;
-      case D3DFMT_D24X4S4:
-        return 4;
-      case D3DFMT_D15S1:
-        return 1;
-      case D3DFMT_D16_LOCKABLE:
-      case D3DFMT_D32:
-      case D3DFMT_D24X8:
-      case D3DFMT_D32F_LOCKABLE:
-      case D3DFMT_D16:
-        return 0;
-    //case D3DFMT_D32_LOCKABLE:  return 0;   // DirectX 9Ex only
-    //case D3DFMT_S8_LOCKABLE:   return 8;   // DirectX 9Ex only
-      default:
-        return 0;
-    }
-}
-
-unsigned int GetAlphaSize(D3DFORMAT colorFormat)
-{
-    switch (colorFormat)
-    {
-      case D3DFMT_A16B16G16R16F:
-        return 16;
-      case D3DFMT_A32B32G32R32F:
-        return 32;
-      case D3DFMT_A2R10G10B10:
-        return 2;
-      case D3DFMT_A8R8G8B8:
-        return 8;
-      case D3DFMT_A1R5G5B5:
-        return 1;
-      case D3DFMT_X8R8G8B8:
-      case D3DFMT_R5G6B5:
-        return 0;
-      default:
-        return 0;
-    }
-}
-
-unsigned int GetRedSize(D3DFORMAT colorFormat)
-{
-    switch (colorFormat)
-    {
-      case D3DFMT_A16B16G16R16F:
-        return 16;
-      case D3DFMT_A32B32G32R32F:
-        return 32;
-      case D3DFMT_A2R10G10B10:
-        return 10;
-      case D3DFMT_A8R8G8B8:
-      case D3DFMT_X8R8G8B8:
-        return 8;
-      case D3DFMT_A1R5G5B5:
-      case D3DFMT_R5G6B5:
-        return 5;
-      default:
-        return 0;
-    }
-}
-
-unsigned int GetGreenSize(D3DFORMAT colorFormat)
-{
-    switch (colorFormat)
-    {
-      case D3DFMT_A16B16G16R16F:
-        return 16;
-      case D3DFMT_A32B32G32R32F:
-        return 32;
-      case D3DFMT_A2R10G10B10:
-        return 10;
-      case D3DFMT_A8R8G8B8:
-      case D3DFMT_X8R8G8B8:
-        return 8;
-      case D3DFMT_A1R5G5B5:
-        return 5;
-      case D3DFMT_R5G6B5:
-        return 6;
-      default:
-        return 0;
-    }
-}
-
-unsigned int GetBlueSize(D3DFORMAT colorFormat)
-{
-    switch (colorFormat)
-    {
-      case D3DFMT_A16B16G16R16F:
-        return 16;
-      case D3DFMT_A32B32G32R32F:
-        return 32;
-      case D3DFMT_A2R10G10B10:
-        return 10;
-      case D3DFMT_A8R8G8B8:
-      case D3DFMT_X8R8G8B8:
-        return 8;
-      case D3DFMT_A1R5G5B5:
-      case D3DFMT_R5G6B5:
-        return 5;
-      default:
-        return 0;
-    }
-}
-
-unsigned int GetDepthSize(D3DFORMAT depthFormat)
-{
-    if (depthFormat == D3DFMT_INTZ)
-    {
-        return 24;
-    }
-    switch (depthFormat)
-    {
-      case D3DFMT_D16_LOCKABLE:  return 16;
-      case D3DFMT_D32:           return 32;
-      case D3DFMT_D15S1:         return 15;
-      case D3DFMT_D24S8:         return 24;
-      case D3DFMT_D24X8:         return 24;
-      case D3DFMT_D24X4S4:       return 24;
-      case D3DFMT_D16:           return 16;
-      case D3DFMT_D32F_LOCKABLE: return 32;
-      case D3DFMT_D24FS8:        return 24;
-    //case D3DFMT_D32_LOCKABLE:  return 32;   // D3D9Ex only
-    //case D3DFMT_S8_LOCKABLE:   return 0;    // D3D9Ex only
-      default:                   return 0;
-    }
-}
-
-bool IsFloat32Format(D3DFORMAT surfaceFormat)
-{
-    switch(surfaceFormat)
-    {
-      case D3DFMT_R16F:
-      case D3DFMT_G16R16F:
-      case D3DFMT_A16B16G16R16F:
-        return false;
-      case D3DFMT_R32F:
-      case D3DFMT_G32R32F:
-      case D3DFMT_A32B32G32R32F:
-        return true;
-      case D3DFMT_A8R8G8B8:
-      case D3DFMT_X8R8G8B8:
-      case D3DFMT_A1R5G5B5:
-      case D3DFMT_R5G6B5:
-        return false;
-      default: UNREACHABLE();
-    }
-    return false;
-}
-
-bool IsFloat16Format(D3DFORMAT surfaceFormat)
-{
-    switch(surfaceFormat)
-    {
-      case D3DFMT_R16F:
-      case D3DFMT_G16R16F:
-      case D3DFMT_A16B16G16R16F:
-        return true;
-      case D3DFMT_R32F:
-      case D3DFMT_G32R32F:
-      case D3DFMT_A32B32G32R32F:
-        return false;
-      case D3DFMT_A8R8G8B8:
-      case D3DFMT_X8R8G8B8:
-      case D3DFMT_A1R5G5B5:
-      case D3DFMT_R5G6B5:
-        return false;
-      default: UNREACHABLE();
-    }
-    return false;
-}
-
-bool IsDepthTextureFormat(D3DFORMAT surfaceFormat)
-{
-    return (surfaceFormat == D3DFMT_INTZ);
-}
-
-bool IsStencilTextureFormat(D3DFORMAT surfaceFormat)
-{
-    return (surfaceFormat == D3DFMT_INTZ);
-}
-
-GLsizei GetSamplesFromMultisampleType(D3DMULTISAMPLE_TYPE type)
-{
-    if (type == D3DMULTISAMPLE_NONMASKABLE)
-        return 0;
-    else
-        return type;
-}
-
-GLenum ConvertBackBufferFormat(D3DFORMAT format)
-{
-    switch (format)
-    {
-      case D3DFMT_A4R4G4B4: return GL_RGBA4;
-      case D3DFMT_A8R8G8B8: return GL_RGBA8_OES;
-      case D3DFMT_A1R5G5B5: return GL_RGB5_A1;
-      case D3DFMT_R5G6B5:   return GL_RGB565;
-      case D3DFMT_X8R8G8B8: return GL_RGB8_OES;
-      default:
-        UNREACHABLE();
-    }
-
-    return GL_RGBA4;
-}
-
-GLenum ConvertDepthStencilFormat(D3DFORMAT format)
-{
-    if (format == D3DFMT_INTZ)
-    {
-        return GL_DEPTH24_STENCIL8_OES;
-    }
-    switch (format)
-    {
-      case D3DFMT_D16:
-      case D3DFMT_D24X8:
-        return GL_DEPTH_COMPONENT16;
-      case D3DFMT_D24S8:
-        return GL_DEPTH24_STENCIL8_OES;
-      default:
-        UNREACHABLE();
-    }
-
-    return GL_DEPTH24_STENCIL8_OES;
-}
-
-}
-
-std::string getTempPath()
-{
-    char path[MAX_PATH];
-    DWORD pathLen = GetTempPathA(sizeof(path) / sizeof(path[0]), path);
-    if (pathLen == 0)
-    {
-        UNREACHABLE();
-        return std::string();
-    }
-
-    UINT unique = GetTempFileNameA(path, "sh", 0, path);
-    if (unique == 0)
-    {
-        UNREACHABLE();
-        return std::string();
-    }
-    
-    return path;
-}
-
-void writeFile(const char* path, const void* content, size_t size)
-{
-    FILE* file = fopen(path, "w");
-    if (!file)
-    {
-        UNREACHABLE();
-        return;
-    }
-
-    fwrite(content, sizeof(char), size, file);
-    fclose(file);
-}
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/utilities.h b/Source/ThirdParty/ANGLE/src/libGLESv2/utilities.h
deleted file mode 100644
index cf22418..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/utilities.h
+++ /dev/null
@@ -1,112 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// utilities.h: Conversion functions and other utility routines.
-
-#ifndef LIBGLESV2_UTILITIES_H
-#define LIBGLESV2_UTILITIES_H
-
-#define GL_APICALL
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#include <d3d9.h>
-
-#include <string>
-
-const D3DFORMAT D3DFMT_INTZ = ((D3DFORMAT)(MAKEFOURCC('I','N','T','Z')));
-const D3DFORMAT D3DFMT_NULL = ((D3DFORMAT)(MAKEFOURCC('N','U','L','L')));
-
-namespace gl
-{
-
-struct Color;
-
-int UniformExternalComponentCount(GLenum type);
-int UniformInternalComponentCount(GLenum type);
-GLenum UniformComponentType(GLenum type);
-size_t UniformInternalSize(GLenum type);
-size_t UniformExternalSize(GLenum type);
-int VariableRowCount(GLenum type);
-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 IsDepthTexture(GLenum format);
-bool IsCubemapTextureTarget(GLenum target);
-bool IsInternalTextureTarget(GLenum target);
-GLenum ExtractFormat(GLenum internalformat);
-GLenum ExtractType(GLenum internalformat);
-
-bool IsColorRenderable(GLenum internalformat);
-bool IsDepthRenderable(GLenum internalformat);
-bool IsStencilRenderable(GLenum internalformat);
-
-}
-
-namespace es2dx
-{
-
-D3DCMPFUNC ConvertComparison(GLenum comparison);
-D3DCOLOR ConvertColor(gl::Color color);
-D3DBLEND ConvertBlendFunc(GLenum blend);
-D3DBLENDOP ConvertBlendOp(GLenum blendOp);
-D3DSTENCILOP ConvertStencilOp(GLenum stencilOp);
-D3DTEXTUREADDRESS ConvertTextureWrap(GLenum wrap);
-D3DCULL ConvertCullMode(GLenum cullFace, GLenum frontFace);
-D3DCUBEMAP_FACES ConvertCubeFace(GLenum cubeFace);
-DWORD ConvertColorMask(bool red, bool green, bool blue, bool alpha);
-D3DTEXTUREFILTERTYPE ConvertMagFilter(GLenum magFilter);
-void ConvertMinFilter(GLenum minFilter, D3DTEXTUREFILTERTYPE *d3dMinFilter, D3DTEXTUREFILTERTYPE *d3dMipFilter);
-bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount,
-                          D3DPRIMITIVETYPE *d3dPrimitiveType, int *d3dPrimitiveCount);
-D3DFORMAT ConvertRenderbufferFormat(GLenum format);
-D3DMULTISAMPLE_TYPE GetMultisampleTypeFromSamples(GLsizei samples);
-
-}
-
-namespace dx2es
-{
-GLuint GetAlphaSize(D3DFORMAT colorFormat);
-GLuint GetRedSize(D3DFORMAT colorFormat);
-GLuint GetGreenSize(D3DFORMAT colorFormat);
-GLuint GetBlueSize(D3DFORMAT colorFormat);
-GLuint GetDepthSize(D3DFORMAT depthFormat);
-GLuint GetStencilSize(D3DFORMAT stencilFormat);
-bool IsFloat32Format(D3DFORMAT surfaceFormat);
-bool IsFloat16Format(D3DFORMAT surfaceFormat);
-bool IsDepthTextureFormat(D3DFORMAT surfaceFormat);
-bool IsStencilTextureFormat(D3DFORMAT surfaceFormat);
-
-GLsizei GetSamplesFromMultisampleType(D3DMULTISAMPLE_TYPE type);
-
-GLenum ConvertBackBufferFormat(D3DFORMAT format);
-GLenum ConvertDepthStencilFormat(D3DFORMAT format);
-
-}
-
-std::string getTempPath();
-void writeFile(const char* path, const void* data, size_t size);
-
-inline bool isDeviceLostError(HRESULT errorCode)
-{
-    switch (errorCode)
-    {
-      case D3DERR_DRIVERINTERNALERROR:
-      case D3DERR_DEVICELOST:
-      case D3DERR_DEVICEHUNG:
-      case D3DERR_DEVICEREMOVED:
-        return true;
-      default:
-        return false;
-    }
-};
-
-#endif  // LIBGLESV2_UTILITIES_H
diff --git a/Source/ThirdParty/ANGLE/src/libGLESv2/vertexconversion.h b/Source/ThirdParty/ANGLE/src/libGLESv2/vertexconversion.h
deleted file mode 100644
index 5bb8b89..0000000
--- a/Source/ThirdParty/ANGLE/src/libGLESv2/vertexconversion.h
+++ /dev/null
@@ -1,208 +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.
-//
-
-// vertexconversion.h: A library of vertex conversion classes that can be used to build
-// the FormatConverter objects used by the buffer conversion system.
-
-#ifndef LIBGLESV2_VERTEXCONVERSION_H_
-#define LIBGLESV2_VERTEXCONVERSION_H_
-
-#include <cstddef>
-#include <limits>
-
-#include "libGLESv2/Context.h" // Defines Index
-
-namespace gl
-{
-
-// Conversion types:
-// static const bool identity: true if this is an identity transform, false otherwise
-// static U convert(T): convert a single element from the input type to the output type
-// typedef ... OutputType: the type produced by this conversion
-
-template <class T>
-struct Identity
-{
-    static const bool identity = true;
-
-    typedef T OutputType;
-
-    static T convert(T x)
-    {
-        return x;
-    }
-};
-
-template <class FromT, class ToT>
-struct Cast
-{
-    static const bool identity = false;
-
-    typedef ToT OutputType;
-
-    static ToT convert(FromT x)
-    {
-        return static_cast<ToT>(x);
-    }
-};
-
-template <class T>
-struct Cast<T, T>
-{
-    static const bool identity = true;
-
-    typedef T OutputType;
-
-    static T convert(T x)
-    {
-        return static_cast<T>(x);
-    }
-};
-
-template <class T>
-struct Normalize
-{
-    static const bool identity = false;
-
-    typedef float OutputType;
-
-    static float convert(T x)
-    {
-        typedef std::numeric_limits<T> NL;
-        float f = static_cast<float>(x);
-
-        if (NL::is_signed)
-        {
-            // const float => VC2008 computes it at compile time
-            // static const float => VC2008 computes it the first time we get here, stores it to memory with static guard and all that.
-            const float divisor = 1.0f/(2*static_cast<float>(NL::max())+1);
-            return (2*f+1)*divisor;
-        }
-        else
-        {
-            return f/NL::max();
-        }
-    }
-};
-
-template <class FromType, std::size_t ScaleBits>
-struct FixedToFloat
-{
-    static const bool identity = false;
-
-    typedef float OutputType;
-
-    static float convert(FromType x)
-    {
-        const float divisor = 1.0f / static_cast<float>(static_cast<FromType>(1) << ScaleBits);
-        return static_cast<float>(x) * divisor;
-    }
-};
-
-// Widen types:
-// static const unsigned int initialWidth: number of components before conversion
-// static const unsigned int finalWidth: number of components after conversion
-
-// Float is supported at any size.
-template <std::size_t N>
-struct NoWiden
-{
-    static const std::size_t initialWidth = N;
-    static const std::size_t finalWidth = N;
-};
-
-// SHORT, norm-SHORT, norm-UNSIGNED_SHORT are supported but only with 2 or 4 components
-template <std::size_t N>
-struct WidenToEven
-{
-    static const std::size_t initialWidth = N;
-    static const std::size_t finalWidth = N+(N&1);
-};
-
-template <std::size_t N>
-struct WidenToFour
-{
-    static const std::size_t initialWidth = N;
-    static const std::size_t finalWidth = 4;
-};
-
-// Most types have 0 and 1 that are just that.
-template <class T>
-struct SimpleDefaultValues
-{
-    static T zero() { return static_cast<T>(0); }
-    static T one() { return static_cast<T>(1); }
-};
-
-// But normalised types only store [0,1] or [-1,1] so 1.0 is represented by the max value.
-template <class T>
-struct NormalizedDefaultValues
-{
-    static T zero() { return static_cast<T>(0); }
-    static T one() { return std::numeric_limits<T>::max(); }
-};
-
-// Converter:
-// static const bool identity: true if this is an identity transform (with no widening)
-// static const std::size_t finalSize: number of bytes per output vertex
-// static void convertArray(const void *in, std::size_t stride, std::size_t n, void *out): convert an array of vertices. Input may be strided, but output will be unstrided.
-
-template <class InT, class WidenRule, class Converter, class DefaultValueRule = SimpleDefaultValues<InT> >
-struct VertexDataConverter
-{
-    typedef typename Converter::OutputType OutputType;
-    typedef InT InputType;
-
-    static const bool identity = (WidenRule::initialWidth == WidenRule::finalWidth) && Converter::identity;
-    static const std::size_t finalSize = WidenRule::finalWidth * sizeof(OutputType);
-
-    static void convertArray(const InputType *in, std::size_t stride, std::size_t n, OutputType *out)
-    {
-        for (std::size_t i = 0; i < n; i++)
-        {
-            const InputType *ein = pointerAddBytes(in, i * stride);
-
-            copyComponent(out, ein, 0, static_cast<OutputType>(DefaultValueRule::zero()));
-            copyComponent(out, ein, 1, static_cast<OutputType>(DefaultValueRule::zero()));
-            copyComponent(out, ein, 2, static_cast<OutputType>(DefaultValueRule::zero()));
-            copyComponent(out, ein, 3, static_cast<OutputType>(DefaultValueRule::one()));
-
-            out += WidenRule::finalWidth;
-        }
-    }
-
-    static void convertArray(const void *in, std::size_t stride, std::size_t n, void *out)
-    {
-        return convertArray(static_cast<const InputType*>(in), stride, n, static_cast<OutputType*>(out));
-    }
-
-  private:
-    // Advance the given pointer by a number of bytes (not pointed-to elements).
-    template <class T>
-    static T *pointerAddBytes(T *basePtr, std::size_t numBytes)
-    {
-        return reinterpret_cast<T *>(reinterpret_cast<uintptr_t>(basePtr) + numBytes);
-    }
-
-    static void copyComponent(OutputType *out, const InputType *in, std::size_t elementindex, OutputType defaultvalue)
-    {
-        if (WidenRule::finalWidth > elementindex)
-        {
-            if (WidenRule::initialWidth > elementindex)
-            {
-                out[elementindex] = Converter::convert(in[elementindex]);
-            }
-            else
-            {
-                out[elementindex] = defaultvalue;
-            }
-        }
-    }
-};
-
-}
-
-#endif   // LIBGLESV2_VERTEXCONVERSION_H_
diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt
index 684b9be..a5bdc4a 100644
--- a/Source/WebCore/CMakeLists.txt
+++ b/Source/WebCore/CMakeLists.txt
@@ -2710,24 +2710,17 @@
         ${THIRDPARTY_DIR}/ANGLE/src/compiler/parseConst.cpp
         ${THIRDPARTY_DIR}/ANGLE/src/compiler/ParseHelper.cpp
         ${THIRDPARTY_DIR}/ANGLE/src/compiler/PoolAlloc.cpp
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/atom.c
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/cpp.c
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/cppstruct.c
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/memory.c
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/new/DiagnosticsBase.cpp
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/new/DirectiveHandlerBase.cpp
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/new/DirectiveParser.cpp
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/new/ExpressionParser.cpp
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/new/Input.cpp
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/new/Lexer.cpp
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/new/Macro.cpp
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/new/MacroExpander.cpp
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/new/Preprocessor.cpp
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/new/Token.cpp
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/new/Tokenizer.cpp
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/scanner.c
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/symbols.c
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/tokens.c
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/DiagnosticsBase.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/DirectiveHandlerBase.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/DirectiveParser.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/Input.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/Lexer.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/Macro.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/MacroExpander.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/Preprocessor.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/Token.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/Tokenizer.cpp
         ${THIRDPARTY_DIR}/ANGLE/src/compiler/QualifierAlive.cpp
         ${THIRDPARTY_DIR}/ANGLE/src/compiler/RemoveTree.cpp
         ${THIRDPARTY_DIR}/ANGLE/src/compiler/SearchSymbol.cpp
@@ -2742,6 +2735,7 @@
         ${THIRDPARTY_DIR}/ANGLE/src/compiler/util.cpp
         ${THIRDPARTY_DIR}/ANGLE/src/compiler/ValidateLimitations.cpp
         ${THIRDPARTY_DIR}/ANGLE/src/compiler/VariableInfo.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/VariablePacker.cpp
         ${THIRDPARTY_DIR}/ANGLE/src/compiler/VersionGLSL.cpp
     )
 
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 250f601..ddf95eb 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2013-01-14  Max Vujovic  <mvujovic@adobe.com>
+
+        [ANGLE] Update ANGLE in WebKit
+        https://bugs.webkit.org/show_bug.cgi?id=106274
+
+        Reviewed by Dean Jackson.
+
+        Update ANGLE to r1641.
+
+        Update the files used in the EFL and GTK builds.
+
+        No new tests. No change in behavior.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+
 2013-01-14  Julien Chaffraix  <jchaffraix@webkit.org>
 
         REGRESSION (r132591): Underpainting @ uofmchildrenshospital.org
diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am
index 4046a99..c61714f 100644
--- a/Source/WebCore/GNUmakefile.list.am
+++ b/Source/WebCore/GNUmakefile.list.am
@@ -6311,48 +6311,32 @@
 	Source/ThirdParty/ANGLE/src/compiler/PoolAlloc.cpp \
 	Source/ThirdParty/ANGLE/src/compiler/PoolAlloc.h \
 	Source/ThirdParty/ANGLE/src/compiler/Pragma.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/atom.c \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/atom.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/compile.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.c \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/cpp.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/cppstruct.c \
 	Source/ThirdParty/ANGLE/src/compiler/preprocessor/length_limits.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.c \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/memory.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DiagnosticsBase.cpp \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Diagnostics.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveHandlerBase.cpp \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveHandler.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveParser.cpp \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/DirectiveParser.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/ExpressionParser.cpp \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/ExpressionParser.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Input.cpp \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Input.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Lexer.cpp \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Lexer.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Macro.cpp \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Macro.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/MacroExpander.cpp \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/MacroExpander.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Preprocessor.cpp \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Preprocessor.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/SourceLocation.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Token.cpp \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Token.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Tokenizer.cpp \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Tokenizer.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/pp_utils.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/parser.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/preprocess.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.c \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/scanner.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/slglobals.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/symbols.c \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/symbols.h \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/tokens.c \
-	Source/ThirdParty/ANGLE/src/compiler/preprocessor/tokens.h \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/numeric_lex.h \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.cpp \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/Diagnostics.h \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveHandlerBase.cpp \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveHandlerBase.h \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.cpp \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.h \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.h \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/Input.cpp \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/Input.h \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/Lexer.cpp \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/Lexer.h \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/Macro.cpp \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/Macro.h \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/MacroExpander.cpp \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/MacroExpander.h \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.cpp \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.h \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/SourceLocation.h \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/Token.cpp \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/Token.h \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.cpp \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.h \
+	Source/ThirdParty/ANGLE/src/compiler/preprocessor/pp_utils.h \
 	Source/ThirdParty/ANGLE/src/compiler/QualifierAlive.cpp \
 	Source/ThirdParty/ANGLE/src/compiler/QualifierAlive.h \
 	Source/ThirdParty/ANGLE/src/compiler/RemoveTree.cpp \
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog
index 0d0815b..1f568d9 100644
--- a/Source/WebKit/ChangeLog
+++ b/Source/WebKit/ChangeLog
@@ -1,3 +1,15 @@
+2013-01-14  Max Vujovic  <mvujovic@adobe.com>
+
+        [ANGLE] Update ANGLE in WebKit
+        https://bugs.webkit.org/show_bug.cgi?id=106274
+
+        Reviewed by Dean Jackson.
+
+        Update ANGLE to r1641.
+
+        * PlatformEfl.cmake: Add ANGLE/include to the include directories list because ShaderLang.h
+        now includes "KHR/khrplatform.h", which is located in ANGLE/include/KHR/khrplatform.h.
+
 2013-01-10  Christophe Dumez  <christophe.dumez@intel.com>
 
         [EFL] Add gstreamer 1.0.5 to jhbuild
diff --git a/Source/WebKit/PlatformEfl.cmake b/Source/WebKit/PlatformEfl.cmake
index 47395c2..a458ed4 100644
--- a/Source/WebKit/PlatformEfl.cmake
+++ b/Source/WebKit/PlatformEfl.cmake
@@ -78,6 +78,7 @@
     list(APPEND WebKit_INCLUDE_DIRECTORIES
         "${WEBCORE_DIR}/platform/graphics/surfaces"
         "${WEBCORE_DIR}/platform/graphics/texmap"
+        "${THIRDPARTY_DIR}/ANGLE/include"
         "${THIRDPARTY_DIR}/ANGLE/include/GLSLANG"
     )
 endif ()
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index 1efdf77..4f58bdc 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,15 @@
+2013-01-14  Max Vujovic  <mvujovic@adobe.com>
+
+        [ANGLE] Update ANGLE in WebKit
+        https://bugs.webkit.org/show_bug.cgi?id=106274
+
+        Reviewed by Dean Jackson.
+
+        Update ANGLE to r1641.
+
+        * PlatformEfl.cmake: Add ANGLE/include to the include directories list because ShaderLang.h
+        now includes "KHR/khrplatform.h", which is located in ANGLE/include/KHR/khrplatform.h.
+
 2013-01-14  Alexey Proskuryakov  <ap@apple.com>
 
         NetworkProcess scheduler never resumes resource loads that were postponed
diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake
index c57c28e..ea41035 100644
--- a/Source/WebKit2/PlatformEfl.cmake
+++ b/Source/WebKit2/PlatformEfl.cmake
@@ -195,6 +195,7 @@
 
 if (WTF_USE_3D_GRAPHICS)
     list(APPEND WebKit2_INCLUDE_DIRECTORIES
+        "${THIRDPARTY_DIR}/ANGLE/include"
         "${THIRDPARTY_DIR}/ANGLE/include/GLSLANG"
     )
 endif ()